Skip to content

Commit a1911f9

Browse files
ybettanErusso7
and
Erusso7
authored
Adding cert-manager to config/default. (#355)
It is required for adding validation webhooks for example. This commit also contains side-effects required for this change: 1. `cert-manager` is installing some resources to the `cert-manager` namespace and some to the `kube-system` namespace, therefore we cannot use a single namespace override for all resources, so the global definition of `namespace:` in the `kustomization.yaml` was removed. 2. Added the `NamespaceTransformer` as a replacement for the global `namespace:` since it allows using the `unsetOnly` field which will now use the new "global namespace" only for resources that didn't explicitly specified their namespace. 3. Removed the `system` namespaces for all resources that expect to get the default namespace. 4. Added the `kind: Kustomization` type to all resources, it allows for k8s to run some type validation. I guess the reason it was not present until now is because it didn't exist in previous versions of `kustomize` and `operator-sdk` is using an old version. Signed-off-by: Yoni Bettan <[email protected]> Co-authored-by: Erusso7 <[email protected]>
1 parent b527a57 commit a1911f9

24 files changed

+5580
-19
lines changed

ci/install-ci/kustomization.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ patchesStrategicMerge:
1515
kind: Deployment
1616
metadata:
1717
name: controller-manager
18-
namespace: system
1918
spec:
2019
template:
2120
spec:

config/certmanager/certmanager.yaml

+5,535
Large diffs are not rendered by default.

config/certmanager/kustomization.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- certmanager.yaml

config/crd-hub/patches/webhook_in_managedclustermodules.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ spec:
99
webhook:
1010
clientConfig:
1111
service:
12-
namespace: system
1312
name: webhook-service
1413
path: /convert
1514
conversionReviewVersions:

config/crd/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
# This kustomization.yaml is not intended to be run by itself,
25
# since it depends on service name and namespace that are out of this kustomize package.
36
# It should be run by config/default

config/crd/patches/webhook_in_managedclustermodules.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ spec:
99
webhook:
1010
clientConfig:
1111
service:
12-
namespace: system
1312
name: webhook-service
1413
path: /convert
1514
conversionReviewVersions:

config/crd/patches/webhook_in_modules.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ spec:
99
webhook:
1010
clientConfig:
1111
service:
12-
namespace: system
1312
name: webhook-service
1413
path: /convert
1514
conversionReviewVersions:

config/default-hub/kustomization.yaml

+3
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: kmm-operator-system
36

config/default/kustomization.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Adds namespace to all resources.
2-
namespace: kmm-operator-system
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
33

44
# Value of this field is prepended to the
55
# names of all resources, e.g. a deployment named
@@ -20,7 +20,7 @@ bases:
2020
# crd/kustomization.yaml
2121
#- ../webhook
2222
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
23-
#- ../certmanager
23+
- ../certmanager
2424
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2525
#- ../prometheus
2626

@@ -62,3 +62,15 @@ vars:
6262
# kind: Service
6363
# version: v1
6464
# name: webhook-service
65+
66+
transformers:
67+
- |-
68+
apiVersion: builtin
69+
kind: NamespaceTransformer
70+
metadata:
71+
name: notImportantHere
72+
namespace: kmm-operator-system
73+
unsetOnly: true
74+
fieldSpecs:
75+
- path: metadata/namespace
76+
create: true

config/manager-base/manager.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ kind: Namespace
33
metadata:
44
labels:
55
control-plane: controller-manager
6-
name: system
6+
name: kmm-operator-system
77
---
88
apiVersion: apps/v1
99
kind: Deployment
1010
metadata:
1111
name: controller-manager
12-
namespace: system
1312
labels:
1413
control-plane: controller-manager
1514
spec:

config/manager-base/manager_auth_proxy_patch.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ apiVersion: apps/v1
44
kind: Deployment
55
metadata:
66
name: controller-manager
7-
namespace: system
87
spec:
98
template:
109
spec:

config/manager-base/manager_config_patch.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: controller-manager
5-
namespace: system
65
spec:
76
template:
87
spec:

config/manifests-hub/kustomization.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
# These resources constitute the fully configured set of manifests
25
# used to generate the 'manifests/' directory in a bundle.
36
resources:
@@ -15,7 +18,6 @@ resources:
1518
# version: v1
1619
# kind: Deployment
1720
# name: controller-manager
18-
# namespace: system
1921
# patch: |-
2022
# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
2123
# # Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.

config/manifests/kustomization.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
# These resources constitute the fully configured set of manifests
25
# used to generate the 'manifests/' directory in a bundle.
36
resources:
@@ -15,7 +18,6 @@ resources:
1518
# version: v1
1619
# kind: Deployment
1720
# name: controller-manager
18-
# namespace: system
1921
# patch: |-
2022
# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
2123
# # Update the indices in this path if adding or removing containers/volumeMounts in the manager's Deployment.

config/prometheus/monitor.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
labels:
77
control-plane: controller-manager
88
name: controller-manager-metrics-monitor
9-
namespace: system
109
spec:
1110
endpoints:
1211
- path: /metrics

config/rbac-base/auth_proxy_role_binding.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ roleRef:
99
subjects:
1010
- kind: ServiceAccount
1111
name: controller-manager
12-
namespace: system

config/rbac-base/auth_proxy_service.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
labels:
55
control-plane: controller-manager
66
name: controller-manager-metrics-service
7-
namespace: system
87
spec:
98
ports:
109
- name: https

config/rbac-base/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
resources:
25
# All RBAC will be applied under this service account in
36
# the deployment namespace. You may comment out this resource

config/rbac-base/leader_election_role_binding.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ roleRef:
99
subjects:
1010
- kind: ServiceAccount
1111
name: controller-manager
12-
namespace: system

config/rbac-base/role_binding.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ roleRef:
99
subjects:
1010
- kind: ServiceAccount
1111
name: controller-manager
12-
namespace: system

config/rbac-base/service_account.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ apiVersion: v1
22
kind: ServiceAccount
33
metadata:
44
name: controller-manager
5-
namespace: system

config/rbac-hub/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
resources:
25
- ../rbac-base
36
- role.yaml

config/rbac/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
resources:
25
- ../rbac-base
36
- role.yaml

config/scorecard/kustomization.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
14
resources:
25
- bases/config.yaml
36
patchesJson6902:

0 commit comments

Comments
 (0)