Skip to content

Commit

Permalink
Update kustomization.yaml files to new format (#387)
Browse files Browse the repository at this point in the history
kustomize has deprecated the older format which our older kustomization files were based on. These older format files were leading to a lot of deprecation warnings from kustomize during our build processes.

We used kustomize edit fix command to update our old kustomize files to our new kustomize files. This PR was largely auto-generated using the following command.

```
$ find . -type d -exec bash -c 'cd {} && kustomize edit fix' \;
```
  • Loading branch information
thunderboltsid authored Mar 26, 2024
1 parent 9ccfa89 commit b7bd47d
Show file tree
Hide file tree
Showing 41 changed files with 406 additions and 403 deletions.
47 changes: 25 additions & 22 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ resources:
- bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_nutanixclusters.yaml
Expand All @@ -25,34 +24,38 @@ patchesStrategicMerge:
#- patches/cainjection_in_nutanixclustertemplates.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

patchesJson6902:
# controller-gen doesn't allow for complex anyOf declarations in CRD generation code markers so we have to add these
# via a JSON patch instead.
#
# This enforces the Prism Central address to be either a hostname or an IP address without resorting to complex
# regular expressions.
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: nutanixclusters.infrastructure.cluster.x-k8s.io
patch: |-
- op: add
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/prismCentral/properties/address/anyOf
value:
- format: hostname
- format: ipv4
- format: ipv6
- op: add
path: /spec/versions/1/schema/openAPIV3Schema/properties/spec/properties/prismCentral/properties/address/anyOf
value:
- format: hostname
- format: ipv4
- format: ipv6

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml

commonLabels:
cluster.x-k8s.io/v1beta1: v1beta1
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
labels:
- includeSelectors: true
pairs:
cluster.x-k8s.io/v1beta1: v1beta1
patches:
- patch: |-
- op: add
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/prismCentral/properties/address/anyOf
value:
- format: hostname
- format: ipv4
- format: ipv6
- op: add
path: /spec/versions/1/schema/openAPIV3Schema/properties/spec/properties/prismCentral/properties/address/anyOf
value:
- format: hostname
- format: ipv4
- format: ipv6
target:
group: apiextensions.k8s.io
kind: CustomResourceDefinition
name: nutanixclusters.infrastructure.cluster.x-k8s.io
version: v1
48 changes: 12 additions & 36 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ namespace: capx-system
namePrefix: capx-

# Labels to add to all resources and selectors.
commonLabels:
cluster.x-k8s.io/provider: "infrastructure-nutanix"

bases:
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
Expand All @@ -24,11 +18,9 @@ bases:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
Expand All @@ -44,31 +36,15 @@ patchesStrategicMerge:
#- webhookcainjection_patch.yaml

# the following config is for teaching kustomize how to do var substitution
vars:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# fieldref:
# fieldpath: metadata.namespace
#- name: CERTIFICATE_NAME
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
#- name: SERVICE_NAMESPACE # namespace of the service
# objref:
# kind: Service
# version: v1
# name: webhook-service
# fieldref:
# fieldpath: metadata.namespace
#- name: SERVICE_NAME
# objref:
# kind: Service
# version: v1
# name: webhook-service
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../crd
- ../rbac
- ../manager
labels:
- includeSelectors: true
pairs:
cluster.x-k8s.io/provider: infrastructure-nutanix
patches:
- path: manager_auth_proxy_patch.yaml
2 changes: 2 additions & 0 deletions config/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
resources:
- monitor.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
10 changes: 6 additions & 4 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
resources:
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
28 changes: 14 additions & 14 deletions templates/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: "${NAMESPACE}"
namespace: ${NAMESPACE}

bases:
- ../ccm
- ./cm.yaml
- ./secret.yaml
- ./nutanix-cluster.yaml
- ./cluster-without-topology.yaml
- ./kcp.yaml
- ./kct.yaml
- ./nmt.yaml
- ./md.yaml
- ./mhc.yaml

patchesStrategicMerge:
- ./ccm-patch.yaml
resources:
- ../ccm
- ./cm.yaml
- ./secret.yaml
- ./nutanix-cluster.yaml
- ./cluster-without-topology.yaml
- ./kcp.yaml
- ./kct.yaml
- ./nmt.yaml
- ./md.yaml
- ./mhc.yaml
patches:
- path: ./ccm-patch.yaml
10 changes: 5 additions & 5 deletions templates/ccm/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

configMapGenerator:
- name: nutanix-ccm
behavior: merge
- behavior: merge
files:
- nutanix-ccm.yaml
name: nutanix-ccm

bases:
- ./nutanix-ccm-crs.yaml
- ./nutanix-ccm-secret.yaml
resources:
- ./nutanix-ccm-crs.yaml
- ./nutanix-ccm-secret.yaml
14 changes: 7 additions & 7 deletions templates/clusterclass/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ./nct.yaml
- ./clusterclass.yaml
- ./nmt-cp.yaml
- ./nmt-md.yaml
- ./kcpt.yaml
- ./kct.yaml
resources:
- ./nct.yaml
- ./clusterclass.yaml
- ./nmt-cp.yaml
- ./nmt-md.yaml
- ./kcpt.yaml
- ./kct.yaml
8 changes: 4 additions & 4 deletions templates/csi/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

configMapGenerator:
- name: nutanix-csi
behavior: merge
- behavior: merge
files:
- nutanix-csi-storage.yaml
- nutanix-csi-snapshot.yaml
- nutanix-csi-webhook.yaml
name: nutanix-csi

resources:
- ../base/
- nutanix-csi.yaml
- nutanix-csi-crs.yaml

patchesStrategicMerge:
- csi-patch.yaml
patches:
- path: csi-patch.yaml
20 changes: 10 additions & 10 deletions templates/topology/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

configMapGenerator:
- name: nutanix-ccm
behavior: merge
- behavior: merge
files:
- nutanix-ccm.yaml
name: nutanix-ccm

bases:
- ./cm.yaml
- ./cluster-with-topology.yaml
- ./secret.yaml
- ./nutanix-ccm-secret.yaml
- ./nutanix-ccm-crs.yaml

patchesStrategicMerge:
- ./ccm-patch.yaml
resources:
- ./cm.yaml
- ./cluster-with-topology.yaml
- ./secret.yaml
- ./nutanix-ccm-secret.yaml
- ./nutanix-ccm-crs.yaml
patches:
- path: ./ccm-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../base/cluster-with-kcp.yaml
- ../base/secret.yaml
- ../base/cm.yaml
- ../base/nmt.yaml
- ../base/md.yaml
- ../base/mhc.yaml
- ../base/crs.yaml

patchesStrategicMerge:
- ../base/cni-patch.yaml
resources:
- ../base/cluster-with-kcp.yaml
- ../base/secret.yaml
- ../base/cm.yaml
- ../base/nmt.yaml
- ../base/md.yaml
- ../base/mhc.yaml
- ../base/crs.yaml
patches:
- path: ../base/cni-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

configMapGenerator:
- name: nutanix-ccm
behavior: merge
- behavior: merge
files:
- ../base/nutanix-ccm.yaml

bases:
- ../base/cluster-with-kcp.yaml
- ../base/secret.yaml
- ../base/cm.yaml
- ../base/nmt.yaml
- ../base/crs.yaml
- ../base/md.yaml
- ../base/mhc.yaml
- ../base/nutanix-ccm-crs.yaml
- ../base/nutanix-ccm-secret.yaml

patchesStrategicMerge:
- ../base/ccm-patch.yaml
- ../base/cni-patch.yaml
name: nutanix-ccm
resources:
- ../base/cluster-with-kcp.yaml
- ../base/secret.yaml
- ../base/cm.yaml
- ../base/nmt.yaml
- ../base/crs.yaml
- ../base/md.yaml
- ../base/mhc.yaml
- ../base/nutanix-ccm-crs.yaml
- ../base/nutanix-ccm-secret.yaml
patches:
- path: ../base/ccm-patch.yaml
- path: ../base/cni-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
bases:
- ../bases/cluster-with-kcp.yaml
- ../bases/md.yaml
- ../bases/mhc.yaml
- ../bases/cm.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../bases/cluster-with-kcp.yaml
- ../bases/md.yaml
- ../bases/mhc.yaml
- ../bases/cm.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bases:
- ../../cluster-template/

patchesStrategicMerge:
- ../no-kubeproxy.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../cluster-template/
patches:
- path: ../no-kubeproxy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bases:
- ../cluster-template

patchesStrategicMerge:
- ./nmt.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../cluster-template
patches:
- path: ./nmt.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bases:
- ../../../../../../templates/clusterclass/
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../../templates/clusterclass/
Loading

0 comments on commit b7bd47d

Please sign in to comment.