From fbc4c39a7f3662e9b75aa06954e09f9df0586084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyrill=20N=C3=A4f?= Date: Tue, 10 Dec 2024 12:05:24 +0000 Subject: [PATCH] Promote ManagementPolicies to beta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cyrill Näf --- cmd/provider/main.go | 4 ++-- pkg/controller/groups/accesstokens/controller.go | 5 ++--- pkg/controller/groups/deploytokens/controller.go | 4 ++-- pkg/controller/groups/groups/group.go | 3 ++- pkg/controller/groups/members/controller.go | 7 ++++--- pkg/controller/groups/samlgrouplinks/controller.go | 4 ++-- pkg/controller/groups/variables/controller.go | 5 ++--- pkg/controller/projects/accesstokens/controller.go | 5 ++--- pkg/controller/projects/deploykeys/controller.go | 10 ++-------- pkg/controller/projects/deploytokens/controller.go | 5 ++--- pkg/controller/projects/hooks/controller.go | 6 ++---- pkg/controller/projects/members/controller.go | 4 ++-- .../projects/pipelineschedules/controller.go | 10 ++++------ pkg/controller/projects/projects/project.go | 3 ++- pkg/controller/projects/variables/controller.go | 5 ++--- pkg/features/features.go | 5 ----- 16 files changed, 34 insertions(+), 51 deletions(-) diff --git a/cmd/provider/main.go b/cmd/provider/main.go index e2cd2b71..1e2b4fd2 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -144,8 +144,8 @@ func main() { } if *enableManagementPolicies { - o.Features.Enable(features.EnableAlphaManagementPolicies) - log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + o.Features.Enable(feature.EnableBetaManagementPolicies) + log.Info("Beta feature enabled", "flag", feature.EnableBetaManagementPolicies) } kingpin.FatalIfError(controller.Setup(mgr, o), "Cannot setup Gitlab controllers") diff --git a/pkg/controller/groups/accesstokens/controller.go b/pkg/controller/groups/accesstokens/controller.go index de012d46..a4adc029 100644 --- a/pkg/controller/groups/accesstokens/controller.go +++ b/pkg/controller/groups/accesstokens/controller.go @@ -25,6 +25,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -72,7 +73,7 @@ func SetupAccessToken(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -168,7 +169,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext groups.GenerateCreateGroupAccessTokenOptions(cr.Name, &cr.Spec.ForProvider), gitlab.WithContext(ctx), ) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } @@ -193,7 +193,6 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) (managed.Ext } accessTokenID, err := strconv.Atoi(meta.GetExternalName(cr)) - if err != nil { return managed.ExternalDelete{}, errors.New(errExternalNameNotInt) } diff --git a/pkg/controller/groups/deploytokens/controller.go b/pkg/controller/groups/deploytokens/controller.go index 1e434efe..d6c02f98 100644 --- a/pkg/controller/groups/deploytokens/controller.go +++ b/pkg/controller/groups/deploytokens/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -69,7 +70,7 @@ func SetupDeployToken(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -190,7 +191,6 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) (managed.Ext } deployTokenID, err := strconv.Atoi(meta.GetExternalName(cr)) - if err != nil { return managed.ExternalDelete{}, errors.New(errNotDeployToken) } diff --git a/pkg/controller/groups/groups/group.go b/pkg/controller/groups/groups/group.go index 922bdfbb..8c37e5fe 100644 --- a/pkg/controller/groups/groups/group.go +++ b/pkg/controller/groups/groups/group.go @@ -26,6 +26,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -76,7 +77,7 @@ func SetupGroup(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } diff --git a/pkg/controller/groups/members/controller.go b/pkg/controller/groups/members/controller.go index b2c34449..20988bdb 100644 --- a/pkg/controller/groups/members/controller.go +++ b/pkg/controller/groups/members/controller.go @@ -20,6 +20,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/statemetrics" @@ -62,7 +63,8 @@ func SetupMember(mgr ctrl.Manager, o controller.Options) error { managed.WithExternalConnecter(&connector{ kube: mgr.GetClient(), newGitlabClientFn: groups.NewMemberClient, - newUserClientFn: users.NewUserClient}), + newUserClientFn: users.NewUserClient, + }), managed.WithInitializers(), managed.WithPollInterval(o.PollInterval), managed.WithLogger(o.Logger.WithValues("controller", name)), @@ -70,7 +72,7 @@ func SetupMember(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -231,7 +233,6 @@ func (e *external) Disconnect(ctx context.Context) error { // isMemberUpToDate checks whether there is a change in any of the modifiable fields. func isMemberUpToDate(p *v1alpha1.MemberParameters, g *gitlab.GroupMember) bool { - if !cmp.Equal(int(p.AccessLevel), int(g.AccessLevel)) { return false } diff --git a/pkg/controller/groups/samlgrouplinks/controller.go b/pkg/controller/groups/samlgrouplinks/controller.go index a3883c2e..869b122e 100644 --- a/pkg/controller/groups/samlgrouplinks/controller.go +++ b/pkg/controller/groups/samlgrouplinks/controller.go @@ -23,6 +23,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -67,7 +68,7 @@ func SetupSamlGroupLink(mgr ctrl.Manager, o controller.Options) error { managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -126,7 +127,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex } groupLink, _, err := e.client.GetGroupSAMLLink(*cr.Spec.ForProvider.GroupID, samlGroupName) - if err != nil { return managed.ExternalObservation{}, errors.Wrap(resource.Ignore(groups.IsErrorSamlGroupLinkNotFound, err), errGetFailed) } diff --git a/pkg/controller/groups/variables/controller.go b/pkg/controller/groups/variables/controller.go index 1e456637..4890d37a 100644 --- a/pkg/controller/groups/variables/controller.go +++ b/pkg/controller/groups/variables/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/statemetrics" @@ -70,7 +71,7 @@ func SetupVariable(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -124,7 +125,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex *cr.Spec.ForProvider.GroupID, cr.Spec.ForProvider.Key, gitlab.WithContext(ctx)) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil @@ -170,7 +170,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext *cr.Spec.ForProvider.GroupID, groups.GenerateCreateVariableOptions(&cr.Spec.ForProvider), gitlab.WithContext(ctx)) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } diff --git a/pkg/controller/projects/accesstokens/controller.go b/pkg/controller/projects/accesstokens/controller.go index 199bebc8..4d9d19db 100644 --- a/pkg/controller/projects/accesstokens/controller.go +++ b/pkg/controller/projects/accesstokens/controller.go @@ -25,6 +25,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -72,7 +73,7 @@ func SetupAccessToken(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -168,7 +169,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext projects.GenerateCreateProjectAccessTokenOptions(cr.Name, &cr.Spec.ForProvider), gitlab.WithContext(ctx), ) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } @@ -193,7 +193,6 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) (managed.Ext } accessTokenID, err := strconv.Atoi(meta.GetExternalName(cr)) - if err != nil { return managed.ExternalDelete{}, errors.New(errExternalNameNotInt) } diff --git a/pkg/controller/projects/deploykeys/controller.go b/pkg/controller/projects/deploykeys/controller.go index ba4aea08..33cb2c5a 100644 --- a/pkg/controller/projects/deploykeys/controller.go +++ b/pkg/controller/projects/deploykeys/controller.go @@ -8,6 +8,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" crpc "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -68,7 +69,7 @@ func SetupDeployKey(mgr ctrl.Manager, o crpc.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -95,7 +96,6 @@ func (c *connector) Connect(ctx context.Context, mgd resource.Managed) (managed. } config, err := clients.GetConfig(ctx, c.kube, cr) - if err != nil { return nil, err } @@ -115,7 +115,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex } id, err := strconv.Atoi(meta.GetExternalName(cr)) - if err != nil { return managed.ExternalObservation{}, errors.New(errIDNotAnInt) } @@ -124,7 +123,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex *cr.Spec.ForProvider.ProjectID, id, ) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil @@ -171,7 +169,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext secret := &corev1.Secret{} err := e.kube.Get(ctx, namespacedName, secret) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errKeyMissing) @@ -182,7 +179,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext generateCreateOptions(string(secret.Data[keySecretRef.Key]), &cr.Spec.ForProvider), gitlab.WithContext(ctx), ) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFail) } @@ -206,7 +202,6 @@ func (e *external) Update(ctx context.Context, mg resource.Managed) (managed.Ext idString := meta.GetExternalName(cr) id, err := strconv.Atoi(idString) - if err != nil { return managed.ExternalUpdate{}, errors.Wrap(err, errIDNotAnInt) } @@ -233,7 +228,6 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) (managed.Ext keyIDString := meta.GetExternalName(cr) keyID, err := strconv.Atoi(keyIDString) - if err != nil { return managed.ExternalDelete{}, errors.Wrap(err, errIDNotAnInt) } diff --git a/pkg/controller/projects/deploytokens/controller.go b/pkg/controller/projects/deploytokens/controller.go index 85682d88..a3f2a1a9 100644 --- a/pkg/controller/projects/deploytokens/controller.go +++ b/pkg/controller/projects/deploytokens/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -69,7 +70,7 @@ func SetupDeployToken(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -131,7 +132,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex } dt, res, err := e.client.GetProjectDeployToken(*cr.Spec.ForProvider.ProjectID, id) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil @@ -166,7 +166,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext projects.GenerateCreateProjectDeployTokenOptions(cr.Name, &cr.Spec.ForProvider), gitlab.WithContext(ctx), ) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } diff --git a/pkg/controller/projects/hooks/controller.go b/pkg/controller/projects/hooks/controller.go index f40bc119..0801aa7d 100644 --- a/pkg/controller/projects/hooks/controller.go +++ b/pkg/controller/projects/hooks/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -70,7 +71,7 @@ func SetupHook(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -160,13 +161,11 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext cr.Status.SetConditions(xpv1.Creating()) hookOptions, err := projects.GenerateCreateHookOptions(&cr.Spec.ForProvider, e.kube, ctx) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errSecretRefInvalid) } hook, _, err := e.client.AddProjectHook(*cr.Spec.ForProvider.ProjectID, hookOptions, gitlab.WithContext(ctx)) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } @@ -190,7 +189,6 @@ func (e *external) Update(ctx context.Context, mg resource.Managed) (managed.Ext } editHookOptions, err := projects.GenerateEditHookOptions(&cr.Spec.ForProvider, e.kube, ctx) - if err != nil { return managed.ExternalUpdate{}, errors.New(errSecretRefInvalid) } diff --git a/pkg/controller/projects/members/controller.go b/pkg/controller/projects/members/controller.go index a4579143..7a745dbe 100644 --- a/pkg/controller/projects/members/controller.go +++ b/pkg/controller/projects/members/controller.go @@ -20,6 +20,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/statemetrics" @@ -70,7 +71,7 @@ func SetupMember(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -138,7 +139,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex *cr.Spec.ForProvider.ProjectID, *cr.Spec.ForProvider.UserID, ) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil diff --git a/pkg/controller/projects/pipelineschedules/controller.go b/pkg/controller/projects/pipelineschedules/controller.go index c33e41f3..2fb080c2 100644 --- a/pkg/controller/projects/pipelineschedules/controller.go +++ b/pkg/controller/projects/pipelineschedules/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -74,7 +75,7 @@ func SetupPipelineSchedule(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -143,7 +144,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex } ps, res, err := e.client.GetPipelineSchedule(*cr.Spec.ForProvider.ProjectID, id) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil @@ -183,7 +183,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext } ps, _, err := e.client.CreatePipelineSchedule(*cr.Spec.ForProvider.ProjectID, opt) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreatePipelineSchedule) } @@ -240,7 +239,6 @@ func (e *external) Update(ctx context.Context, mg resource.Managed) (managed.Ext id, opt, ) - if err != nil { return managed.ExternalUpdate{}, errors.Wrap(err, errUpdatePipelineSchedule) } @@ -348,7 +346,8 @@ func lateInitialize(cr *v1alpha1.PipelineScheduleParameters, ps *gitlab.Pipeline varr[i] = v1alpha1.PipelineVariable{ Key: vv.Key, Value: vv.Value, - VariableType: (*string)(&vv.VariableType)} + VariableType: (*string)(&vv.VariableType), + } } cr.Variables = varr } @@ -379,7 +378,6 @@ func isVariablesUpToDate(crv []v1alpha1.PipelineVariable, inv []*gitlab.Pipeline return false } for _, v := range crv { - if notSaved(v, inv) { return false } diff --git a/pkg/controller/projects/projects/project.go b/pkg/controller/projects/projects/project.go index ab91ad4d..1ca2bd1e 100644 --- a/pkg/controller/projects/projects/project.go +++ b/pkg/controller/projects/projects/project.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/connection" "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/meta" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" @@ -69,7 +70,7 @@ func SetupProject(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } diff --git a/pkg/controller/projects/variables/controller.go b/pkg/controller/projects/variables/controller.go index 796fd2aa..b9fe01c3 100644 --- a/pkg/controller/projects/variables/controller.go +++ b/pkg/controller/projects/variables/controller.go @@ -24,6 +24,7 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/controller" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/feature" "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/crossplane-runtime/pkg/statemetrics" @@ -70,7 +71,7 @@ func SetupVariable(mgr ctrl.Manager, o controller.Options) error { managed.WithConnectionPublishers(cps...), } - if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { reconcilerOpts = append(reconcilerOpts, managed.WithManagementPolicies()) } @@ -125,7 +126,6 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex cr.Spec.ForProvider.Key, projects.GenerateGetVariableOptions(&cr.Spec.ForProvider), gitlab.WithContext(ctx)) - if err != nil { if clients.IsResponseNotFound(res) { return managed.ExternalObservation{}, nil @@ -171,7 +171,6 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext *cr.Spec.ForProvider.ProjectID, projects.GenerateCreateVariableOptions(&cr.Spec.ForProvider), gitlab.WithContext(ctx)) - if err != nil { return managed.ExternalCreation{}, errors.Wrap(err, errCreateFailed) } diff --git a/pkg/features/features.go b/pkg/features/features.go index 4ec66f24..8ab0c0bb 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -24,9 +24,4 @@ const ( // External Secret Stores. See the below design for more details. // https://github.com/crossplane/crossplane/blob/390ddd/design/design-doc-external-secret-stores.md EnableAlphaExternalSecretStores feature.Flag = "EnableAlphaExternalSecretStores" - - // EnableAlphaManagementPolicies enables alpha support for - // Management Policies. See the below design for more details. - // https://github.com/crossplane/crossplane/pull/3531 - EnableAlphaManagementPolicies feature.Flag = "EnableAlphaManagementPolicies" )