crossplane-contrib / provider-gitlab

Crossplane Gitlab provider
Apache License 2.0
54 stars 26 forks source link

Crossplane 1.15 trying to use Management Policies #136

Closed jwhitcraft closed 2 months ago

jwhitcraft commented 2 months ago

What happened?

I'm trying to import a gitlab group so it can be utilized by references

apiVersion: groups.gitlab.crossplane.io/v1alpha1
kind: Group
metadata:
  name: zys
  annotations:
    crossplane.io/external-name: 'zys'
spec:
  managementPolicies: ['Observe']
  forProvider:
    path: 'xyz/zys'

But it get this status:

atProvider: {}
conditions:
  - lastTransitionTime: 2024-04-25T12:20:39Z
    message: "`spec.managementPolicies` is set to a non-default value but the
      feature is not enabled: [Observe]"
    reason: ReconcileError
    status: "False"
    type: Synced

I believe that is caused by the Gitlab still using the EnableAlphaManagementPolicies instead of the EnableBetaManagementPolicies now that it's gone into Beta.

How can we reproduce it?

Try and import an existing group with the Observe managementPolicy set.

What environment did it happen in?

Crossplane version: 1.15.2 Crossplane Provider GitLab version: 0.6.1

$ kubectl version Client Version: v1.30.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.3-eks-adc7111

MisterMX commented 2 months ago

Alpha features need to be enabled by running the provider with --enable-management-policies. Have you tried that?

jwhitcraft commented 2 months ago

~I have not and, i'm not sure where to put that as i don't see a field in providerConfig for gitlab to put that.~

Ok i found out how to do with the DeploymentRuntimeConfig

# The secret used here was created on the cli, the token is stored in LastPass
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: gitlab-runtime
spec:
  deploymentTemplate:
    spec:
      selector:
        matchLabels:
          pkg.crossplane.io/provider: provider-gitlab
      template:
        spec:
          containers:
            - name: package-runtime
              args:
                - --enable-management-policies
MisterMX commented 2 months ago

ProviderConfigs are only used to configure the connectivity of the individual controllers to the external. Runtime configurations are passed as CLI arguments when starting the provider.

Closing this, since the issue seems to be solved.