Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add day 1 API for cluster #7

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

petrkotas
Copy link
Member

@petrkotas petrkotas commented Feb 20, 2024

Creates the initial implementation of the hcpCluster
API for day 1 operations.

@petrkotas petrkotas changed the title Add devcontainer Add day 1 API for cluster Feb 20, 2024
Copy link
Collaborator

@UlrichSchlueter UlrichSchlueter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the .devcontainer folder and the top level files here (README, .gitignore,.editorconfig) ?

@petrkotas petrkotas force-pushed the add-typespec-api branch 2 times, most recently from aa0e413 to 547e999 Compare February 22, 2024 12:05
@petrkotas
Copy link
Member Author

@UlrichSchlueter we do not, it was remaining from the dependency of a different branch. I rebased and now the commit is out.

@petrkotas petrkotas marked this pull request as ready for review February 22, 2024 12:09
@petrkotas petrkotas requested a review from mbarnes as a code owner February 22, 2024 12:09
Copy link
Collaborator

@mbarnes mbarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question on file structure, potentially more for myself than this PR since I'm coding these APIs in Go...

For comparison, ARO-RP puts API specifications under /swagger and the Go files under /pkg/api (not /api).

Do we want the TypeSpec files and Go files to live together under /api or would it be better to separate them, say by having these specs in a /typespec folder and the Go files in /api (or /pkg/api)?


/** Worker node pools configuration */
@visibility("create", "update")
nodePoolProfile: NodePoolProfile[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be plural since it's an array, yes? (cf. ingressProfiles above)

Copy link
Collaborator

@mbarnes mbarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for another one-off comment.

In the TypeSpec file I'm seeing a lot of

@visibility("create", "update")

As I understand TypeSpec visibility, it's converted directly to the x-ms-mutability OpenAPI annotation and "create, update" alone specifies a write-only field which ARM guidelines forbid:

OAPI027: API must not have write-Only properties
Write-only properties are not acceptible ("x-ms-mutability": ["create", "update"]).
User must be able to read the properties (GET/LIST).
This will create noise in what-if reports that would show write-only properties as an update.

I think these cases all need to be

@visibility("read", "create", "update")

which is equivalent to omitting @visibility.

* if omitted, the default encryption key is used
*/
@visibility("create")
etcdEncryption?: EtcdEncryptionProfile;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named etcdEncryptionProfile for consistency's sake?

availabilityZone: string;

/** The type of the disc storage account */
discStorageAccountType: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should discStorageAccountType be an enum?

mbarnes pushed a commit to mbarnes/ARO-HCP that referenced this pull request Mar 7, 2024
mbarnes pushed a commit to mbarnes/ARO-HCP that referenced this pull request Mar 7, 2024
@petrkotas petrkotas requested a review from bennerv as a code owner March 12, 2024 16:08
Comment on lines 279 to 289
/** Etcd encryption profile sets the configuration needed for
* customer brought keys to encrypt the etcd.
* This is an optional field, if omitted the default encryption key is used.
* TODO: decide how this is going to be implemented
*/
model EtcdEncryptionProfile {
/** The id of the disk encryption set to be used for etcd
* Is relies on https://learn.microsoft.com/en-us/azure/storage/common/customer-managed-keys-overview
*/
discEncryptionSetId: string;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer used, since the etcdEncryptionSetId is now part of the PlatformProfile model.

Copy link
Contributor

@s-amann s-amann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrkotas please rename the directory redhatopenshift/Hypershift to redhatopenshift/hcpcluster or redhatopenshift/hcpopenshiftcluster. There are also lots of "Hypershift" mentioned in the comments which needs to be refactored.

* When set to true, `platform.etcdEncryptionSetId` must be set
*/
@visibility("create")
etcdEncryption?: boolean = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field strikes me as redundant. Could we either drop it or make it read-only and just say the presence of a non-empty platform.etcdEncryptionSetId in the PUT request implies encryption is enabled?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we use this is to provide fast-fail validation. For example, if you set FIPS=true, we force etcdEncryption to also be true, which forces the request to fail if encryptionSetId is empty. There might be other use cases (at least we have some others in CS why we do it this way) that may or may not apply.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably enforcing this consistency will be part of the RP's static validation. Still seems to me this field could be read-only; the static validation can check if etcdEncryptionSetId is non-empty as easily as whether etcdEncryption is true. What you're describing wrt FIPS sound like an implementation detail.

@petrkotas petrkotas force-pushed the add-typespec-api branch 2 times, most recently from e2a3ff0 to 9d810b2 Compare March 25, 2024 11:14
@petrkotas
Copy link
Member Author

@s-amann I have updated the references to mention only hcpCluster.

@petrkotas
Copy link
Member Author

I have also removed all links to openshift documentation as it was pointing to fixed version.

Creates the initial implementation of the hcpCluster
API for day 1 operations.
Copy link
Contributor

@mjlshen mjlshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@s-amann s-amann merged commit 9e1c517 into Azure:main Mar 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants