Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions component/cluster-api.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ com.Kustomization(
},
],
patchesStrategicMerge: [ 'rm-namespace.yaml' ],
patches: [ capi.kustomize_patch_crd_clusterctl_label.patch ],
// NOTE(sg): Somehow the upstream replacements don't take our `namespace`
// override into account? For now, we replicate the namespace replacements
// here to workaround this issue.
Expand Down Expand Up @@ -143,4 +142,4 @@ com.Kustomization(
},
},
],
} + capi.kustomize_patch_crd_clusterctl_label.patch_file
} + capi.kustomize_crd_clusterctl_label_patch
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/references/library.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ This function creates a minimal custom resource based on the function arguments.
The function only populates fields `apiVersion`, `kind` and `metadata.name`.
The function uses library field `apiVersion` to create field `apiVersion` based on the provided `apiGroup`.
Fields `kind` and `metadata.name` are set to the values of arguments `kind` and `name` respectively.

== `kustomize_crd_clusterctl_label_patch`

This library field provides a Kustomize patch which applies label `clusterctl.cluster.x-k8s.io=""` to all CRDs which are part of the target Kustomization.

This library field provides the patch as an object which is suitable to be merged into the output of https://syn.tools/commodore/reference/commodore-libjsonnet.html#_kustomizationbase_url_base_version_images_kustomize_input[the Commodore `com.Kustomization()` helper function].
36 changes: 19 additions & 17 deletions lib/capi-core.libsonnet
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
kustomize_patch_crd_clusterctl_label: {
patch: {
path: 'clusterctl-label.yaml',
target: {
group: 'apiextensions.k8s.io',
version: 'v1',
kind: 'CustomResourceDefinition',
},
// NOTE(sg): This is structured in a way that allows it to be merged into
// the result of `com.Kustomzation()` without any adjustments.
kustomize_crd_clusterctl_label_patch: {
kustomization+: {
patches+: [ {
path: 'capi-core-clusterctl-label.yaml',
target: {
group: 'apiextensions.k8s.io',
version: 'v1',
kind: 'CustomResourceDefinition',
},
} ],
},
patch_file: {
'clusterctl-label': {
apiVersion: 'apiextensions.k8s.io/v1',
kind: 'CustomResourceDefinition',
metadata: {
name: 'REPLACE_ME',
labels: {
'clusterctl.cluster.x-k8s.io': '',
},
'capi-core-clusterctl-label': {
apiVersion: 'apiextensions.k8s.io/v1',
kind: 'CustomResourceDefinition',
metadata: {
name: 'REPLACE_ME',
labels: {
'clusterctl.cluster.x-k8s.io': '',
},
},
},
Expand Down
Loading