Skip to content

Commit 56c1dc4

Browse files
committed
update osbuilder chart to use custom docker registry
1 parent b7de684 commit 56c1dc4

17 files changed

+416
-270
lines changed

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,18 @@ kubesplit: manifests kustomize
287287
rm -rf helm-chart
288288
mkdir helm-chart
289289
$(KUSTOMIZE) build config/default | kubesplit -helm helm-chart
290+
291+
helm:
292+
helm upgrade \
293+
--install \
294+
--create-namespace \
295+
--namespace test-registry \
296+
--set registry.storage.s3.accessKey=${AWS_ACCESSKEY} \
297+
--set registry.storage.s3.secretKey=${AWS_SECRETKEY} \
298+
--set registry.storage.s3.region=${AWS_BUCKET_REGION} \
299+
--set registry.storage.s3.bucket=${AWS_BUCKET_NAME} \
300+
--set registry.storage.s3.endpoint=${AWS_BUCKET_ENDPOINT} \
301+
--set registry.auth.htpasswd.secret.name=registry-default-user-password \
302+
--set registry.ingress.dns=osbuilder.plrl-dev-aws.onplural.sh \
303+
--set builder.replicas=0 \
304+
osbuilder ./charts/osbuilder

charts/osartifact/Chart.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
apiVersion: v2
22
name: osartifact
33
description: A Helm chart for OSArtifact CRD deployment
4+
maintainers:
5+
- name: Plural
6+
47
type: application
58
version: 0.3.0

charts/osbuilder/Chart.lock

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
dependencies: []
2-
digest: sha256:643d5437104296e21d906ecb15b2c96ad278f20cfc4af53b12bb6069bd853726
3-
generated: "2025-01-10T15:08:39.051068115Z"
1+
dependencies:
2+
- name: cert-manager
3+
repository: https://charts.jetstack.io
4+
version: v1.16.3
5+
digest: sha256:1ce80837e63f45e983685469e3af7c684b95ce548feadbb96a0519825a37bc8a
6+
generated: "2025-01-22T12:30:56.241307222+01:00"

charts/osbuilder/Chart.yaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
apiVersion: v2
22
name: osbuilder
33
description: A Helm chart for osbuilder
4-
appVersion: 0.1.5
5-
version: 0.1.5
6-
dependencies: []
74
maintainers:
8-
- name: Ettore Di Giacinto
9-
10-
home: https://kairos.io/
5+
- name: Plural
6+
7+
home: https://github.com/pluralsh/osbuilder
118
type: application
9+
appVersion: 0.1.5
10+
version: 0.1.5
11+
dependencies:
12+
- name: cert-manager
13+
alias: certManager
14+
repository: https://charts.jetstack.io
15+
version: v1.16.3
16+
condition: certManager.enabled
Binary file not shown.

charts/osbuilder/templates/NOTES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ template:
66
restartPolicy: Never
77
containers:
88
- name: upload
9-
image: {{ .Values.image.toolsRepository | default "quay.io/kairos/osbuilder-tools" }}:{{ .Values.image.tag | default .Chart.AppVersion }}
9+
image: {{ .Values.builder.toolsRepository | default "quay.io/kairos/osbuilder-tools" }}:{{ .Values.builder.image.tag | default .Chart.AppVersion }}
1010
command:
1111
- bash
1212
args:

