Skip to content

Commit 2bd0b1e

Browse files
committed
Add osbuilder chart
1 parent a61cf98 commit 2bd0b1e

File tree

9 files changed

+402
-1
lines changed

9 files changed

+402
-1
lines changed

Diff for: charts/c3os-crds/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ home: https://docs.c3os.io/
77
maintainers:
88
- name: Ettore Di Giacinto
99
10-
version: 0.0.1
10+
version: 0.0.2

Diff for: charts/osbuilder/Chart.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: osbuilder
3+
description: A Helm chart for osbuilder
4+
icon:
5+
type: application
6+
home: https://docs.c3os.io/
7+
maintainers:
8+
- name: Ettore Di Giacinto
9+
10+
version: 0.0.1

Diff for: charts/osbuilder/templates/_helpers.tpl

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "helm-chart.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "helm-chart.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "helm-chart.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "helm-chart.labels" -}}
37+
helm.sh/chart: {{ include "helm-chart.chart" . }}
38+
{{ include "helm-chart.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "helm-chart.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "helm-chart.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "helm-chart.serviceAccountName" -}}
57+
{{- include "helm-chart.fullname" . }}
58+
{{- end }}

Diff for: charts/osbuilder/templates/configmap.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
data:
3+
controller_manager_config.yaml: "apiVersion: controller-runtime.sigs.k8s.io/v1alpha1\nkind:
4+
ControllerManagerConfig\nhealth:\n healthProbeBindAddress: :8081\nmetrics:\n
5+
\ bindAddress: 127.0.0.1:8080\nwebhook:\n port: 9443\nleaderElection:\n leaderElect:
6+
true\n resourceName: 98ca89ca.c3os-x.io\n# leaderElectionReleaseOnCancel
7+
defines if the leader should step down volume \n# when the Manager ends.
8+
This requires the binary to immediately end when the\n# Manager is stopped,
9+
otherwise, this setting is unsafe. Setting this significantly\n# speeds
10+
up voluntary leader transitions as the new leader don't have to wait\n# LeaseDuration
11+
time first.\n# In the default scaffold provided, the program ends immediately
12+
after \n# the manager stops, so would be fine to enable this option. However,
13+
\n# if you are doing or is intended to do any operation such as perform
14+
cleanups \n# after the manager stops then its usage might be unsafe.\n#
15+
\ leaderElectionReleaseOnCancel: true\n"
16+
kind: ConfigMap
17+
metadata:
18+
name: osartifactbuilder-operator-manager-config
19+
namespace: '{{.Release.Namespace}}'

Diff for: charts/osbuilder/templates/deployment.yaml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: '{{ include "helm-chart.fullname" . }}'
5+
namespace: '{{.Release.Namespace}}'
6+
labels:
7+
{{- include "helm-chart.labels" . | nindent 8 }}
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
{{- include "helm-chart.selectorLabels" . | nindent 10 }}
13+
template:
14+
metadata:
15+
annotations:
16+
{{- range keys .Values.podAnnotations }}
17+
{{ . | quote }}: {{ get $.Values.podAnnotations . | quote}}
18+
{{- end }}
19+
labels:
20+
{{- include "helm-chart.selectorLabels" . | nindent 14}}
21+
spec:
22+
{{- with .Values.imagePullSecrets }}
23+
imagePullSecrets:
24+
{{- toYaml . | nindent 6 }}
25+
{{- end }}
26+
containers:
27+
- args:
28+
- --secure-listen-address=0.0.0.0:8443
29+
- --upstream=http://127.0.0.1:8080/
30+
- --logtostderr=true
31+
- --v=0
32+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.11.0
33+
name: kube-rbac-proxy
34+
ports:
35+
- containerPort: 8443
36+
name: https
37+
protocol: TCP
38+
resources:
39+
limits:
40+
cpu: 500m
41+
memory: 128Mi
42+
requests:
43+
cpu: 5m
44+
memory: 64Mi
45+
securityContext:
46+
allowPrivilegeEscalation: false
47+
- args:
48+
- --health-probe-bind-address=:8081
49+
- --metrics-bind-address=127.0.0.1:8080
50+
- --leader-elect
51+
command:
52+
- /manager
53+
image: '{{ .Values.image.repository | default "quay.io/c3os/osbuilder" }}:{{ .Values.image.tag | default .Chart.AppVersion
54+
}}'
55+
livenessProbe:
56+
httpGet:
57+
path: /healthz
58+
port: 8081
59+
initialDelaySeconds: 15
60+
periodSeconds: 20
61+
name: manager
62+
readinessProbe:
63+
httpGet:
64+
path: /readyz
65+
port: 8081
66+
initialDelaySeconds: 5
67+
periodSeconds: 10
68+
{{- if and .Values.resources .Values.resources.controller }}
69+
resources:
70+
{{ toYaml .Values.resources.controller | indent 20 }}
71+
{{- end }}
72+
securityContext:
73+
allowPrivilegeEscalation: false
74+
securityContext:
75+
runAsNonRoot: true
76+
serviceAccountName: '{{ include "helm-chart.serviceAccountName" . }}'
77+
terminationGracePeriodSeconds: 10
78+
{{- with .Values.nodeSelector }}
79+
nodeSelector:
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
82+
{{- with .Values.affinity }}
83+
affinity:
84+
{{- toYaml . | nindent 8 }}
85+
{{- end }}
86+
{{- with .Values.tolerations }}
87+
tolerations:
88+
{{- toYaml . | nindent 8 }}
89+
{{- end }}

Diff for: charts/osbuilder/templates/rbac.yaml

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: osartifactbuilder-operator-leader-election-role
5+
namespace: '{{.Release.Namespace}}'
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- configmaps
11+
verbs:
12+
- get
13+
- list
14+
- watch
15+
- create
16+
- update
17+
- patch
18+
- delete
19+
- apiGroups:
20+
- coordination.k8s.io
21+
resources:
22+
- leases
23+
verbs:
24+
- get
25+
- list
26+
- watch
27+
- create
28+
- update
29+
- patch
30+
- delete
31+
- apiGroups:
32+
- ""
33+
resources:
34+
- events
35+
verbs:
36+
- create
37+
- patch
38+
---
39+
apiVersion: rbac.authorization.k8s.io/v1
40+
kind: ClusterRole
41+
metadata:
42+
name: osartifactbuilder-operator-manager-role
43+
rules:
44+
- apiGroups:
45+
- build.c3os-x.io
46+
resources:
47+
- osartifacts
48+
verbs:
49+
- create
50+
- delete
51+
- get
52+
- list
53+
- patch
54+
- update
55+
- watch
56+
- apiGroups:
57+
- build.c3os-x.io
58+
resources:
59+
- osartifacts/finalizers
60+
verbs:
61+
- update
62+
- apiGroups:
63+
- build.c3os-x.io
64+
resources:
65+
- osartifacts/status
66+
verbs:
67+
- get
68+
- patch
69+
- update
70+
- apiGroups:
71+
- build.c3os-x.io
72+
resources:
73+
- osartifacts/finalizers
74+
verbs:
75+
- update
76+
- apiGroups:
77+
- ""
78+
resources:
79+
- services
80+
- configmaps
81+
verbs:
82+
- get
83+
- create
84+
- update
85+
- apiGroups:
86+
- apps
87+
resources:
88+
- deployments
89+
verbs:
90+
- get
91+
- create
92+
- update
93+
---
94+
apiVersion: rbac.authorization.k8s.io/v1
95+
kind: ClusterRole
96+
metadata:
97+
name: osartifactbuilder-operator-metrics-reader
98+
rules:
99+
- nonResourceURLs:
100+
- /metrics
101+
verbs:
102+
- get
103+
---
104+
apiVersion: rbac.authorization.k8s.io/v1
105+
kind: ClusterRole
106+
metadata:
107+
name: osartifactbuilder-operator-proxy-role
108+
rules:
109+
- apiGroups:
110+
- authentication.k8s.io
111+
resources:
112+
- tokenreviews
113+
verbs:
114+
- create
115+
- apiGroups:
116+
- authorization.k8s.io
117+
resources:
118+
- subjectaccessreviews
119+
verbs:
120+
- create
121+
---
122+
apiVersion: rbac.authorization.k8s.io/v1
123+
kind: RoleBinding
124+
metadata:
125+
name: osartifactbuilder-operator-leader-election-rolebinding
126+
namespace: '{{.Release.Namespace}}'
127+
roleRef:
128+
apiGroup: rbac.authorization.k8s.io
129+
kind: Role
130+
name: osartifactbuilder-operator-leader-election-role
131+
subjects:
132+
- kind: ServiceAccount
133+
name: '{{ include "helm-chart.serviceAccountName" . }}'
134+
namespace: '{{.Release.Namespace}}'
135+
---
136+
apiVersion: rbac.authorization.k8s.io/v1
137+
kind: ClusterRoleBinding
138+
metadata:
139+
name: osartifactbuilder-operator-manager-rolebinding
140+
roleRef:
141+
apiGroup: rbac.authorization.k8s.io
142+
kind: ClusterRole
143+
name: osartifactbuilder-operator-manager-role
144+
subjects:
145+
- kind: ServiceAccount
146+
name: '{{ include "helm-chart.serviceAccountName" . }}'
147+
namespace: '{{.Release.Namespace}}'
148+
---
149+
apiVersion: rbac.authorization.k8s.io/v1
150+
kind: ClusterRoleBinding
151+
metadata:
152+
name: osartifactbuilder-operator-proxy-rolebinding
153+
roleRef:
154+
apiGroup: rbac.authorization.k8s.io
155+
kind: ClusterRole
156+
name: osartifactbuilder-operator-proxy-role
157+
subjects:
158+
- kind: ServiceAccount
159+
name: '{{ include "helm-chart.serviceAccountName" . }}'
160+
namespace: '{{.Release.Namespace}}'

Diff for: charts/osbuilder/templates/service.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
control-plane: controller-manager
6+
name: '{{ include "helm-chart.fullname" . }}-metrics-service'
7+
namespace: '{{.Release.Namespace}}'
8+
spec:
9+
ports:
10+
- name: https
11+
port: 8443
12+
protocol: TCP
13+
targetPort: https
14+
selector:
15+
{{- include "helm-chart.selectorLabels" . | nindent 6 }}

Diff for: charts/osbuilder/templates/serviceaccount.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: '{{ include "helm-chart.serviceAccountName" . }}'
5+
namespace: '{{.Release.Namespace}}'

0 commit comments

Comments
 (0)