|
1 |
| -bases: |
| 1 | +resources: |
2 | 2 | - ../crd
|
3 | 3 | - ../rbac
|
4 | 4 | - ../manager
|
5 | 5 | - ../webhook
|
6 | 6 | - ../certmanager
|
7 | 7 |
|
8 |
| -patchesStrategicMerge: |
9 | 8 | # Enable webhook
|
10 |
| -- manager_webhook_patch.yaml |
11 | 9 | # Enable certmanager integration
|
12 |
| -- webhookcainjection_patch.yaml |
13 | 10 |
|
14 |
| -vars: |
15 |
| -- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR |
16 |
| - objref: |
17 |
| - kind: Certificate |
18 |
| - group: cert-manager.io |
19 |
| - version: v1 |
20 |
| - name: serving-cert # this name should match the one in certificate.yaml |
21 |
| - fieldref: |
22 |
| - fieldpath: metadata.namespace |
23 |
| -- name: CERTIFICATE_NAME |
24 |
| - objref: |
25 |
| - kind: Certificate |
26 |
| - group: cert-manager.io |
27 |
| - version: v1 |
28 |
| - name: serving-cert # this name should match the one in certificate.yaml |
29 |
| -- name: SERVICE_NAMESPACE # namespace of the service |
30 |
| - objref: |
31 |
| - kind: Service |
32 |
| - version: v1 |
33 |
| - name: webhook-service |
34 |
| - fieldref: |
35 |
| - fieldpath: metadata.namespace |
36 |
| -- name: SERVICE_NAME |
37 |
| - objref: |
38 |
| - kind: Service |
39 |
| - version: v1 |
40 |
| - name: webhook-service |
| 11 | +apiVersion: kustomize.config.k8s.io/v1beta1 |
| 12 | +kind: Kustomization |
| 13 | +patches: |
| 14 | +- path: manager_webhook_patch.yaml |
| 15 | +- path: webhookcainjection_patch.yaml |
| 16 | +replacements: |
| 17 | + - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs |
| 18 | + kind: Certificate |
| 19 | + group: cert-manager.io |
| 20 | + version: v1 |
| 21 | + name: serving-cert # this name should match the one in certificate.yaml |
| 22 | + fieldPath: .metadata.namespace # namespace of the certificate CR |
| 23 | + targets: |
| 24 | + - select: |
| 25 | + kind: ValidatingWebhookConfiguration |
| 26 | + fieldPaths: |
| 27 | + - .metadata.annotations.[cert-manager.io/inject-ca-from] |
| 28 | + options: |
| 29 | + delimiter: '/' |
| 30 | + index: 0 |
| 31 | + create: true |
| 32 | + - select: |
| 33 | + kind: MutatingWebhookConfiguration |
| 34 | + fieldPaths: |
| 35 | + - .metadata.annotations.[cert-manager.io/inject-ca-from] |
| 36 | + options: |
| 37 | + delimiter: '/' |
| 38 | + index: 0 |
| 39 | + create: true |
| 40 | + - source: |
| 41 | + kind: Certificate |
| 42 | + group: cert-manager.io |
| 43 | + version: v1 |
| 44 | + name: serving-cert # this name should match the one in certificate.yaml |
| 45 | + fieldPath: .metadata.name |
| 46 | + targets: |
| 47 | + - select: |
| 48 | + kind: ValidatingWebhookConfiguration |
| 49 | + fieldPaths: |
| 50 | + - .metadata.annotations.[cert-manager.io/inject-ca-from] |
| 51 | + options: |
| 52 | + delimiter: '/' |
| 53 | + index: 1 |
| 54 | + create: true |
| 55 | + - select: |
| 56 | + kind: MutatingWebhookConfiguration |
| 57 | + fieldPaths: |
| 58 | + - .metadata.annotations.[cert-manager.io/inject-ca-from] |
| 59 | + options: |
| 60 | + delimiter: '/' |
| 61 | + index: 1 |
| 62 | + create: true |
| 63 | + - source: # Add cert-manager annotation to the webhook Service |
| 64 | + kind: Service |
| 65 | + version: v1 |
| 66 | + name: webhook-service |
| 67 | + fieldPath: .metadata.name # namespace of the service |
| 68 | + targets: |
| 69 | + - select: |
| 70 | + kind: Certificate |
| 71 | + group: cert-manager.io |
| 72 | + version: v1 |
| 73 | + fieldPaths: |
| 74 | + - .spec.dnsNames.0 |
| 75 | + - .spec.dnsNames.1 |
| 76 | + options: |
| 77 | + delimiter: '.' |
| 78 | + index: 0 |
| 79 | + create: true |
| 80 | + - source: |
| 81 | + kind: Service |
| 82 | + version: v1 |
| 83 | + name: webhook-service |
| 84 | + fieldPath: .metadata.namespace # namespace of the service |
| 85 | + targets: |
| 86 | + - select: |
| 87 | + kind: Certificate |
| 88 | + group: cert-manager.io |
| 89 | + version: v1 |
| 90 | + fieldPaths: |
| 91 | + - .spec.dnsNames.0 |
| 92 | + - .spec.dnsNames.1 |
| 93 | + options: |
| 94 | + delimiter: '.' |
| 95 | + index: 1 |
| 96 | + create: true |
0 commit comments