Skip to content

Commit

Permalink
Merge pull request goharbor#190 from ywk253100/190318_test
Browse files Browse the repository at this point in the history
Bug fix: empty the secret name used by Harbor
  • Loading branch information
ywk253100 authored Mar 18, 2019
2 parents 8cb49dd + aba5fb8 commit 387ce92
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
21 changes: 14 additions & 7 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,18 @@ host:port,pool_size,password

{{- define "harbor.certificate-secret" -}}
{{- $tls := .Values.expose.tls -}}
{{- $secret := "" -}}
{{- if $tls.secretName }}
{{- $secret = $tls.secretName }}
{{- else }}
{{- $secret = (include "harbor.certificate" .) }}
{{- end }}
{{- printf "%s" $secret -}}
{{- if $tls.secretName }}
{{- printf "%s" $tls.secretName -}}
{{- else }}
{{- printf "%s" (include "harbor.certificate" .) -}}
{{- end }}
{{- end -}}

{{- define "harbor.common-name" -}}
{{- $expose := .Values.expose }}
{{- if and (eq $expose.type "ingress") $expose.ingress.host }}
{{- printf "%s" $expose.ingress.host -}}
{{- else }}
{{- printf "%s" $expose.tls.commonName -}}
{{- end }}
{{- end -}}
9 changes: 1 addition & 8 deletions templates/common/certificate-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{{- if eq (include "harbor.autoGenCert" .) "true" }}
{{- $expose := .Values.expose }}
{{- $cn := "" }}
{{- if and (eq $expose.type "ingress") $expose.ingress.host }}
{{- $cn = $expose.ingress.host }}
{{- else }}
{{- $cn = $expose.tls.commonName }}
{{- end }}
{{- $cn = (required "The \"expose.tls.commonName\" is required!" $cn) }}
{{- $cn := (required "The \"expose.tls.commonName\" is required!" (include "harbor.common-name" .)) }}
{{- $ca := genCA "harbor-ca" 365 }}
apiVersion: v1
kind: Secret
Expand Down
2 changes: 1 addition & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ expose:
# "tls.key" - the private key
# "ca.crt" - the certificate of CA
# These files will be generated automatically if the "secretName" is not set
secretName: "cert"
secretName: ""
# The commmon name used to generate the certificate, it's necessary
# when the type isn't "ingress" and "secretName" is null
commonName: ""
Expand Down

0 comments on commit 387ce92

Please sign in to comment.