1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Promote bucket commands to GA

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2024-09-27 16:33:47 +03:00
parent 0d101e0e36
commit c7daf6466f
23 changed files with 72 additions and 73 deletions

View File

@@ -32,7 +32,7 @@ import (
"github.com/fluxcd/pkg/apis/meta"
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/internal/utils"
@@ -41,8 +41,8 @@ import (
var createSourceBucketCmd = &cobra.Command{
Use: "bucket [name]",
Short: "Create or update a Bucket source",
Long: withPreviewNote(`The create source bucket command generates a Bucket resource and waits for it to be downloaded.
For Buckets with static authentication, the credentials are stored in a Kubernetes secret.`),
Long: `The create source bucket command generates a Bucket resource and waits for it to be downloaded.
For Buckets with static authentication, the credentials are stored in a Kubernetes secret.`,
Example: ` # Create a source for a Bucket using static authentication
flux create source bucket podinfo \
--bucket-name=podinfo \
@@ -92,7 +92,7 @@ func init() {
func newSourceBucketFlags() sourceBucketFlags {
return sourceBucketFlags{
provider: flags.SourceBucketProvider(sourcev1.GenericBucketProvider),
provider: flags.SourceBucketProvider(sourcev1.BucketProviderGeneric),
}
}

View File

@@ -19,13 +19,13 @@ package main
import (
"github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
)
var deleteSourceBucketCmd = &cobra.Command{
Use: "bucket [name]",
Short: "Delete a Bucket source",
Long: withPreviewNote("The delete source bucket command deletes the given Bucket from the cluster."),
Long: "The delete source bucket command deletes the given Bucket from the cluster.",
Example: ` # Delete a Bucket source
flux delete source bucket podinfo`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)),

View File

@@ -447,7 +447,7 @@ var fluxKindMap = refMap{
},
sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)},
sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)},
sourcev1b2.BucketKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.BucketKind)},
sourcev1.BucketKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)},
sourcev1.HelmRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)},
autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)},
imagev1.ImageRepositoryKind: {gvk: imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)},

View File

@@ -21,13 +21,13 @@ 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 exportSourceBucketCmd = &cobra.Command{
Use: "bucket [name]",
Short: "Export Bucket sources in YAML format",
Long: withPreviewNote("The export source git command exports one or all Bucket sources in YAML format."),
Long: "The export source git command exports one or all Bucket sources in YAML format.",
Example: ` # Export all Bucket sources
flux export source bucket --all > sources.yaml

View File

@@ -46,7 +46,7 @@ var getSourceAllCmd = &cobra.Command{
},
{
apiType: bucketType,
list: &bucketListAdapter{&sourcev1b2.BucketList{}},
list: &bucketListAdapter{&sourcev1.BucketList{}},
},
{
apiType: gitRepositoryType,

View File

@@ -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"
)
@@ -33,7 +33,7 @@ import (
var getSourceBucketCmd = &cobra.Command{
Use: "bucket",
Short: "Get Bucket source statuses",
Long: withPreviewNote("The get sources bucket command prints the status of the Bucket sources."),
Long: "The get sources bucket command prints the status of the Bucket sources.",
Example: ` # List all Buckets and their status
flux get sources bucket

View File

@@ -76,10 +76,10 @@ func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedNa
apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
}
case sourcev1b2.BucketKind:
case sourcev1.BucketKind:
cmd = reconcileCommand{
apiType: bucketType,
object: bucketAdapter{&sourcev1b2.Bucket{}},
object: bucketAdapter{&sourcev1.Bucket{}},
}
}

View File

@@ -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 reconcileSourceBucketCmd = &cobra.Command{

View File

@@ -21,7 +21,6 @@ import (
"k8s.io/apimachinery/pkg/types"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
)
var reconcileSourceHelmChartCmd = &cobra.Command{
@@ -72,10 +71,10 @@ func (obj helmChartAdapter) getSource() (reconcileSource, types.NamespacedName)
apiType: gitRepositoryType,
object: gitRepositoryAdapter{&sourcev1.GitRepository{}},
}
case sourcev1b2.BucketKind:
case sourcev1.BucketKind:
cmd = reconcileCommand{
apiType: bucketType,
object: bucketAdapter{&sourcev1b2.Bucket{}},
object: bucketAdapter{&sourcev1.Bucket{}},
}
}

View File

@@ -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 resumeSourceBucketCmd = &cobra.Command{

View File

@@ -61,16 +61,16 @@ func (a ociRepositoryListAdapter) len() int {
return len(a.OCIRepositoryList.Items)
}
// sourcev1b2.Bucket
// sourcev1.Bucket
var bucketType = apiType{
kind: sourcev1b2.BucketKind,
kind: sourcev1.BucketKind,
humanKind: "source bucket",
groupVersion: sourcev1b2.GroupVersion,
groupVersion: sourcev1.GroupVersion,
}
type bucketAdapter struct {
*sourcev1b2.Bucket
*sourcev1.Bucket
}
func (a bucketAdapter) asClientObject() client.Object {
@@ -81,10 +81,10 @@ func (a bucketAdapter) deepCopyClientObject() client.Object {
return a.Bucket.DeepCopy()
}
// sourcev1b2.BucketList
// sourcev1.BucketList
type bucketListAdapter struct {
*sourcev1b2.BucketList
*sourcev1.BucketList
}
func (a bucketListAdapter) asClientList() client.ObjectList {

View File

@@ -97,9 +97,9 @@ func runStatsCmd(cmd *cobra.Command, args []string) error {
Group: sourcev1.GroupVersion.Group,
},
{
Kind: sourcev1b2.BucketKind,
Version: sourcev1b2.GroupVersion.Version,
Group: sourcev1b2.GroupVersion.Group,
Kind: sourcev1.BucketKind,
Version: sourcev1.GroupVersion.Version,
Group: sourcev1.GroupVersion.Group,
},
{
Kind: kustomizev1.KustomizationKind,

View File

@@ -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 suspendSourceBucketCmd = &cobra.Command{

View File

@@ -1,5 +1,5 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: Bucket
metadata:
name: flux-system

View File

@@ -153,7 +153,7 @@ spec:
name: flux-systen
namespace: {{ .fluxns }}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
apiVersion: source.toolkit.fluxcd.io/v1
kind: Bucket
metadata:
name: flux-system