Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
feat: changed the mirror name logic
Browse files Browse the repository at this point in the history
Based on review feedback the mirrot name logic has been changed to
reduce duplicate mirrors if there are no creds
  • Loading branch information
richardcase committed Jan 21, 2020
1 parent 4d5424c commit f77e507
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/chartsync/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,12 @@ func (c *GitChartSync) helmReleasesForMirror(mirror string) ([]*v1.HelmRelease,

// mirrorName returns the name of the mirror for the given
// `v1.HelmRelease`.
// TODO(michael): this will not always be the git URL; e.g.
// per namespace, per auth.
func mirrorName(hr *v1.HelmRelease) string {
if hr != nil && hr.Spec.GitChartSource != nil {
secretName := "noauth"
if hr.Spec.GitChartSource.SecretRef != nil {
secretName = hr.Spec.GitChartSource.SecretRef.Name
if hr.Spec.GitChartSource.SecretRef == nil {
return hr.Spec.GitURL
}
return fmt.Sprintf("%s/%s/%s", hr.GetNamespace(), secretName, hr.Spec.GitURL)
return fmt.Sprintf("%s/%s/%s", hr.GetNamespace(), hr.Spec.GitChartSource.SecretRef.Name, hr.Spec.GitURL)
}
return ""
}
Expand Down

0 comments on commit f77e507

Please sign in to comment.