Migrate flux uninstall to Helm Source API v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteSourceHelmCmd = &cobra.Command{
|
var deleteSourceHelmCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var supportedHelmChartSourceKinds = []string{sourcev1b2.HelmRepositoryKind, sourcev1.GitRepositoryKind, sourcev1b2.BucketKind}
|
var supportedHelmChartSourceKinds = []string{sourcev1.HelmRepositoryKind, sourcev1.GitRepositoryKind, sourcev1b2.BucketKind}
|
||||||
|
|
||||||
type HelmChartSource struct {
|
type HelmChartSource struct {
|
||||||
Kind string
|
Kind string
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHelmChartSource_Set(t *testing.T) {
|
func TestHelmChartSource_Set(t *testing.T) {
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ func objectReconciled(kube client.Client, objKey client.ObjectKey, clientObject
|
|||||||
func hasRevision(kind string, obj map[string]interface{}, expectedRev string) (bool, error) {
|
func hasRevision(kind string, obj map[string]interface{}, expectedRev string) (bool, error) {
|
||||||
var rev string
|
var rev string
|
||||||
switch kind {
|
switch kind {
|
||||||
case sourcev1.GitRepositoryKind, sourcev1b2.OCIRepositoryKind, sourcev1b2.BucketKind, sourcev1b2.HelmChartKind:
|
case sourcev1.GitRepositoryKind, sourcev1b2.OCIRepositoryKind, sourcev1b2.BucketKind, sourcev1.HelmChartKind:
|
||||||
rev, _, _ = unstructured.NestedString(obj, "status", "artifact", "revision")
|
rev, _, _ = unstructured.NestedString(obj, "status", "artifact", "revision")
|
||||||
case kustomizev1.KustomizationKind:
|
case kustomizev1.KustomizationKind:
|
||||||
rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision")
|
rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision")
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var list sourcev1b2.HelmRepositoryList
|
var list sourcev1.HelmRepositoryList
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
for i := range list.Items {
|
for i := range list.Items {
|
||||||
r := list.Items[i]
|
r := list.Items[i]
|
||||||
@@ -184,7 +184,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var list sourcev1b2.HelmChartList
|
var list sourcev1.HelmChartList
|
||||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||||
for i := range list.Items {
|
for i := range list.Items {
|
||||||
r := list.Items[i]
|
r := list.Items[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user