Skip to content

Commit

Permalink
Helm registry update.
Browse files Browse the repository at this point in the history
  • Loading branch information
badri committed Dec 22, 2023
1 parent 77a167f commit 14f319a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
19 changes: 5 additions & 14 deletions addons/sb-registry/enable
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import subprocess
from string import Template

import click

Expand Down Expand Up @@ -36,20 +37,10 @@ def main(cluster_name, tld, password):
subprocess.run([HELM, "repo", "add", "docker-registry",
"https://helm.twun.io/"])
subprocess.run([HELM, "repo", "update"])
args = []
args.extend(["--set", "persistence.enabled=true"])
args.extend(["--set", "persistence.size=20Gi"])
args.extend(["--set", "ingress.enabled=true"])
args.extend(["--set", f"ingress.hosts[0]=registry.{cluster_name}.{tld}"])
args.extend(["--set", f"ingress.tls[0].hosts[0]=registry.{cluster_name}.{tld}"])
args.extend(["--set", "ingress.tls[0].secretName=registry-tls"])
args.extend(["--set", 'ingress.annotations."cert-manager\.io/cluster-issuer"=letsencrypt-prod'])
# maybe set ingress class
args.extend(["--set", "ingress.className=public"])
args.extend(["--set", 'ingress.annotations."nginx\.ingress\.kubernetes\.io/proxy-body-size=0"'])
args.extend(["--set", f"secrets.htpasswd={cluster_name}:{password}"])
args.extend(["--set", "updateStrategy.type=Recreate"])
subprocess.run([HELM, "install", "sb-registry", "docker-registry/docker-registry", *args])
current_path = os.path.dirname(os.path.realpath(__file__))
registry_values_template = Template(open(f'{current_path}/values.yaml').read())
registry_values = registry_values_template.substitute(cluster_name=cluster_name, tld=tld, password=password)
subprocess.run([HELM, "install", "sb-registry", "docker-registry/docker-registry", "-f", "-"], input=registry_values.encode())
click.echo("Enabled SB registry")

if __name__ == "__main__":
Expand Down
20 changes: 20 additions & 0 deletions addons/sb-registry/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
persistence:
enabled: true
size: "20Gi"
ingress:
enabled: true
hosts:
- "registry.$cluster_name.$tld"
tls:
- hosts:
- "registry.$cluster_name.$tld"
secretName: registry-tls
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: 0
className: public

secrets:
htpasswd: "$cluster_name:$password"
updateStrategy:
type: Recreate

0 comments on commit 14f319a

Please sign in to comment.