Skip to content

Commit 9cd5387

Browse files
committed
WIP: Generate static deployment manifests
1 parent c34c453 commit 9cd5387

File tree

4 files changed

+346
-1
lines changed

4 files changed

+346
-1
lines changed

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ dev-delete: tools
4343
deploy: manifests tools
4444
$(SKAFFOLD) run -p production
4545

46+
# This is used to update the manifests into deploy/operator.yaml
47+
render-production-manifests:
48+
@ $(SKAFFOLD) build -q -p production
49+
@ $(KUSTOMIZE) build config/production > deploy/operator.yaml
50+
4651
# Generate manifests e.g. CRD, RBAC etc.
4752
manifests: controller-gen
4853
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

config/production/kustomization.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- ../default
6+
7+
images:
8+
- name: ghcr.io/annismckenzie/k3os-config-operator
9+
newTag: v0.1.0

deploy/operator.yaml

+332
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
labels:
5+
app: k3os-config-operator
6+
app.kubernetes.io/name: k3os-config-operator
7+
control-plane: controller-manager
8+
name: k3os-config-operator-system
9+
---
10+
apiVersion: apiextensions.k8s.io/v1
11+
kind: CustomResourceDefinition
12+
metadata:
13+
annotations:
14+
controller-gen.kubebuilder.io/version: v0.4.1
15+
creationTimestamp: null
16+
labels:
17+
app: k3os-config-operator
18+
app.kubernetes.io/name: k3os-config-operator
19+
name: k3osconfigs.config.operators.annismckenzie.github.com
20+
spec:
21+
group: config.operators.annismckenzie.github.com
22+
names:
23+
kind: K3OSConfig
24+
listKind: K3OSConfigList
25+
plural: k3osconfigs
26+
singular: k3osconfig
27+
scope: Namespaced
28+
versions:
29+
- name: v1alpha1
30+
schema:
31+
openAPIV3Schema:
32+
description: K3OSConfig is the Schema for the k3osconfigs API.
33+
properties:
34+
apiVersion:
35+
description: 'APIVersion defines the versioned schema of this representation
36+
of an object. Servers should convert recognized schemas to the latest
37+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
38+
type: string
39+
kind:
40+
description: 'Kind is a string value representing the REST resource this
41+
object represents. Servers may infer this from the endpoint the client
42+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
43+
type: string
44+
metadata:
45+
type: object
46+
spec:
47+
description: K3OSConfigSpec defines the desired state of K3OSConfig.
48+
properties:
49+
syncNodeLabels:
50+
description: SyncNodeLabels enables syncing node labels set in the
51+
K3OS config.yaml. K3OS by default only sets labels on nodes on first
52+
boot.
53+
type: boolean
54+
syncNodeTaints:
55+
description: SyncNodeTaints enables syncing node taints set in the
56+
K3OS config.yaml. K3OS by default only sets taints on nodes on first
57+
boot.
58+
type: boolean
59+
type: object
60+
status:
61+
description: K3OSConfigStatus defines the observed state of K3OSConfig.
62+
type: object
63+
type: object
64+
served: true
65+
storage: true
66+
subresources:
67+
status: {}
68+
status:
69+
acceptedNames:
70+
kind: ""
71+
plural: ""
72+
conditions: []
73+
storedVersions: []
74+
---
75+
apiVersion: rbac.authorization.k8s.io/v1
76+
kind: Role
77+
metadata:
78+
labels:
79+
app: k3os-config-operator
80+
app.kubernetes.io/name: k3os-config-operator
81+
name: k3os-config-operator-leader-election-role
82+
namespace: k3os-config-operator-system
83+
rules:
84+
- apiGroups:
85+
- ""
86+
resources:
87+
- events
88+
verbs:
89+
- create
90+
- patch
91+
- apiGroups:
92+
- coordination.k8s.io
93+
resources:
94+
- leases
95+
verbs:
96+
- '*'
97+
---
98+
apiVersion: rbac.authorization.k8s.io/v1
99+
kind: Role
100+
metadata:
101+
creationTimestamp: null
102+
labels:
103+
app: k3os-config-operator
104+
app.kubernetes.io/name: k3os-config-operator
105+
name: k3os-config-operator-manager-role
106+
namespace: k3os-config-operator-system
107+
rules:
108+
- apiGroups:
109+
- config.operators.annismckenzie.github.com
110+
resources:
111+
- k3osconfigs
112+
verbs:
113+
- create
114+
- delete
115+
- get
116+
- list
117+
- patch
118+
- update
119+
- watch
120+
- apiGroups:
121+
- config.operators.annismckenzie.github.com
122+
resources:
123+
- k3osconfigs/status
124+
verbs:
125+
- get
126+
- patch
127+
- update
128+
- apiGroups:
129+
- ""
130+
resources:
131+
- secrets
132+
verbs:
133+
- get
134+
- list
135+
- watch
136+
---
137+
apiVersion: rbac.authorization.k8s.io/v1
138+
kind: ClusterRole
139+
metadata:
140+
creationTimestamp: null
141+
labels:
142+
app: k3os-config-operator
143+
app.kubernetes.io/name: k3os-config-operator
144+
name: k3os-config-operator-manager-role
145+
rules:
146+
- apiGroups:
147+
- ""
148+
resources:
149+
- nodes
150+
verbs:
151+
- get
152+
- list
153+
- patch
154+
- update
155+
- watch
156+
---
157+
apiVersion: rbac.authorization.k8s.io/v1
158+
kind: ClusterRole
159+
metadata:
160+
labels:
161+
app: k3os-config-operator
162+
app.kubernetes.io/name: k3os-config-operator
163+
name: k3os-config-operator-metrics-reader
164+
rules:
165+
- nonResourceURLs:
166+
- /metrics
167+
verbs:
168+
- get
169+
---
170+
apiVersion: rbac.authorization.k8s.io/v1
171+
kind: ClusterRole
172+
metadata:
173+
labels:
174+
app: k3os-config-operator
175+
app.kubernetes.io/name: k3os-config-operator
176+
name: k3os-config-operator-proxy-role
177+
rules:
178+
- apiGroups:
179+
- authentication.k8s.io
180+
resources:
181+
- tokenreviews
182+
verbs:
183+
- create
184+
- apiGroups:
185+
- authorization.k8s.io
186+
resources:
187+
- subjectaccessreviews
188+
verbs:
189+
- create
190+
---
191+
apiVersion: rbac.authorization.k8s.io/v1
192+
kind: RoleBinding
193+
metadata:
194+
labels:
195+
app: k3os-config-operator
196+
app.kubernetes.io/name: k3os-config-operator
197+
name: k3os-config-operator-leader-election-rolebinding
198+
namespace: k3os-config-operator-system
199+
roleRef:
200+
apiGroup: rbac.authorization.k8s.io
201+
kind: Role
202+
name: k3os-config-operator-leader-election-role
203+
subjects:
204+
- kind: ServiceAccount
205+
name: default
206+
namespace: k3os-config-operator-system
207+
---
208+
apiVersion: rbac.authorization.k8s.io/v1
209+
kind: RoleBinding
210+
metadata:
211+
labels:
212+
app: k3os-config-operator
213+
app.kubernetes.io/name: k3os-config-operator
214+
name: k3os-config-operator-manager-rolebinding
215+
namespace: k3os-config-operator-system
216+
roleRef:
217+
apiGroup: rbac.authorization.k8s.io
218+
kind: Role
219+
name: k3os-config-operator-manager-role
220+
subjects:
221+
- kind: ServiceAccount
222+
name: default
223+
namespace: k3os-config-operator-system
224+
---
225+
apiVersion: rbac.authorization.k8s.io/v1
226+
kind: ClusterRoleBinding
227+
metadata:
228+
labels:
229+
app: k3os-config-operator
230+
app.kubernetes.io/name: k3os-config-operator
231+
name: k3os-config-operator-manager-rolebinding
232+
roleRef:
233+
apiGroup: rbac.authorization.k8s.io
234+
kind: ClusterRole
235+
name: k3os-config-operator-manager-role
236+
subjects:
237+
- kind: ServiceAccount
238+
name: default
239+
namespace: k3os-config-operator-system
240+
---
241+
apiVersion: rbac.authorization.k8s.io/v1
242+
kind: ClusterRoleBinding
243+
metadata:
244+
labels:
245+
app: k3os-config-operator
246+
app.kubernetes.io/name: k3os-config-operator
247+
name: k3os-config-operator-proxy-rolebinding
248+
roleRef:
249+
apiGroup: rbac.authorization.k8s.io
250+
kind: ClusterRole
251+
name: k3os-config-operator-proxy-role
252+
subjects:
253+
- kind: ServiceAccount
254+
name: default
255+
namespace: k3os-config-operator-system
256+
---
257+
apiVersion: v1
258+
kind: Service
259+
metadata:
260+
labels:
261+
app: k3os-config-operator
262+
app.kubernetes.io/name: k3os-config-operator
263+
control-plane: controller-manager
264+
name: k3os-config-operator-controller-manager-metrics-service
265+
namespace: k3os-config-operator-system
266+
spec:
267+
ports:
268+
- name: https
269+
port: 8443
270+
targetPort: https
271+
selector:
272+
app: k3os-config-operator
273+
app.kubernetes.io/name: k3os-config-operator
274+
control-plane: controller-manager
275+
---
276+
apiVersion: apps/v1
277+
kind: DaemonSet
278+
metadata:
279+
labels:
280+
app: k3os-config-operator
281+
app.kubernetes.io/name: k3os-config-operator
282+
control-plane: controller-manager
283+
name: k3os-config-operator-controller-manager
284+
namespace: k3os-config-operator-system
285+
spec:
286+
selector:
287+
matchLabels:
288+
app: k3os-config-operator
289+
app.kubernetes.io/name: k3os-config-operator
290+
control-plane: controller-manager
291+
template:
292+
metadata:
293+
labels:
294+
app: k3os-config-operator
295+
app.kubernetes.io/name: k3os-config-operator
296+
control-plane: controller-manager
297+
spec:
298+
containers:
299+
- args:
300+
- --secure-listen-address=0.0.0.0:8443
301+
- --upstream=http://127.0.0.1:8080/
302+
- --logtostderr=true
303+
- --v=10
304+
image: quay.io/brancz/kube-rbac-proxy:v0.8.0
305+
name: kube-rbac-proxy
306+
ports:
307+
- containerPort: 8443
308+
name: https
309+
- args:
310+
- --metrics-addr=127.0.0.1:8080
311+
- --enable-leader-election
312+
command:
313+
- /manager
314+
env:
315+
- name: NODE_NAME
316+
valueFrom:
317+
fieldRef:
318+
fieldPath: spec.nodeName
319+
- name: NAMESPACE
320+
valueFrom:
321+
fieldRef:
322+
fieldPath: metadata.namespace
323+
image: ghcr.io/annismckenzie/k3os-config-operator:v0.1.0
324+
name: manager
325+
resources:
326+
limits:
327+
cpu: 100m
328+
memory: 30Mi
329+
requests:
330+
cpu: 100m
331+
memory: 20Mi
332+
terminationGracePeriodSeconds: 10

skaffold.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ build:
1212
deploy:
1313
kustomize:
1414
paths:
15-
- config/crd
1615
- config/default
1716
profiles:
1817
- name: production

0 commit comments

Comments
 (0)