Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit fcebcbe

Browse files
committed
Add kustomization for resource list extension
Add kustomization resources for the new Deployment, Service, APIService and cert-manager configuration for the resource list extension.
1 parent 31aefac commit fcebcbe

File tree

13 files changed

+156
-0
lines changed

13 files changed

+156
-0
lines changed

config/apiextension/apiextension.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
labels:
6+
app: resourcelist-apiextension
7+
name: resourcelist-apiextension
8+
namespace: system
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
app: resourcelist-apiextension
14+
template:
15+
metadata:
16+
labels:
17+
app: resourcelist-apiextension
18+
spec:
19+
securityContext:
20+
fsGroup: 2000
21+
runAsNonRoot: true
22+
runAsUser: 1000
23+
containers:
24+
- image: controller:latest # this is usually overridden by kustomize
25+
name: resourcelist
26+
command:
27+
- /apiextension
28+
args:
29+
- "--cert=/certs/tls.crt"
30+
- "--key=/certs/tls.key"
31+
imagePullPolicy: IfNotPresent
32+
volumeMounts:
33+
- name: certs
34+
mountPath: /certs
35+
securityContext:
36+
allowPrivilegeEscalation: false
37+
readOnlyRootFilesystem: true
38+
runAsNonRoot: true
39+
seccompProfile:
40+
type: RuntimeDefault
41+
capabilities:
42+
drop: ["ALL"]
43+
ports:
44+
- containerPort: 7443
45+
name: server
46+
protocol: TCP
47+
volumes:
48+
- secret:
49+
defaultMode: 420
50+
secretName: hnc-resourcelist-apiextension
51+
name: certs

config/apiextension/apiservice.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: apiregistration.k8s.io/v1
3+
kind: APIService
4+
metadata:
5+
name: v1alpha2.resources.hnc.x-k8s.io
6+
spec:
7+
group: resources.hnc.x-k8s.io
8+
version: v1alpha2
9+
groupPriorityMinimum: 10
10+
versionPriority: 10
11+
service:
12+
namespace: hnc-system
13+
name: resourcelist
14+
port: 7443
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
- apiextension.yaml
3+
- service.yaml
4+
- apiservice.yaml

config/apiextension/service.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
app: resourcelist
7+
name: resourcelist
8+
spec:
9+
ports:
10+
- port: 7443
11+
protocol: TCP
12+
targetPort: 7443
13+
selector:
14+
app: resourcelist

config/certmanager/certificate.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,16 @@ spec:
2323
kind: Issuer
2424
name: selfsigned-issuer
2525
secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize
26+
---
27+
apiVersion: cert-manager.io/v1
28+
kind: Certificate
29+
metadata:
30+
name: resourcelist
31+
spec:
32+
dnsNames:
33+
- $(APIEXT_SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
34+
- $(APIEXT_SERVICE_NAME).$(SERVICE_NAMESPACE).svc
35+
issuerRef:
36+
kind: Issuer
37+
name: selfsigned-issuer
38+
secretName: hnc-resourcelist

config/internalcert/manifests.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
---
12
apiVersion: v1
23
kind: Secret
34
metadata:
45
name: webhook-server-cert
56
namespace: system
7+
---
8+
apiVersion: v1
9+
kind: Secret
10+
metadata:
11+
name: resourcelist
12+
namespace: system

config/rbac/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ resources:
66
- aggregate_to_admin.yaml
77
- leader_election_role.yaml
88
- leader_election_role_binding.yaml
9+
- resourcelist_role.yaml
10+
- resourcelist_rolebinding.yaml

config/rbac/resourcelist_role.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Allow the resourcelist-apiextension deployment to read resources in order to re-register them as HNC resources.
2+
---
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
kind: ClusterRole
5+
metadata:
6+
name: resourcelist
7+
rules:
8+
- apiGroups:
9+
- "*"
10+
resources:
11+
- "*"
12+
verbs:
13+
- get
14+
- list
15+
- watch
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Allow the resourcelist-apiextension deployment to read resources in order to re-register them as HNC resources.
2+
---
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
kind: ClusterRoleBinding
5+
metadata:
6+
name: resourcelist
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: resourcelist
11+
subjects:
12+
- kind: ServiceAccount
13+
name: default
14+
namespace: hnc-system

config/variants/default-cc/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bases:
1414
- ../../manager
1515
- ../../rbac
1616
- ../../webhook
17+
- ../../apiextension
1718

1819
patches:
1920
- patch: |-
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: apiregistration.k8s.io/v1
3+
kind: APIService
4+
metadata:
5+
name: v1alpha2.resources.hnc.x-k8s.io
6+
annotations:
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(APIEXT_CERTIFICATE_NAME)

config/variants/default-cm/kustomization.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ bases:
1414
- ../../manager
1515
- ../../rbac
1616
- ../../webhook
17+
- ../../apiextension
1718

1819
patchesStrategicMerge:
1920
- webhookcainjection_patch.yaml
21+
- apiservicecainjection_patch.yaml
2022

2123
vars:
2224
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
@@ -45,3 +47,14 @@ vars:
4547
kind: Service
4648
version: v1
4749
name: webhook-service
50+
- name: APIEXT_SERVICE_NAME
51+
objref:
52+
kind: Service
53+
version: v1
54+
name: resourcelist
55+
- name: APIEXT_CERTIFICATE_NAME
56+
objref:
57+
kind: Certificate
58+
group: cert-manager.io
59+
version: v1
60+
name: resourcelist

config/variants/hrq/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bases:
1414
- ../../manager
1515
- ../../rbac
1616
- ../../webhook
17+
- ../../apiextension
1718

1819
patchesStrategicMerge:
1920
- webhook_patch.yaml

0 commit comments

Comments
 (0)