Skip to content

Commit

Permalink
Support flux v2.2.0 (#4166)
Browse files Browse the repository at this point in the history
This adds the latest source-controller v1.2.2.

Dependencies are updated to allow us to pull in the latest Flux code.

And we now pull the internal Helm release storage version from the history, rather than the latest version field.

if there's no history, we assume it's an old version of flux, and use the existing storage mechanism.
  • Loading branch information
bigkevmcd committed Dec 30, 2023
1 parent a38fbec commit 591cc3d
Show file tree
Hide file tree
Showing 29 changed files with 1,881 additions and 452 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ download-test-crds:
curl -sL "https://raw.githubusercontent.com/fluxcd/source-controller/v1.0.0/config/crd/bases/$${group}.toolkit.fluxcd.io_$${resource}.yaml" -o "tools/testcrds/$${group}.toolkit.fluxcd.io_$${resource}.yaml"; \
done
curl -sL "https://raw.githubusercontent.com/fluxcd/kustomize-controller/v1.0.0/config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml" -o "tools/testcrds/kustomize.toolkit.fluxcd.io_kustomizations.yaml"
curl -sL "https://raw.githubusercontent.com/fluxcd/helm-controller/v0.35.0/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml" -o "tools/testcrds/helm.toolkit.fluxcd.io_helmreleases.yaml"
curl -sL "https://raw.githubusercontent.com/fluxcd/helm-controller/v0.37.0/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml" -o "tools/testcrds/helm.toolkit.fluxcd.io_helmreleases.yaml"

.PHONY: help
# Thanks to https://www.thapaliya.com/en/writings/well-documented-makefiles/
Expand Down
7 changes: 1 addition & 6 deletions cmd/gitops/create/terraform/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,9 @@ gitops create terraform -n default my-resource --source GitRepository/my-project
kubeConfigArgs.Namespace = &namespace
kubeConfigArgs.Context = &context

cfg, err := kubeConfigArgs.ToRESTConfig()
if err != nil {
return err
}

v := viper.New()
v.Set("namespace", namespace)
if err := app.Init(cfg, v); err != nil {
if err := app.Init(kubeConfigArgs, v); err != nil {
return err
}

Expand Down
10 changes: 3 additions & 7 deletions cmd/gitops/delete/terraform/cmd.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package terraform

import (
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/weaveworks/tf-controller/tfctl"
"github.com/weaveworks/weave-gitops/cmd/gitops/config"
"github.com/weaveworks/weave-gitops/pkg/run"
"k8s.io/cli-runtime/pkg/genericclioptions"
"os"
)

var kubeConfigArgs *genericclioptions.ConfigFlags
Expand Down Expand Up @@ -38,14 +39,9 @@ gitops delete terraform -n default my-resource
kubeConfigArgs.Namespace = &namespace
kubeConfigArgs.Context = &context

cfg, err := kubeConfigArgs.ToRESTConfig()
if err != nil {
return err
}

v := viper.New()
v.Set("namespace", namespace)
if err := app.Init(cfg, v); err != nil {
if err := app.Init(kubeConfigArgs, v); err != nil {
return err
}

Expand Down
10 changes: 3 additions & 7 deletions cmd/gitops/replan/terraform/cmd.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package terraform

import (
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/weaveworks/tf-controller/tfctl"
"github.com/weaveworks/weave-gitops/cmd/gitops/config"
"github.com/weaveworks/weave-gitops/pkg/run"
"k8s.io/cli-runtime/pkg/genericclioptions"
"os"
)

var kubeConfigArgs *genericclioptions.ConfigFlags
Expand Down Expand Up @@ -38,14 +39,9 @@ gitops replan terraform --namespace flux-system my-resource
kubeConfigArgs.Namespace = &namespace
kubeConfigArgs.Context = &context

cfg, err := kubeConfigArgs.ToRESTConfig()
if err != nil {
return err
}

v := viper.New()
v.Set("namespace", namespace)
if err := app.Init(cfg, v); err != nil {
if err := app.Init(kubeConfigArgs, v); err != nil {
return err
}

Expand Down
10 changes: 3 additions & 7 deletions cmd/gitops/resume/terraform/cmd.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package terraform

import (
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/weaveworks/tf-controller/tfctl"
"github.com/weaveworks/weave-gitops/cmd/gitops/config"
"github.com/weaveworks/weave-gitops/pkg/run"
"k8s.io/cli-runtime/pkg/genericclioptions"
"os"
)

var kubeConfigArgs *genericclioptions.ConfigFlags
Expand Down Expand Up @@ -38,14 +39,9 @@ gitops resume terraform --namespace flux-system my-resource
kubeConfigArgs.Namespace = &namespace
kubeConfigArgs.Context = &context

cfg, err := kubeConfigArgs.ToRESTConfig()
if err != nil {
return err
}

v := viper.New()
v.Set("namespace", namespace)
if err := app.Init(cfg, v); err != nil {
if err := app.Init(kubeConfigArgs, v); err != nil {
return err
}

Expand Down
10 changes: 3 additions & 7 deletions cmd/gitops/suspend/terraform/cmd.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package terraform

import (
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/weaveworks/tf-controller/tfctl"
"github.com/weaveworks/weave-gitops/cmd/gitops/config"
"github.com/weaveworks/weave-gitops/pkg/run"
"k8s.io/cli-runtime/pkg/genericclioptions"
"os"
)

var kubeConfigArgs *genericclioptions.ConfigFlags
Expand Down Expand Up @@ -38,14 +39,9 @@ gitops suspend terraform --namespace flux-system my-resource
kubeConfigArgs.Namespace = &namespace
kubeConfigArgs.Context = &context

cfg, err := kubeConfigArgs.ToRESTConfig()
if err != nil {
return err
}

v := viper.New()
v.Set("namespace", namespace)
if err := app.Init(cfg, v); err != nil {
if err := app.Init(kubeConfigArgs, v); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion core/fluxsync/adapters.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fluxsync

import (
helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
imgautomationv1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
reflectorv1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
Expand Down
2 changes: 1 addition & 1 deletion core/server/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"testing"

helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
. "github.com/onsi/gomega"
pb "github.com/weaveworks/weave-gitops/pkg/api/core"
Expand Down
2 changes: 1 addition & 1 deletion core/server/fluxruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion core/server/helm_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
"github.com/weaveworks/weave-gitops/core/clustersmngr"
pb "github.com/weaveworks/weave-gitops/pkg/api/core"
)
Expand Down
Loading

0 comments on commit 591cc3d

Please sign in to comment.