mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-22 15:41:47 +00:00
Set source namespace when reconciling with source
Signed-off-by: Hidde Beydals <hello@hidde.co> Signed-off-by: jonathan-innis <jonathan.innis.ji@gmail.com>
This commit is contained in:
parent
5e042aa334
commit
e7327843ca
2 changed files with 10 additions and 0 deletions
|
|
@ -93,6 +93,10 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if rhrArgs.syncHrWithSource {
|
if rhrArgs.syncHrWithSource {
|
||||||
|
nsCopy := rootArgs.namespace
|
||||||
|
if helmRelease.Spec.Chart.Spec.SourceRef.Namespace != "" {
|
||||||
|
rootArgs.namespace = helmRelease.Spec.Chart.Spec.SourceRef.Namespace
|
||||||
|
}
|
||||||
switch helmRelease.Spec.Chart.Spec.SourceRef.Kind {
|
switch helmRelease.Spec.Chart.Spec.SourceRef.Kind {
|
||||||
case sourcev1.HelmRepositoryKind:
|
case sourcev1.HelmRepositoryKind:
|
||||||
err = reconcileSourceHelmCmdRun(nil, []string{helmRelease.Spec.Chart.Spec.SourceRef.Name})
|
err = reconcileSourceHelmCmdRun(nil, []string{helmRelease.Spec.Chart.Spec.SourceRef.Name})
|
||||||
|
|
@ -104,6 +108,7 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
rootArgs.namespace = nsCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
lastHandledReconcileAt := helmRelease.Status.LastHandledReconcileAt
|
lastHandledReconcileAt := helmRelease.Status.LastHandledReconcileAt
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,10 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if rksArgs.syncKsWithSource {
|
if rksArgs.syncKsWithSource {
|
||||||
|
nsCopy := rootArgs.namespace
|
||||||
|
if kustomization.Spec.SourceRef.Namespace != "" {
|
||||||
|
rootArgs.namespace = kustomization.Spec.SourceRef.Namespace
|
||||||
|
}
|
||||||
switch kustomization.Spec.SourceRef.Kind {
|
switch kustomization.Spec.SourceRef.Kind {
|
||||||
case sourcev1.GitRepositoryKind:
|
case sourcev1.GitRepositoryKind:
|
||||||
err = reconcileSourceGitCmdRun(nil, []string{kustomization.Spec.SourceRef.Name})
|
err = reconcileSourceGitCmdRun(nil, []string{kustomization.Spec.SourceRef.Name})
|
||||||
|
|
@ -100,6 +104,7 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
rootArgs.namespace = nsCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
lastHandledReconcileAt := kustomization.Status.LastHandledReconcileAt
|
lastHandledReconcileAt := kustomization.Status.LastHandledReconcileAt
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue