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 openapi schema for proper patching of CRDs #314

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

larsks
Copy link
Member

@larsks larsks commented Nov 7, 2023

Due to issues with the way Kustomize handles patching lists in custom
resource types, we need to provide a complete OpenAPI schema that
includes schema definitions for any CRDs we wish to patch.

See cluster-scope/base/openapi/README.md for more information.

@larsks larsks self-assigned this Nov 7, 2023
@computate
Copy link
Member

@larsks is the openshift-api-schema.json file specific to a certain cluster? What if we want to patch a GrafanaDataSource CRD on the upcoming observability cluster that doesn't manage secrets well and requires the Patch Operator:

apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource

@larsks
Copy link
Member Author

larsks commented Nov 8, 2023

is the openshift-api-schema.json file specific to a certain cluster?

It is not. It needs to be a superset of the resources available in all of our clusters (at least those we want to patch).

What if we want to patch a GrafanaDataSource CRD on the upcoming observability cluster that doesn't manage secrets well and requires the Patch Operator:

Then we would need to add the appropriate schemas to the file.


I've partly addressed this in the README:

To support this, that means we need to dump the complete openapi schema
from our clusters to a file and make that available to Kustomize. This
commit introduces an initial version of this schema, but we will need
to update this in the future whenever we want to patch CRDs that
weren't available at the time we last generated this schema dump.

@larsks larsks force-pushed the feature/add-openapi-schema branch from 41fc511 to 32c483f Compare November 9, 2023 02:56
@larsks
Copy link
Member Author

larsks commented Nov 9, 2023

I've had a change of heart about how to implement this; I've moved all the sausage making to https://github.com/nerc-project/openshift-schemas; the generated schema is included here by URL.

@larsks larsks requested a review from dystewart November 9, 2023 16:27
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@larsks larsks force-pushed the feature/add-openapi-schema branch from 32c483f to ca564ba Compare November 9, 2023 18:01
Due to issues with the way Kustomize handles patching lists in custom
resource types, we need to provide a complete OpenAPI schema that
includes schema definitions for any CRDs we wish to patch. See
kubernetes-sigs/kustomize#4613 for more
discussion on this topic.

See `cluster-scope/base/openapi/README.md` for more information.
@larsks larsks force-pushed the feature/add-openapi-schema branch from ca564ba to 4abace2 Compare November 9, 2023 18:05
@larsks larsks merged commit df65675 into OCP-on-NERC:main Nov 9, 2023
2 checks passed
@computate
Copy link
Member

That new repo is very clever, I like your sausage recipe.

larsks added a commit to larsks/nerc-ocp-config that referenced this pull request Nov 21, 2023
So OCP-on-NERC#314 was totally broken; Kustomize can't import an openapi schema
from a URL (which is annoying), so this includes the schema directly
in the repository. Sorry for the noise!
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.

5 participants