1
0
mirror of synced 2026-02-13 13:06:56 +00:00

fix: support reconcile recursive source tree hr => chart => repo

Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
This commit is contained in:
Raffael Sahli
2023-04-14 10:02:03 +00:00
committed by Hidde Beydals
parent e678738ded
commit b8c24f906d
5 changed files with 75 additions and 30 deletions

View File

@@ -17,11 +17,12 @@ limitations under the License.
package main
import (
"fmt"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/types"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
)
@@ -63,28 +64,20 @@ func (obj helmReleaseAdapter) reconcileSource() bool {
return rhrArgs.syncHrWithSource
}
func (obj helmReleaseAdapter) getSource() (reconcileCommand, types.NamespacedName) {
var cmd reconcileCommand
switch obj.Spec.Chart.Spec.SourceRef.Kind {
case sourcev1b2.HelmRepositoryKind:
cmd = reconcileCommand{
apiType: helmRepositoryType,
object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}},
}
case sourcev1.GitRepositoryKind:
cmd = reconcileCommand{
apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
}
case sourcev1b2.BucketKind:
cmd = reconcileCommand{
apiType: bucketType,
object: bucketAdapter{&sourcev1b2.Bucket{}},
}
func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) {
cmd := reconcileWithSourceCommand{
apiType: helmChartType,
object: helmChartAdapter{&sourcev1b2.HelmChart{}},
force: true,
}
ns := obj.Spec.Chart.Spec.SourceRef.Namespace
if ns == "" {
ns = obj.Namespace
}
return cmd, types.NamespacedName{
Name: obj.Spec.Chart.Spec.SourceRef.Name,
Namespace: obj.Spec.Chart.Spec.SourceRef.Namespace,
Name: fmt.Sprintf("%s-%s", obj.Namespace, obj.Name),
Namespace: ns,
}
}