charts/osbuilder/templates/_helpers.tpl

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ app.kubernetes.io/name: {{ include "helm-chart.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
5151
{{- end }}
5252

53-
{{/*
5453
Create the name of the service account to use
5554
*/}}
5655
{{- define "helm-chart.serviceAccountName" -}}
+6-41
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: osartifactbuilder-operator-manager-config
5+
namespace: '{{.Release.Namespace}}'
26
data:
3-
controller_manager_config.yaml: "apiVersion: controller-runtime.sigs.k8s.io/v1alpha1\nkind:
7+
controller_manager_config.yaml: "apiVersion: controller-runtime.sigs.k8s.io/v1alpha1\nkind:
48
ControllerManagerConfig\nhealth:\n healthProbeBindAddress: :8081\nmetrics:\n
59
\ bindAddress: 127.0.0.1:8080\nwebhook:\n port: 9443\nleaderElection:\n leaderElect:
610
true\n resourceName: 98ca89ca.kairos.io\n# leaderElectionReleaseOnCancel
@@ -12,43 +16,4 @@ data:
1216
after \n# the manager stops, so would be fine to enable this option. However,
1317
\n# if you are doing or is intended to do any operation such as perform
1418
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}}'
20-
---
21-
apiVersion: v1
22-
kind: ConfigMap
23-
metadata:
24-
name: nginx-config
25-
data:
26-
nginx.conf: |
27-
server {
28-
listen 80;
29-
server_name localhost;
30-
31-
client_max_body_size 21000M;
32-
33-
#access_log /var/log/nginx/host.access.log main;
34-
35-
location ~ "/upload/([0-9a-zA-Z-.]*)$" {
36-
alias /usr/share/nginx/html/$1;
37-
client_body_temp_path /tmp;
38-
dav_methods PUT DELETE MKCOL COPY MOVE;
39-
create_full_put_path on;
40-
dav_access group:rw all:r;
41-
}
42-
43-
location / {
44-
root /usr/share/nginx/html;
45-
autoindex on;
46-
}
47-
48-
# redirect server error pages to the static page /50x.html
49-
#
50-
error_page 500 502 503 504 /50x.html;
51-
location = /50x.html {
52-
root /usr/share/nginx/html;
53-
}
54-
}
19+
\ leaderElectionReleaseOnCancel: true\n"
+65-129
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,69 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: '{{ include "helm-chart.fullname" . }}'
5-
namespace: '{{.Release.Namespace}}'
6-
labels:
7-
{{- include "helm-chart.labels" . | nindent 8 }}
4+
name: '{{ include "helm-chart.fullname" . }}'
5+
namespace: '{{.Release.Namespace}}'
6+
labels:
7+
{{- include "helm-chart.labels" . | nindent 4 }}
88
spec:
9-
replicas: {{ .Values.replicas | default 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 14 }}
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-
- --pvc-storage-size={{ .Values.pvcStorageSize }}
49-
- --health-probe-bind-address=:8081
50-
- --metrics-bind-address=127.0.0.1:8080
51-
- --leader-elect
52-
- '--tool-image={{ .Values.toolsImage.repository | default "quay.io/kairos/auroraboot" }}:{{ .Values.toolsImage.tag | default "latest" }}'
53-
command:
54-
- /manager
55-
image: '{{ .Values.image.repository | default "ghcr.io/pluralsh/osbuilder" }}:{{ .Values.image.tag | default .Chart.AppVersion }}'
56-
livenessProbe:
57-
httpGet:
58-
path: /healthz
59-
port: 8081
60-
initialDelaySeconds: 15
61-
periodSeconds: 20
62-
name: manager
63-
readinessProbe:
64-
httpGet:
65-
path: /readyz
66-
port: 8081
67-
initialDelaySeconds: 5
68-
periodSeconds: 10
69-
{{- if and .Values.resources .Values.resources.controller }}
70-
resources:
71-
{{ toYaml .Values.resources.controller | indent 20 }}
72-
{{- end }}
73-
securityContext:
74-
allowPrivilegeEscalation: false
75-
securityContext:
76-
runAsNonRoot: true
77-
serviceAccountName: '{{ include "helm-chart.serviceAccountName" . }}'
78-
terminationGracePeriodSeconds: 10
79-
{{- with .Values.nodeSelector }}
80-
nodeSelector:
81-
{{- toYaml . | nindent 14 }}
82-
{{- end }}
83-
{{- with .Values.affinity }}
84-
affinity:
85-
{{- toYaml . | nindent 14 }}
86-
{{- end }}
87-
{{- with .Values.tolerations }}
88-
tolerations:
89-
{{- toYaml . | nindent 14 }}
90-
{{- end }}
91-
---
92-
apiVersion: apps/v1
93-
kind: Deployment
94-
metadata:
95-
labels:
96-
app.kubernetes.io/name: osbuilder-nginx
97-
name: 'osbuilder-nginx'
98-
namespace: '{{.Release.Namespace}}'
99-
spec:
100-
replicas: 1
101-
selector:
102-
matchLabels:
103-
app.kubernetes.io/name: osbuilder-nginx
104-
template:
105-
metadata:
106-
labels:
107-
app.kubernetes.io/name: osbuilder-nginx
108-
spec:
109-
containers:
110-
- image: nginx
111-
name: nginx
112-
ports:
113-
- containerPort: 80
114-
volumeMounts:
115-
- mountPath: /usr/share/nginx/html
116-
name: nginx-public
117-
- mountPath: /etc/nginx/conf.d
118-
name: config
119-
readOnly: true
120-
serviceAccountName: '{{ include "helm-chart.serviceAccountName" . }}'
121-
terminationGracePeriodSeconds: 10
122-
securityContext:
123-
fsGroup: 101
124-
volumes:
125-
- name: nginx-public
126-
persistentVolumeClaim:
127-
claimName: osartifactbuilder-operator-nginx-public
128-
- name: config
129-
configMap:
130-
name: nginx-config
131-
items:
132-
- key: nginx.conf
133-
path: default.conf
9+
replicas: {{ .Values.builder.replicas }}
10+
selector:
11+
matchLabels:
12+
{{- include "helm-chart.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
annotations:
16+
{{- range keys .Values.builder.podAnnotations }}
17+
{{ . | quote }}: {{ get $.Values.builder.podAnnotations . | quote}}
18+
{{- end }}
19+
labels:
20+
{{- include "helm-chart.selectorLabels" . | nindent 8 }}
21+
spec:
22+
{{- with .Values.builder.imagePullSecrets }}
23+
imagePullSecrets:
24+
{{- toYaml . | nindent 14 }}
25+
{{- end }}
26+
containers:
27+
- name: manager
28+
image: '{{ .Values.builder.image.repository | default "ghcr.io/pluralsh/osbuilder" }}:{{ .Values.builder.image.tag | default .Chart.AppVersion }}'
29+
command: [ '/manager' ]
30+
args:
31+
- --pvc-storage-size={{ .Values.builder.pvcStorageSize }}
32+
- --health-probe-bind-address=:8081
33+
- --metrics-bind-address=127.0.0.1:8080
34+
- --leader-elect
35+
- '--tool-image={{ .Values.builder.toolsImage.repository | default "quay.io/kairos/auroraboot" }}:{{ .Values.builder.toolsImage.tag | default "latest" }}'
36+
livenessProbe:
37+
httpGet:
38+
path: /healthz
39+
port: 8081
40+
initialDelaySeconds: 15
41+
periodSeconds: 20
42+
readinessProbe:
43+
httpGet:
44+
path: /readyz
45+
port: 8081
46+
initialDelaySeconds: 5
47+
periodSeconds: 10
48+
{{- if and .Values.builder.resources .Values.builder.resources.controller }}
49+
resources:
50+
{{- toYaml .Values.builder.resources.controller | nindent 12 }}
51+
{{- end }}
52+
securityContext:
53+
allowPrivilegeEscalation: false
54+
securityContext:
55+
runAsNonRoot: true
56+
serviceAccountName: '{{ include "helm-chart.serviceAccountName" . }}'
57+
terminationGracePeriodSeconds: 10
58+
{{- with .Values.builder.nodeSelector }}
59+
nodeSelector:
60+
{{- toYaml . | nindent 14 }}
61+
{{- end }}
62+
{{- with .Values.builder.affinity }}
63+
affinity:
64+
{{- toYaml . | nindent 14 }}
65+
{{- end }}
66+
{{- with .Values.builder.tolerations }}
67+
tolerations:
68+
{{- toYaml . | nindent 14 }}
69+
{{- end }}

charts/osbuilder/templates/nginx-pvc.yaml

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if not .Values.registry.ingress.enabled }}
2+
3+
apiVersion: cert-manager.io/v1
4+
kind: Issuer
5+
metadata:
6+
name: {{ include "helm-chart.fullname" . }}-registry-selfsigned-issuer
7+
namespace: {{ .Release.Namespace }}
8+
labels:
9+
app.kubernetes.io/component: registry
10+
{{- include "helm-chart.labels" . | nindent 4 }}
11+
spec:
12+
selfSigned: {}
13+
---
14+
apiVersion: cert-manager.io/v1
15+
kind: Certificate
16+
metadata:
17+
name: {{ include "helm-chart.fullname" . }}-registry-tls
18+
namespace: {{ .Release.Namespace }}
19+
labels:
20+
app.kubernetes.io/component: registry
21+
{{- include "helm-chart.labels" . | nindent 4 }}
22+
spec:
23+
secretName: {{ include "helm-chart.fullname" . }}-registry-tls
24+
isCA: false
25+
usages:
26+
- server auth
27+
- client auth
28+
dnsNames:
29+
- "{{ include "helm-chart.fullname" . }}-registry.{{.Release.Namespace}}.svc.cluster.local"
30+
- "{{ include "helm-chart.fullname" . }}-registry"
31+
issuerRef:
32+
name: {{ include "helm-chart.fullname" . }}-registry-selfsigned-issuer
33+
34+
{{- end }}

0 commit comments

Comments
 (0)