Skip to content

Commit

Permalink
Merge pull request goharbor#921 from ElArtista/patch-1
Browse files Browse the repository at this point in the history
Use release name as full name if it contains chart name
  • Loading branch information
ywk253100 authored Jun 16, 2021
2 parents 2494f2e + db7b7c1 commit b895aa4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Configure the new chart to make sure that the configuration items have the same
kubectl get secret
```

Find the secret whose name ends with `-harbor-ingress` (expose service via `Ingress`) or `-harbor-nginx`(expose service via `ClusterIP` or `NodePort`)
Find the secret whose name ends with `-ingress` (expose service via `Ingress`) or `-harbor-nginx`(expose service via `ClusterIP` or `NodePort`)

2) Export the secret as yaml file:

Expand Down
15 changes: 12 additions & 3 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "harbor.fullname" -}}
{{- $name := default "harbor" .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default "harbor" .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/* Helm required labels */}}
{{- define "harbor.labels" -}}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type IngressTestSuite struct {
}

func (i *IngressTestSuite) TestIngress() {
k8s.GetIngress(i.T(), i.Options.KubectlOptions, fmt.Sprintf("%s-harbor-ingress", i.ReleaseName))
k8s.GetIngress(i.T(), i.Options.KubectlOptions, fmt.Sprintf("%s-harbor-ingress-notary", i.ReleaseName))
k8s.GetIngress(i.T(), i.Options.KubectlOptions, fmt.Sprintf("%s-ingress", i.ReleaseName))
k8s.GetIngress(i.T(), i.Options.KubectlOptions, fmt.Sprintf("%s-ingress-notary", i.ReleaseName))
}

func TestIngressTestSuite(t *testing.T) {
Expand Down

0 comments on commit b895aa4

Please sign in to comment.