add optional storageNamespace
Signed-off-by: gtracer <ganesha.ashoka@gmail.com> update comments Signed-off-by: gtracer <ganesha.ashoka@gmail.com> make test Signed-off-by: gtracer <ganesha.ashoka@gmail.com> revert controller-gen version Signed-off-by: gtracer <ganesha.ashoka@gmail.com>
This commit is contained in:
parent
e402a46816
commit
a5ab88962a
|
|
@ -69,6 +69,14 @@ type HelmReleaseSpec struct {
|
||||||
// +optional
|
// +optional
|
||||||
TargetNamespace string `json:"targetNamespace,omitempty"`
|
TargetNamespace string `json:"targetNamespace,omitempty"`
|
||||||
|
|
||||||
|
// StorageNamespace used for the Helm storage.
|
||||||
|
// Defaults to the namespace of the HelmRelease.
|
||||||
|
// +kubebuilder:validation:MinLength=1
|
||||||
|
// +kubebuilder:validation:MaxLength=63
|
||||||
|
// +kubebuilder:validation:Optional
|
||||||
|
// +optional
|
||||||
|
StorageNamespace string `json:"storageNamespace,omitempty"`
|
||||||
|
|
||||||
// DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with
|
// DependsOn may contain a dependency.CrossNamespaceDependencyReference slice with
|
||||||
// references to HelmRelease resources that must be ready before this HelmRelease
|
// references to HelmRelease resources that must be ready before this HelmRelease
|
||||||
// can be reconciled.
|
// can be reconciled.
|
||||||
|
|
@ -793,6 +801,15 @@ func (in HelmRelease) GetReleaseNamespace() string {
|
||||||
return in.Namespace
|
return in.Namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStorageNamespace returns the configured StorageNamespace for helm, or the namespace
|
||||||
|
// of the HelmRelease.
|
||||||
|
func (in HelmRelease) GetStorageNamespace() string {
|
||||||
|
if in.Spec.StorageNamespace != "" {
|
||||||
|
return in.Spec.StorageNamespace
|
||||||
|
}
|
||||||
|
return in.Namespace
|
||||||
|
}
|
||||||
|
|
||||||
// GetHelmChartName returns the name used by the controller for the HelmChart creation.
|
// GetHelmChartName returns the name used by the controller for the HelmChart creation.
|
||||||
func (in HelmRelease) GetHelmChartName() string {
|
func (in HelmRelease) GetHelmChartName() string {
|
||||||
return strings.Join([]string{in.Namespace, in.Name}, "-")
|
return strings.Join([]string{in.Namespace, in.Name}, "-")
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,12 @@ spec:
|
||||||
description: The name of the Kubernetes service account to impersonate
|
description: The name of the Kubernetes service account to impersonate
|
||||||
when reconciling this HelmRelease.
|
when reconciling this HelmRelease.
|
||||||
type: string
|
type: string
|
||||||
|
storageNamespace:
|
||||||
|
description: StorageNamespace used for the Helm storage. Defaults
|
||||||
|
to the namespace of the HelmRelease.
|
||||||
|
maxLength: 63
|
||||||
|
minLength: 1
|
||||||
|
type: string
|
||||||
suspend:
|
suspend:
|
||||||
description: Suspend tells the controller to suspend reconciliation
|
description: Suspend tells the controller to suspend reconciliation
|
||||||
for this HelmRelease, it does not apply to already started reconciliations.
|
for this HelmRelease, it does not apply to already started reconciliations.
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return v2.HelmReleaseNotReady(hr, v2.InitFailedReason, err.Error()), err
|
return v2.HelmReleaseNotReady(hr, v2.InitFailedReason, err.Error()), err
|
||||||
}
|
}
|
||||||
run, err := runner.NewRunner(getter, hr.GetNamespace(), log)
|
run, err := runner.NewRunner(getter, hr.GetStorageNamespace(), log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return v2.HelmReleaseNotReady(hr, v2.InitFailedReason, "failed to initialize Helm action runner"), err
|
return v2.HelmReleaseNotReady(hr, v2.InitFailedReason, "failed to initialize Helm action runner"), err
|
||||||
}
|
}
|
||||||
|
|
@ -616,7 +616,7 @@ func (r *HelmReleaseReconciler) reconcileDelete(ctx context.Context, hr v2.HelmR
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctrl.Result{}, err
|
return ctrl.Result{}, err
|
||||||
}
|
}
|
||||||
run, err := runner.NewRunner(getter, hr.GetNamespace(), logr.FromContext(ctx))
|
run, err := runner.NewRunner(getter, hr.GetStorageNamespace(), logr.FromContext(ctx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctrl.Result{}, err
|
return ctrl.Result{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,19 @@ Defaults to the namespace of the HelmRelease.</p>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
<code>storageNamespace</code><br>
|
||||||
|
<em>
|
||||||
|
string
|
||||||
|
</em>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<em>(Optional)</em>
|
||||||
|
<p>StorageNamespace used for the Helm storage.
|
||||||
|
Defaults to the namespace of the HelmRelease.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
<code>dependsOn</code><br>
|
<code>dependsOn</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference">
|
<a href="https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference">
|
||||||
|
|
@ -686,6 +699,19 @@ Defaults to the namespace of the HelmRelease.</p>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
<code>storageNamespace</code><br>
|
||||||
|
<em>
|
||||||
|
string
|
||||||
|
</em>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<em>(Optional)</em>
|
||||||
|
<p>StorageNamespace used for the Helm storage.
|
||||||
|
Defaults to the namespace of the HelmRelease.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
<code>dependsOn</code><br>
|
<code>dependsOn</code><br>
|
||||||
<em>
|
<em>
|
||||||
<a href="https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference">
|
<a href="https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue