|
|
|
@ -30,7 +30,8 @@ import (
|
|
|
|
|
|
|
|
|
|
"github.com/fluxcd/pkg/apis/meta"
|
|
|
|
|
|
|
|
|
|
sourcev1 "github.com/fluxcd/source-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/flags"
|
|
|
|
|
"github.com/fluxcd/flux2/v2/internal/utils"
|
|
|
|
@ -79,7 +80,7 @@ var sourceOCIRepositoryArgs = newSourceOCIFlags()
|
|
|
|
|
|
|
|
|
|
func newSourceOCIFlags() sourceOCIRepositoryFlags {
|
|
|
|
|
return sourceOCIRepositoryFlags{
|
|
|
|
|
provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
|
|
|
|
|
provider: flags.SourceOCIProvider(sourcev1b2.GenericOCIProvider),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -124,20 +125,20 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
|
|
|
|
|
ignorePaths = &ignorePathsStr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
repository := &sourcev1.OCIRepository{
|
|
|
|
|
repository := &sourcev1b2.OCIRepository{
|
|
|
|
|
ObjectMeta: metav1.ObjectMeta{
|
|
|
|
|
Name: name,
|
|
|
|
|
Namespace: *kubeconfigArgs.Namespace,
|
|
|
|
|
Labels: sourceLabels,
|
|
|
|
|
},
|
|
|
|
|
Spec: sourcev1.OCIRepositorySpec{
|
|
|
|
|
Spec: sourcev1b2.OCIRepositorySpec{
|
|
|
|
|
Provider: sourceOCIRepositoryArgs.provider.String(),
|
|
|
|
|
URL: sourceOCIRepositoryArgs.url,
|
|
|
|
|
Insecure: sourceOCIRepositoryArgs.insecure,
|
|
|
|
|
Interval: metav1.Duration{
|
|
|
|
|
Duration: createArgs.interval,
|
|
|
|
|
},
|
|
|
|
|
Reference: &sourcev1.OCIRepositoryRef{},
|
|
|
|
|
Reference: &sourcev1b2.OCIRepositoryRef{},
|
|
|
|
|
Ignore: ignorePaths,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
@ -228,13 +229,13 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func upsertOCIRepository(ctx context.Context, kubeClient client.Client,
|
|
|
|
|
ociRepository *sourcev1.OCIRepository) (types.NamespacedName, error) {
|
|
|
|
|
ociRepository *sourcev1b2.OCIRepository) (types.NamespacedName, error) {
|
|
|
|
|
namespacedName := types.NamespacedName{
|
|
|
|
|
Namespace: ociRepository.GetNamespace(),
|
|
|
|
|
Name: ociRepository.GetName(),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var existing sourcev1.OCIRepository
|
|
|
|
|
var existing sourcev1b2.OCIRepository
|
|
|
|
|
err := kubeClient.Get(ctx, namespacedName, &existing)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if errors.IsNotFound(err) {
|
|
|
|
|