Skip to content

Commit 0eec7cd

Browse files
author
lijianguo
committed
chore(helmbroker): up chart
1 parent d197d3b commit 0eec7cd

9 files changed

Lines changed: 98 additions & 5 deletions

File tree

charts/helmbroker/templates/_helpers.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,8 @@ volumes:
4444
- name: helmbroker-data
4545
persistentVolumeClaim:
4646
claimName: drycc-helmbroker
47+
{{- else}}
48+
- name: helmbroker-data
49+
emptyDir: {}
4750
{{- end }}
4851
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.cert_manager_enabled }}
2+
apiVersion: cert-manager.io/v1
3+
kind: Certificate
4+
metadata:
5+
name: drycc-helmbroker
6+
spec:
7+
secretName: drycc-helmbroker-certificate-auto
8+
issuerRef:
9+
name: drycc-cluster-issuer
10+
kind: ClusterIssuer
11+
dnsNames:
12+
- drycc-helmbroker.{{ .Values.platform_domain }}
13+
privateKey:
14+
rotationPolicy: Always
15+
{{- end }}

charts/helmbroker/templates/helmbroker-deployment.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ spec:
2222
app: drycc-helmbroker
2323
spec:
2424
serviceAccount: drycc-helmbroker
25+
initContainers:
26+
- name: loader
27+
image: {{.Values.image_registry}}/{{.Values.image_org}}/helmbroker:{{.Values.image_tag}}
28+
imagePullPolicy: {{.Values.image_pull_policy}}
29+
command: ['python', '-m', 'helmbroker.loader'];
30+
{{- include "helmbroker.envs" . | indent 10 }}
31+
{{- include "helmbroker.volumeMounts" . | indent 10 }}
2532
containers:
2633
- name: drycc-helmbroker
2734
image: {{.Values.image_registry}}/{{.Values.image_org}}/helmbroker:{{.Values.image_tag}}
@@ -40,7 +47,7 @@ spec:
4047
timeoutSeconds: 10
4148
periodSeconds: 5
4249
ports:
43-
- containerPort: 8000
50+
- containerPort: 5000
4451
name: http
4552
{{- include "helmbroker.limits" . | indent 10 }}
4653
{{- include "helmbroker.envs" . | indent 10 }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: "helmbroker-api-server"
5+
labels:
6+
app: "helmbroker"
7+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
8+
release: "{{ .Release.Name }}"
9+
heritage: "{{ .Release.Service }}"
10+
annotations:
11+
kubernetes.io/tls-acme: "true"
12+
{{- if not (eq .Values.ingress_class "") }}
13+
kubernetes.io/ingress.class: "{{ .Values.ingress_class }}"
14+
{{- end }}
15+
spec:
16+
rules:
17+
- host: drycc.{{ .Values.platform_domain }}
18+
http:
19+
paths:
20+
- pathType: Prefix
21+
{{- if eq .Values.ingress_class "gce" "alb" }}
22+
path: /*
23+
{{- else }}{{/* Has annotations but ingress class is not "gce" nor "alb" */}}
24+
path: /
25+
{{- end }}
26+
backend:
27+
service:
28+
name: drycc-helmbroker
29+
port:
30+
number: 80
31+
{{- if .Values.cert_manager_enabled }}
32+
tls:
33+
- secretName: drycc-helmbroker-certificate-auto
34+
hosts:
35+
- drycc.{{ .Values.platform_domain }}
36+
{{- end }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: drycc-helmbroker
5+
labels:
6+
heritage: drycc
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: drycc-helmbroker
5+
labels:
6+
heritage: drycc
7+
spec:
8+
ports:
9+
- name: http
10+
port: 80
11+
targetPort: 5000
12+
selector:
13+
app: drycc-helmbroker

charts/helmbroker/values.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,17 @@ persistence:
1616
accessMode: ReadWriteOnce
1717
size: 5Gi
1818
storageClass: ""
19-
volumeName: ""
19+
volumeName: ""
20+
21+
ingress_class: ""
22+
# A domain name consists of one or more parts.
23+
# Periods (.) are used to separate these parts.
24+
# Each part must be 1 to 63 characters in length and can contain lowercase letters, digits, and hyphens (-).
25+
# It must start and end with a lowercase letter or digit.
26+
cluster_domain: "cluster.local"
27+
# The public resolvable hostname to build your cluster with.
28+
#
29+
# This will be the hostname that is used to build endpoints such as "drycc.$HOSTNAME"
30+
platform_domain: ""
31+
# Whether cert_manager is enabled to automatically generate helmbroker certificates
32+
cert_manager_enabled: "true"

rootfs/helmbroker/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@
99

1010
class Config:
1111
DEBUG = os.environ.get("DEBUG", False)
12-
if not os.path.exists(ADDONS_PATH):
13-
os.makedirs(ADDONS_PATH)

rootfs/helmbroker/loader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ def load_addons(repository):
8686
encoding="utf-8")
8787
# compare index.yaml, is update
8888
local_index = read_file(local_index_file)
89-
if remote_index == local_index:
89+
if local_index and remote_index == local_index:
9090
return
9191
# delete old repository catalog
9292
if os.path.exists(ADDONS_PATH):
9393
shutil.rmtree(ADDONS_PATH)
94+
else:
95+
os.makedirs(ADDONS_PATH, exist_ok=True)
9496
# new index
9597
save_file(remote_index, ADDONS_PATH, index_name)
9698
remote_index = yaml.load(remote_index, Loader=yaml.Loader)

0 commit comments

Comments
 (0)