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

Simple tooling to generate CRDs for LoggingLogMetric #1754

Merged
merged 10 commits into from
May 20, 2024

Conversation

justinsb
Copy link
Collaborator

@justinsb justinsb commented May 9, 2024

  • LoggingLogMetric: sync up schema labels & printColumns
  • LoggingLogMetric: make spec required
  • fix: deepcopy-gen annotations on shared package
  • chore: create simple script to generate crds from direct apis
  • autogen: generate crds using dev/tasks/generate-crds

@@ -71,7 +76,6 @@ spec:
bounds:
description: The values must be monotonically increasing.
items:
format: double
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC, we were told this info is not exactly sent over to the api server but 🙈 we still want these, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we believe this is not actually used. That we specify double (float64) but the official tools drop it supports this. So I don't think we need it.

Maybe we should try to figure out how to add it just so we don't need to worry about it, but it would be a pain I think...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, scratch that, just found the // +kubebuilder:validation:Format directive

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Although this particular one is a problem because the format has moved to the slice, which is likely wrong

Copy link
Collaborator

@yuwenma yuwenma May 20, 2024

Choose a reason for hiding this comment

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

+1. I like the approach of using kubebuilder to validate the CRD. Also, we shall have// +kubebuilder:validation:Required on spec.filter.

One thing I don't figure out how it works is that the LLM CRD has filter set as required. But I was assuming the CRD is generated from this file which should have filter as optional (default). Thoughts?

@justinsb justinsb added this to the 1.118 milestone May 10, 2024
Comment on lines +38 to +39
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/
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious, any of this can be achieved by kustomize?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe, but I think we'd have to use KRM functions (e.g. delete-annotation). I figure we can start this way and then hopefully create KRM functions.

@yuwenma yuwenma modified the milestones: 1.118, 1.119 May 14, 2024
Another small delta with the existing schema.
These simply didn't work when we tried to generate from them.
@justinsb justinsb changed the title WIP: Simple tooling to generate CRDs for LoggingLogMetric Simple tooling to generate CRDs for LoggingLogMetric May 19, 2024
We're not sure that these matter, but it means we don't have to worry
about it every time.
@justinsb justinsb force-pushed the sync_crds branch 2 times, most recently from a855c87 to a8f6e52 Compare May 20, 2024 12:35
@@ -162,7 +162,7 @@ type LoggingLogMetricSpec struct {
bucket has to be in the same project as the metric. For
example:projects/my-project/locations/global/buckets/my-bucket
If empty, then the Log Metric is considered a non-Bucket Log Metric.
Only `external` field is supported to configure the reference. */
Only `external` field is supported to configure the reference for now. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this change? I think the CRD is generated from the ./apis.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, can we delete the TF-based APIs? Otherwise it could be really easy to get confused.

@justinsb justinsb force-pushed the sync_crds branch 2 times, most recently from a11fb6f to b1d810f Compare May 20, 2024 16:23
@yuwenma
Copy link
Collaborator

yuwenma commented May 20, 2024

/lgtm
/approve

/hold (Feel free to cancel the hold, just in case you are on some more commits)

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

@justinsb
Copy link
Collaborator Author

I split out the last commit as #1843 but we can just merge this if you want

@justinsb
Copy link
Collaborator Author

OK, #1843 merged, so let's see if github can figure out this rebase

/hold cancel

@google-oss-prow google-oss-prow bot merged commit 07498c7 into GoogleCloudPlatform:master May 20, 2024
12 checks passed
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.

None yet

3 participants