internal/helm: return callback on empty TLS config
...and no-op on empty valuesFile string.
This commit is contained in:
parent
4da80b65e5
commit
969a46f4d6
|
|
@ -296,9 +296,7 @@ func (r *HelmChartReconciler) reconcileFromHelmRepository(ctx context.Context,
|
|||
err = fmt.Errorf("auth options error: %w", err)
|
||||
return sourcev1.HelmChartNotReady(chart, sourcev1.AuthenticationFailedReason, err.Error()), err
|
||||
}
|
||||
if cleanup != nil {
|
||||
defer cleanup()
|
||||
}
|
||||
clientOpts = opts
|
||||
}
|
||||
|
||||
|
|
@ -435,12 +433,10 @@ func (r *HelmChartReconciler) reconcileFromTarballArtifact(ctx context.Context,
|
|||
return chart, nil
|
||||
}
|
||||
|
||||
// Overwrite default values if instructed to
|
||||
if chart.Spec.ValuesFile != "" {
|
||||
// Overwrite default values if configured
|
||||
if err := helm.OverwriteChartDefaultValues(chartPath, chart.Spec.ValuesFile); err != nil {
|
||||
return sourcev1.HelmChartNotReady(chart, sourcev1.ChartPackageFailedReason, err.Error()), err
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure artifact directory exists
|
||||
err = r.Storage.MkdirAll(newArtifact)
|
||||
|
|
|
|||
|
|
@ -195,9 +195,7 @@ func (r *HelmRepositoryReconciler) reconcile(ctx context.Context, repository sou
|
|||
err = fmt.Errorf("auth options error: %w", err)
|
||||
return sourcev1.HelmRepositoryNotReady(repository, sourcev1.AuthenticationFailedReason, err.Error()), err
|
||||
}
|
||||
if cleanup != nil {
|
||||
defer cleanup()
|
||||
}
|
||||
clientOpts = opts
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import (
|
|||
// OverwriteChartDefaultValues overwrites the chart default values file in the
|
||||
// given chartPath with the contents of the given valuesFile.
|
||||
func OverwriteChartDefaultValues(chartPath, valuesFile string) error {
|
||||
if valuesFile == chartutil.ValuesfileName {
|
||||
if valuesFile == "" || valuesFile == chartutil.ValuesfileName {
|
||||
return nil
|
||||
}
|
||||
srcPath := path.Join(chartPath, valuesFile)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func TLSClientConfigFromSecret(secret corev1.Secret) (getter.Option, func(), err
|
|||
certBytes, keyBytes, caBytes := secret.Data["certFile"], secret.Data["keyFile"], secret.Data["caFile"]
|
||||
switch {
|
||||
case len(certBytes)+len(keyBytes)+len(caBytes) == 0:
|
||||
return nil, nil, nil
|
||||
return nil, func() {}, nil
|
||||
case (len(certBytes) > 0 && len(keyBytes) == 0) || (len(keyBytes) > 0 && len(certBytes) == 0):
|
||||
return nil, nil, fmt.Errorf("invalid '%s' secret data: fields 'certFile' and 'keyFile' require each other's presence",
|
||||
secret.Name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue