Skip to content

Commit e9fe2a6

Browse files
Clean up kustomizations
- Always include apiVersion+kind of kustomization files - `patchesStrategicMerge` was deprecated, use `patches` instead - `bases` was deprecated, use `resources` instead - Order `configurations` first
1 parent ba4152c commit e9fe2a6

File tree

8 files changed

+52
-43
lines changed

8 files changed

+52
-43
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
resources:
2-
- certificate.yaml
3-
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
43
configurations:
54
- kustomizeconfig.yaml
5+
resources:
6+
- certificate.yaml

config/controller/kustomization.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
resources:
2-
- controller.yaml
3-
patchesStrategicMerge:
4-
- iam_for_sa_patch.yaml
5-
- security_context_patch.yaml
6-
71
apiVersion: kustomize.config.k8s.io/v1beta1
82
kind: Kustomization
3+
resources:
4+
- controller.yaml
5+
patches:
6+
- path: iam_for_sa_patch.yaml
7+
- path: security_context_patch.yaml
98
images:
109
- name: controller
1110
newName: public.ecr.aws/eks/aws-load-balancer-controller

config/crd/kustomization.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
# the following config is for teaching kustomize how to do kustomization for CRDs.
5+
configurations:
6+
- kustomizeconfig.yaml
7+
18
# This kustomization.yaml is not intended to be run by itself,
29
# since it depends on service name and namespace that are out of this kustomize package.
310
# It should be run by config/default
@@ -6,19 +13,16 @@ resources:
613
- bases/elbv2.k8s.aws_ingressclassparams.yaml
714
# +kubebuilder:scaffold:crdkustomizeresource
815

9-
patchesStrategicMerge:
16+
patches:
1017
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1118
# patches here are for enabling the conversion webhook for each CRD
12-
#- patches/webhook_in_targetgroupbindings.yaml
13-
#- patches/webhook_in_ingressclassparams.yaml
19+
#- path: patches/webhook_in_targetgroupbindings.yaml
20+
#- path: patches/webhook_in_ingressclassparams.yaml
1421
# +kubebuilder:scaffold:crdkustomizewebhookpatch
1522

1623
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
1724
# patches here are for enabling the CA injection for each CRD
18-
#- patches/cainjection_in_targetgroupbindings.yaml
19-
#- patches/cainjection_in_ingressclassparams.yaml
25+
#- path: patches/cainjection_in_targetgroupbindings.yaml
26+
#- path: patches/cainjection_in_ingressclassparams.yaml
2027
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
2128

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

config/default/kustomization.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
# Adds namespace to all resources.
25
namespace: kube-system
36

@@ -12,7 +15,7 @@ namePrefix: aws-load-balancer-
1215
commonLabels:
1316
app.kubernetes.io/name: aws-load-balancer-controller
1417

15-
bases:
18+
resources:
1619
- ../crd
1720
- ../rbac
1821
- ../controller
@@ -24,15 +27,25 @@ bases:
2427
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2528
#- ../prometheus
2629

27-
patchesStrategicMerge:
30+
patches:
2831
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2932
# crd/kustomization.yaml
30-
- controller_webhook_patch.yaml
33+
- path: controller_webhook_patch.yaml
3134

3235
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
3336
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
3437
# 'CERTMANAGER' needs to be enabled to use ca injection
35-
- webhookcainjection_patch.yaml
38+
# This patch add annotation to admission webhook config and
39+
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
40+
- target:
41+
kind: (MutatingWebhookConfiguration|ValidatingWebhookConfiguration)
42+
patch: |-
43+
apiVersion: admissionregistration.k8s.io/v1
44+
kind: dummy
45+
metadata:
46+
name: webhook
47+
annotations:
48+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
3649
3750
# the following config is for teaching kustomize how to do var substitution
3851
vars:

config/default/webhookcainjection_patch.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
13
resources:
24
- monitor.yaml

config/rbac/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
13
resources:
24
- role.yaml
35
- role_binding.yaml

config/webhook/kustomization.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
resources:
2-
- manifests.yaml
3-
- service.yaml
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
43

54
configurations:
65
- kustomizeconfig.yaml
76

8-
patchesStrategicMerge:
9-
- pod_mutator_patch.yaml
10-
- service_mutator_patch.yaml
11-
- ingressclassparams_validator_patch.yaml
7+
resources:
8+
- manifests.yaml
9+
- service.yaml
10+
11+
patches:
12+
- path: pod_mutator_patch.yaml
13+
- path: service_mutator_patch.yaml
14+
- path: ingressclassparams_validator_patch.yaml

0 commit comments

Comments
 (0)