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 APIKeysKey go types generated from proto #1872

Merged
merged 4 commits into from
May 24, 2024

Conversation

justinsb
Copy link
Collaborator

  • chore: reflow descriptions when generating CRDs
  • chore: add APIKeysKey go types generated from proto
  • autogen: generate direct-actuation CRDs

@justinsb justinsb force-pushed the generate_apikeys branch 2 times, most recently from 5cca035 to 264b56a Compare May 22, 2024 02:24
Copy link
Collaborator

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

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

/lgtm

// DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
// Output format is the latter.
// +required
Sha1Fingerprint *string `json:"sha1Fingerprint,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if that's feasible. I hope that we can detect the "+required" and add a kubebuilder/kcc validator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So +required works now, after kubernetes-sigs/controller-tools#944

We don't yet validate the input format (though I would expect GCP to reject it if invalid, so the user will still get a reasonable error, we shouldn't fail silently)

Because the input and output formats are potentially different, we'll need to be careful here, we can't just do a naive diff to determine if we need to re-reconcile.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So +required works now, after kubernetes-sigs/controller-tools#944

Ah! This is so fresh and good news!

We don't yet validate the input format (though I would expect GCP to reject it if invalid, so the user will still get a reasonable error, we shouldn't fail silently)

Agree. I think I want to have basic and general validation on CRD, and have more server specific/usage related validation from the GCP server.

Because the input and output formats are potentially different, we'll need to be careful here, we can't just do a naive diff to determine if we need to re-reconcile.

Yes. This makes a lot of sense.

@@ -38,6 +38,7 @@ go run ./scripts/crd-tools set-field spec.preserveUnknownFields=false --dir apis
go run ./scripts/crd-tools delete-field status --dir apis/config/crd/
go run ./scripts/crd-tools set-annotation cnrm.cloud.google.com/version=0.0.0-dev --dir apis/config/crd/
go run ./scripts/crd-tools delete-annotation controller-gen.kubebuilder.io/version --dir apis/config/crd/
go run ./scripts/crd-tools reflow-descriptions --dir apis/config/crd/
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have apis/config/crd dir yet. Is this for future structure?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So actually this script generates that directory. We don't check it in currently, and it does get "left behind" if you run it locally. I'm not sure if we should delete it in the script (or generate it under .build). WDYT?

Copy link
Collaborator

@yuwenma yuwenma May 24, 2024

Choose a reason for hiding this comment

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

Oh I see what this script does. (I was more thinking about keeping config/crds as the single CRD dir)

I"ll vote for .build.

return s
}

func (v *visitor) visitDescription(s string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very cool!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we're going to need a package for visitors/object walkers at some point .. it keeps coming up :-)

This avoids whitespace changes which make the diff harder to review.
We have a test that detected this field is being removed (it's an
alpha resource, so not a problem).

Remove the mapping to keep the test happy.
@yuwenma
Copy link
Collaborator

yuwenma commented May 24, 2024

/lgtm
/approve

Thank you for this PR. very cool!

@google-oss-prow google-oss-prow bot added the lgtm label May 24, 2024
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yuwenma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 5ee1539 into GoogleCloudPlatform:master May 24, 2024
12 checks passed
@yuwenma yuwenma added this to the 1.118 milestone Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants