Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDB Instance matchLabels does not work #86

Open
MicheleSica opened this issue Aug 1, 2024 · 0 comments
Open

RDB Instance matchLabels does not work #86

MicheleSica opened this issue Aug 1, 2024 · 0 comments
Assignees
Labels
bug Something isn't working priority:highest Bugs filled by customers, security issues rdb Managed MySQL and PostgreSQL issues, bugs and feature requests

Comments

@MicheleSica
Copy link

MicheleSica commented Aug 1, 2024

Dear Support,

this is the follow up of the issue: #78

The below Crossplane code creates the objects Instance and Database in the "Managed Databases" Scaleway section

apiVersion: rdb.scaleway.upbound.io/v1alpha1
kind: Database
metadata:
  name: rdb-database
spec:
  forProvider:
    instanceIdRef:
      name: rdb-instance
    name: crossplane-rdb-database
  providerConfigRef:
    name: crossplane   
---
apiVersion: rdb.scaleway.upbound.io/v1alpha1
kind: Instance
metadata:
  name: rdb-instance
spec:
  forProvider:
    disableBackup: true
    engine: PostgreSQL-14
    isHaCluster: false
    name: crossplane-rdb-instance
    nodeType: DB-DEV-S
    passwordSecretRef:
      key: password
      name: instance-secret
      namespace: crossplane
    userName: admin
  providerConfigRef:
    name: crossplane

The status of the Crossplane objects after the creation:

➜  ~ kubectl get instance
NAME           SYNCED   READY   EXTERNAL-NAME                                         AGE
rdb-instance   True     True          ***                                             7m13s
➜  ~ kubectl get database
NAME           SYNCED   READY   EXTERNAL-NAME                                         AGE
rdb-database   True     True          ***/crossplane-rdb-database                     7m45s

Checking the documentation https://marketplace.upbound.io/providers/scaleway/provider-scaleway/v0.3.0/resources/rdb.scaleway.upbound.io/Instance/v1alpha1

I have added this code on the instance definition to link the database to the Private Network

    privateNetwork:
      - pnIdSelector:
          matchLabels:
            crossplane: network

The label crossplane: network has been added at the PrivateNetwork creation, this is the manifest of PrivateNetwork object:

apiVersion: vpc.scaleway.upbound.io/v1alpha1
kind: PrivateNetwork
metadata:
  annotations:
....
  finalizers:
  - finalizer.managedresource.crossplane.io
  generation: 3
  labels:
    argocd.argoproj.io/instance: crossplane
    crossplane: network

This is the updated instance manifest to link the Database to the PrivateNetwork

apiVersion: rdb.scaleway.upbound.io/v1alpha1
kind: Instance
metadata:
  name: rdb-instance
spec:
  forProvider:
    disableBackup: true
    engine: PostgreSQL-14
    isHaCluster: false
    name: crossplane-rdb-instance
    nodeType: DB-DEV-S
    passwordSecretRef:
      key: password
      name: instance-secret
      namespace: crossplane
    privateNetwork:
      - pnIdSelector:
          matchLabels:
            crossplane: network
    userName: admin
  providerConfigRef:
    name: crossplane

After creating the objects on Crossplane, it attempted to create the managed database but encountered this error:

Events:
  Type     Reason                           Age                   From                                                     Message
  ----     ------                           ----                  ----                                                     -------
  Warning  CannotResolveResourceReferences  46m                   managed/rdb.scaleway.upbound.io/v1alpha1, kind=database  cannot resolve references: mg.Spec.ForProvider.InstanceID: cannot get referenced resource: Instance.rdb.scaleway.upbound.io "rdb-instance" not found
  Warning  CannotResolveResourceReferences  35m (x16 over 46m)    managed/rdb.scaleway.upbound.io/v1alpha1, kind=database  cannot resolve references: mg.Spec.ForProvider.InstanceID: referenced field was empty (referenced resource may not yet be ready)

The Spec.ForProvider.InstanceID reported in the error is not a mandatory string:
https://marketplace.upbound.io/providers/scaleway/provider-scaleway/v0.3.0/resources/rdb.scaleway.upbound.io/Database/v1alpha1#doc:spec-forProvider-instanceId

This is the database state after the creation attempt

➜  ~ kubectl get database
NAME           SYNCED   READY   EXTERNAL-NAME   AGE
rdb-database   False                                                     62m

➜  ~ kubectl get instance
NAME           SYNCED   READY   EXTERNAL-NAME   AGE
rdb-instance   False    False                                          63m

Could you kindly check?

Thanks in advance

@Laure-di Laure-di added rdb Managed MySQL and PostgreSQL issues, bugs and feature requests bug Something isn't working labels Oct 28, 2024
@remyleone remyleone added the priority:highest Bugs filled by customers, security issues label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:highest Bugs filled by customers, security issues rdb Managed MySQL and PostgreSQL issues, bugs and feature requests
Projects
None yet
Development

No branches or pull requests

4 participants