Update CLI to OCIRepository v1 (GA)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
"github.com/fluxcd/pkg/runtime/transform"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
@@ -142,7 +141,7 @@ var helmReleaseArgs helmReleaseFlags
|
||||
|
||||
var supportedHelmReleaseValuesFromKinds = []string{"Secret", "ConfigMap"}
|
||||
|
||||
var supportedHelmReleaseReferenceKinds = []string{sourcev1b2.OCIRepositoryKind, sourcev1.HelmChartKind}
|
||||
var supportedHelmReleaseReferenceKinds = []string{sourcev1.OCIRepositoryKind, sourcev1.HelmChartKind}
|
||||
|
||||
func init() {
|
||||
createHelmReleaseCmd.Flags().StringVar(&helmReleaseArgs.name, "release-name", "", "name used for the Helm release, defaults to a composition of '[<target-namespace>-]<HelmRelease-name>'")
|
||||
@@ -222,7 +221,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
case helmReleaseArgs.chartRef != "":
|
||||
kind, name, ns := utils.ParseObjectKindNameNamespace(helmReleaseArgs.chartRef)
|
||||
if kind != sourcev1.HelmChartKind && kind != sourcev1b2.OCIRepositoryKind {
|
||||
if kind != sourcev1.HelmChartKind && kind != sourcev1.OCIRepositoryKind {
|
||||
return fmt.Errorf("chart reference kind '%s' is not supported, must be one of: %s",
|
||||
kind, strings.Join(supportedHelmReleaseReferenceKinds, ", "))
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/fluxcd/pkg/apis/meta"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
@@ -81,7 +79,7 @@ var sourceOCIRepositoryArgs = newSourceOCIFlags()
|
||||
|
||||
func newSourceOCIFlags() sourceOCIRepositoryFlags {
|
||||
return sourceOCIRepositoryFlags{
|
||||
provider: flags.SourceOCIProvider(sourcev1b2.GenericOCIProvider),
|
||||
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,20 +125,20 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
|
||||
ignorePaths = &ignorePathsStr
|
||||
}
|
||||
|
||||
repository := &sourcev1b2.OCIRepository{
|
||||
repository := &sourcev1.OCIRepository{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: *kubeconfigArgs.Namespace,
|
||||
Labels: sourceLabels,
|
||||
},
|
||||
Spec: sourcev1b2.OCIRepositorySpec{
|
||||
Spec: sourcev1.OCIRepositorySpec{
|
||||
Provider: sourceOCIRepositoryArgs.provider.String(),
|
||||
URL: sourceOCIRepositoryArgs.url,
|
||||
Insecure: sourceOCIRepositoryArgs.insecure,
|
||||
Interval: metav1.Duration{
|
||||
Duration: createArgs.interval,
|
||||
},
|
||||
Reference: &sourcev1b2.OCIRepositoryRef{},
|
||||
Reference: &sourcev1.OCIRepositoryRef{},
|
||||
Ignore: ignorePaths,
|
||||
},
|
||||
}
|
||||
@@ -237,13 +235,13 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func upsertOCIRepository(ctx context.Context, kubeClient client.Client,
|
||||
ociRepository *sourcev1b2.OCIRepository) (types.NamespacedName, error) {
|
||||
ociRepository *sourcev1.OCIRepository) (types.NamespacedName, error) {
|
||||
namespacedName := types.NamespacedName{
|
||||
Namespace: ociRepository.GetNamespace(),
|
||||
Name: ociRepository.GetName(),
|
||||
}
|
||||
|
||||
var existing sourcev1b2.OCIRepository
|
||||
var existing sourcev1.OCIRepository
|
||||
err := kubeClient.Get(ctx, namespacedName, &existing)
|
||||
if err != nil {
|
||||
if errors.IsNotFound(err) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var deleteSourceChartCmd = &cobra.Command{
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var deleteSourceOCIRepositoryCmd = &cobra.Command{
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
"github.com/google/go-containerregistry/pkg/crane"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ import (
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
"github.com/fluxcd/flux2/v2/pkg/printers"
|
||||
@@ -446,7 +445,7 @@ var fluxKindMap = refMap{
|
||||
field: []string{"spec", "sourceRef"},
|
||||
},
|
||||
sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)},
|
||||
sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)},
|
||||
sourcev1.OCIRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)},
|
||||
sourcev1.BucketKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)},
|
||||
sourcev1.HelmRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)},
|
||||
autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)},
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var exportSourceOCIRepositoryCmd = &cobra.Command{
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
var getSourceAllCmd = &cobra.Command{
|
||||
@@ -42,7 +41,7 @@ var getSourceAllCmd = &cobra.Command{
|
||||
var allSourceCmd = []getCommand{
|
||||
{
|
||||
apiType: ociRepositoryType,
|
||||
list: &ociRepositoryListAdapter{&sourcev1b2.OCIRepositoryList{}},
|
||||
list: &ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}},
|
||||
},
|
||||
{
|
||||
apiType: bucketType,
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"golang.org/x/text/language"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
"github.com/fluxcd/flux2/v2/pkg/printers"
|
||||
|
||||
@@ -21,13 +21,13 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/google/go-containerregistry/pkg/crane"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
)
|
||||
|
||||
var pullArtifactCmd = &cobra.Command{
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
|
||||
authutils "github.com/fluxcd/pkg/auth/utils"
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
)
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
helmv2 "github.com/fluxcd/helm-controller/api/v2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
var reconcileHrCmd = &cobra.Command{
|
||||
@@ -92,7 +91,7 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName
|
||||
}
|
||||
return reconcileCommand{
|
||||
apiType: ociRepositoryType,
|
||||
object: ociRepositoryAdapter{&sourcev1b2.OCIRepository{}},
|
||||
object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
|
||||
}, namespacedName
|
||||
default:
|
||||
// default case assumes the HelmRelease is using a HelmChartTemplate
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
var reconcileKsCmd = &cobra.Command{
|
||||
@@ -66,10 +65,10 @@ func (obj kustomizationAdapter) reconcileSource() bool {
|
||||
func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedName) {
|
||||
var cmd reconcileCommand
|
||||
switch obj.Spec.SourceRef.Kind {
|
||||
case sourcev1b2.OCIRepositoryKind:
|
||||
case sourcev1.OCIRepositoryKind:
|
||||
cmd = reconcileCommand{
|
||||
apiType: ociRepositoryType,
|
||||
object: ociRepositoryAdapter{&sourcev1b2.OCIRepository{}},
|
||||
object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
|
||||
}
|
||||
case sourcev1.GitRepositoryKind:
|
||||
cmd = reconcileCommand{
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var reconcileSourceOCIRepositoryCmd = &cobra.Command{
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var resumeSourceOCIRepositoryCmd = &cobra.Command{
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
// These are general-purpose adapters for attaching methods to, for
|
||||
@@ -30,13 +29,13 @@ import (
|
||||
// sourcev1.ociRepository
|
||||
|
||||
var ociRepositoryType = apiType{
|
||||
kind: sourcev1b2.OCIRepositoryKind,
|
||||
kind: sourcev1.OCIRepositoryKind,
|
||||
humanKind: "source oci",
|
||||
groupVersion: sourcev1b2.GroupVersion,
|
||||
groupVersion: sourcev1.GroupVersion,
|
||||
}
|
||||
|
||||
type ociRepositoryAdapter struct {
|
||||
*sourcev1b2.OCIRepository
|
||||
*sourcev1.OCIRepository
|
||||
}
|
||||
|
||||
func (a ociRepositoryAdapter) asClientObject() client.Object {
|
||||
@@ -50,7 +49,7 @@ func (a ociRepositoryAdapter) deepCopyClientObject() client.Object {
|
||||
// sourcev1b2.OCIRepositoryList
|
||||
|
||||
type ociRepositoryListAdapter struct {
|
||||
*sourcev1b2.OCIRepositoryList
|
||||
*sourcev1.OCIRepositoryList
|
||||
}
|
||||
|
||||
func (a ociRepositoryListAdapter) asClientList() client.ObjectList {
|
||||
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
"github.com/fluxcd/flux2/v2/pkg/printers"
|
||||
@@ -82,9 +81,9 @@ func runStatsCmd(cmd *cobra.Command, args []string) error {
|
||||
Group: sourcev1.GroupVersion.Group,
|
||||
},
|
||||
{
|
||||
Kind: sourcev1b2.OCIRepositoryKind,
|
||||
Version: sourcev1b2.GroupVersion.Version,
|
||||
Group: sourcev1b2.GroupVersion.Group,
|
||||
Kind: sourcev1.OCIRepositoryKind,
|
||||
Version: sourcev1.GroupVersion.Version,
|
||||
Group: sourcev1.GroupVersion.Group,
|
||||
},
|
||||
{
|
||||
Kind: sourcev1.HelmRepositoryKind,
|
||||
|
||||
@@ -19,7 +19,7 @@ package main
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
)
|
||||
|
||||
var suspendSourceOCIRepositoryCmd = &cobra.Command{
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/flags"
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ spec:
|
||||
kind: HelmRepository
|
||||
name: podinfo
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
2
cmd/flux/testdata/oci/export.golden
vendored
2
cmd/flux/testdata/oci/export.golden
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
name: podinfo
|
||||
|
||||
@@ -54,7 +54,7 @@ status:
|
||||
type: Ready
|
||||
lastAttemptedRevision: 6.3.5
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
labels:
|
||||
|
||||
2
cmd/flux/testdata/trace/helmrelease-oci.yaml
vendored
2
cmd/flux/testdata/trace/helmrelease-oci.yaml
vendored
@@ -59,7 +59,7 @@ status:
|
||||
type: Ready
|
||||
lastAppliedRevision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
labels:
|
||||
|
||||
@@ -38,7 +38,6 @@ import (
|
||||
fluxmeta "github.com/fluxcd/pkg/apis/meta"
|
||||
"github.com/fluxcd/pkg/oci"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
)
|
||||
@@ -223,7 +222,7 @@ func traceKustomization(ctx context.Context, kubeClient client.Client, ksName ty
|
||||
ksReady := meta.FindStatusCondition(ks.Status.Conditions, fluxmeta.ReadyCondition)
|
||||
|
||||
var gitRepository *sourcev1.GitRepository
|
||||
var ociRepository *sourcev1b2.OCIRepository
|
||||
var ociRepository *sourcev1.OCIRepository
|
||||
var ksRepositoryReady *metav1.Condition
|
||||
switch ks.Spec.SourceRef.Kind {
|
||||
case sourcev1.GitRepositoryKind:
|
||||
@@ -240,8 +239,8 @@ func traceKustomization(ctx context.Context, kubeClient client.Client, ksName ty
|
||||
return "", fmt.Errorf("failed to find GitRepository: %w", err)
|
||||
}
|
||||
ksRepositoryReady = meta.FindStatusCondition(gitRepository.Status.Conditions, fluxmeta.ReadyCondition)
|
||||
case sourcev1b2.OCIRepositoryKind:
|
||||
ociRepository = &sourcev1b2.OCIRepository{}
|
||||
case sourcev1.OCIRepositoryKind:
|
||||
ociRepository = &sourcev1.OCIRepository{}
|
||||
sourceNamespace := ks.Namespace
|
||||
if ks.Spec.SourceRef.Namespace != "" {
|
||||
sourceNamespace = ks.Spec.SourceRef.Namespace
|
||||
@@ -348,7 +347,7 @@ Status: Unknown
|
||||
Kustomization *kustomizev1.Kustomization
|
||||
KustomizationReady *metav1.Condition
|
||||
GitRepository *sourcev1.GitRepository
|
||||
OCIRepository *sourcev1b2.OCIRepository
|
||||
OCIRepository *sourcev1.OCIRepository
|
||||
RepositoryReady *metav1.Condition
|
||||
Annotations map[string]string
|
||||
}{
|
||||
@@ -403,13 +402,13 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names
|
||||
var hrGitRepositoryReady *metav1.Condition
|
||||
var hrHelmRepository *sourcev1.HelmRepository
|
||||
var hrHelmRepositoryReady *metav1.Condition
|
||||
var hrOCIRepository *sourcev1b2.OCIRepository
|
||||
var hrOCIRepository *sourcev1.OCIRepository
|
||||
var hrOCIRepositoryReady *metav1.Condition
|
||||
if hr.Spec.Chart == nil {
|
||||
if hr.Spec.ChartRef != nil {
|
||||
switch hr.Spec.ChartRef.Kind {
|
||||
case sourcev1b2.OCIRepositoryKind:
|
||||
hrOCIRepository = &sourcev1b2.OCIRepository{}
|
||||
case sourcev1.OCIRepositoryKind:
|
||||
hrOCIRepository = &sourcev1.OCIRepository{}
|
||||
sourceNamespace := hr.Namespace
|
||||
if hr.Spec.ChartRef.Namespace != "" {
|
||||
sourceNamespace = hr.Spec.ChartRef.Namespace
|
||||
@@ -583,7 +582,7 @@ Status: Unknown
|
||||
GitRepositoryReady *metav1.Condition
|
||||
HelmRepository *sourcev1.HelmRepository
|
||||
HelmRepositoryReady *metav1.Condition
|
||||
OCIRepository *sourcev1b2.OCIRepository
|
||||
OCIRepository *sourcev1.OCIRepository
|
||||
OCIRepositoryReady *metav1.Condition
|
||||
Annotations map[string]string
|
||||
}{
|
||||
|
||||
@@ -21,12 +21,11 @@ import (
|
||||
"strings"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
)
|
||||
|
||||
var supportedKustomizationSourceKinds = []string{sourcev1b2.OCIRepositoryKind, sourcev1.GitRepositoryKind, sourcev1.BucketKind}
|
||||
var supportedKustomizationSourceKinds = []string{sourcev1.OCIRepositoryKind, sourcev1.GitRepositoryKind, sourcev1.BucketKind}
|
||||
|
||||
type KustomizationSource struct {
|
||||
Kind string
|
||||
|
||||
@@ -20,8 +20,9 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
var supportedSourceOCIProviders = []string{
|
||||
|
||||
@@ -51,7 +51,6 @@ import (
|
||||
runclient "github.com/fluxcd/pkg/runtime/client"
|
||||
"github.com/fluxcd/pkg/version"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/pkg/manifestgen/install"
|
||||
)
|
||||
@@ -128,7 +127,6 @@ func NewScheme() *apiruntime.Scheme {
|
||||
_ = rbacv1.AddToScheme(scheme)
|
||||
_ = appsv1.AddToScheme(scheme)
|
||||
_ = networkingv1.AddToScheme(scheme)
|
||||
_ = sourcev1b2.AddToScheme(scheme)
|
||||
_ = sourcev1.AddToScheme(scheme)
|
||||
_ = kustomizev1.AddToScheme(scheme)
|
||||
_ = helmv2.AddToScheme(scheme)
|
||||
|
||||
@@ -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) {
|
||||
var rev string
|
||||
switch kind {
|
||||
case sourcev1.GitRepositoryKind, sourcev1b2.OCIRepositoryKind, sourcev1.BucketKind, sourcev1.HelmChartKind:
|
||||
case sourcev1.GitRepositoryKind, sourcev1.OCIRepositoryKind, sourcev1.BucketKind, sourcev1.HelmChartKind:
|
||||
rev, _, _ = unstructured.NestedString(obj, "status", "artifact", "revision")
|
||||
case kustomizev1.KustomizationKind:
|
||||
rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision")
|
||||
|
||||
@@ -27,11 +27,11 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/internal/utils"
|
||||
)
|
||||
|
||||
func Test_hasRevision(t *testing.T) {
|
||||
@@ -98,11 +98,11 @@ func Test_hasRevision(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "OCIRepository revision",
|
||||
obj: &sourcev1b2.OCIRepository{
|
||||
obj: &sourcev1.OCIRepository{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: sourcev1b2.OCIRepositoryKind,
|
||||
Kind: sourcev1.OCIRepositoryKind,
|
||||
},
|
||||
Status: sourcev1b2.OCIRepositoryStatus{
|
||||
Status: sourcev1.OCIRepositoryStatus{
|
||||
Artifact: &sourcev1.Artifact{
|
||||
Revision: "main@sha1:5bf3a8f9bb0aa5ae8afd6208f43757ab73fc033a",
|
||||
},
|
||||
|
||||
@@ -35,7 +35,6 @@ import (
|
||||
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
|
||||
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/v2/pkg/log"
|
||||
"github.com/fluxcd/flux2/v2/pkg/manifestgen"
|
||||
@@ -154,7 +153,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client
|
||||
}
|
||||
}
|
||||
{
|
||||
var list sourcev1b2.OCIRepositoryList
|
||||
var list sourcev1.OCIRepositoryList
|
||||
if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
|
||||
for i := range list.Items {
|
||||
r := list.Items[i]
|
||||
|
||||
@@ -38,7 +38,6 @@ import (
|
||||
notiv1beta3 "github.com/fluxcd/notification-controller/api/v1beta3"
|
||||
"github.com/fluxcd/pkg/git"
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1"
|
||||
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/fluxcd/test-infra/tftestenv"
|
||||
)
|
||||
|
||||
@@ -165,7 +164,6 @@ type providerConfig struct {
|
||||
|
||||
func init() {
|
||||
utilruntime.Must(sourcev1.AddToScheme(scheme.Scheme))
|
||||
utilruntime.Must(sourcev1beta2.AddToScheme(scheme.Scheme))
|
||||
utilruntime.Must(kustomizev1.AddToScheme(scheme.Scheme))
|
||||
utilruntime.Must(helmv2.AddToScheme(scheme.Scheme))
|
||||
utilruntime.Must(reflectorv1.AddToScheme(scheme.Scheme))
|
||||
|
||||
Reference in New Issue
Block a user