provider-gcp icon indicating copy to clipboard operation
provider-gcp copied to clipboard

Crosspalne GCP CloudSQL instance create separate password for read replica

Open insider89 opened this issue 2 years ago • 4 comments

What happened?

I am using GCP crossplane provider to create CloudSQL instance with read replica. As I understand I need 2 different yaml file: 1 for master node and 1 for read replica. For both of them I specify secret file to which connection information is written. For master node and read replica I specify different secret: cloudsqlpostgresql-conn and cloudsqlpostgresql-conn-replica. When read replica created it writes some password to cloudsqlpostgresql-conn-replica, but this password doesn't work, as read replica has the same password as master node. Why read replica writes wrong password to k8s secrets?

How can we reproduce it?

Master node:

kind: CloudSQLInstance
  name: test
spec:
  deletionPolicy: Orphan
  forProvider:
    databaseVersion: POSTGRES_12
    failoverReplica:
      name: ""
    gceZone: us-east1-c
    instanceType: CLOUD_SQL_INSTANCE
    region: us-east1
    replicaNames:
    - test-replica
    settings:
      activationPolicy: ALWAYS
      availabilityType: REGIONAL
      backupConfiguration:
        enabled: true
        location: us
        startTime: "23:00"
      dataDiskSizeGb: 50
      dataDiskType: PD_SSD
      ipConfiguration:
        authorizedNetworks:
        - expirationTime: ""
          name: gcp-health-checkers-range
          value: 130.211.0.0/28
        ipv4Enabled: false
        privateNetwork: projects/test-vpc/global/networks/test-vpc
        requireSsl: false
      locationPreference:
        zone: us-east1-c
      maintenanceWindow:
        day: 1
        hour: 14
        updateTrack: stable
      pricingPlan: PER_USE
      replicationType: SYNCHRONOUS
      storageAutoResize: true
      storageAutoResizeLimit: 1000
      tier: db-custom-2-8192
      userLabels:
        crossplane-kind: cloudsqlinstance_database_gcp_crossplane_io
        crossplane-name: test
        crossplane-providerconfig: default
  providerConfigRef:
    name: default
  writeConnectionSecretToRef:
    name: cloudsqlpostgresql-conn
    namespace: test

Replica node:

kind: CloudSQLInstance
metadata:
  name: test-replica
spec:
  deletionPolicy: Orphan
  forProvider:
    databaseVersion: POSTGRES_12
    gceZone: us-east1-c
    instanceType: READ_REPLICA_INSTANCE
    masterInstanceName: test-project:test
    region: us-east1
    settings:
      activationPolicy: ALWAYS
      availabilityType: ZONAL
      backupConfiguration:
        startTime: "16:00"
      crashSafeReplicationEnabled: true
      dataDiskSizeGb: 50
      dataDiskType: PD_SSD
      databaseReplicationEnabled: true
      ipConfiguration:
        authorizedNetworks:
        - expirationTime: ""
          name: gcp-health-checkers-range
          value: 130.211.0.0/28
        ipv4Enabled: false
        privateNetwork: projects/test-vpc/global/networks/test-vpc
        requireSsl: false
      locationPreference:
        zone: us-east1-c
      pricingPlan: PER_USE
      replicationType: SYNCHRONOUS
      storageAutoResize: true
      tier: db-custom-2-8192
      userLabels:
        crossplane-kind: cloudsqlinstance_database_gcp_crossplane_io
        crossplane-name: test-replica
        crossplane-providerconfig: default
  providerConfigRef:
    name: default
  writeConnectionSecretToRef:
    name: cloudsqlpostgresql-conn-replica
    namespace: test

What environment did it happen in?

  • Crossplane version: 1.2.1
  • Crossplane GCP provider version: 0.16
  • Cloud provider or hardware configuration
  • Kubernetes version 1.21
  • Kubernetes distribution GKE
  • OS Container-Optimized OS

insider89 avatar Mar 15 '22 08:03 insider89

hello, need your help to provide read replica ? is is using 2 yaml file? how about if we using 1 yaml file ?

panjek26 avatar May 30 '22 00:05 panjek26

Yes, I am using 2 yaml files. Don't know how to do it with 1 yaml file.

insider89 avatar May 30 '22 06:05 insider89

can you give me the workaround to read replica instance using crossplane ? I am a little bit confused because the documentation so minim

panjek26 avatar May 30 '22 07:05 panjek26

can you give me the workaround to read replica instance using crossplane ? I am a little bit confused because the documentation so minim

I don't have workaround. I am using 2 files, which you can see in the issue description.

insider89 avatar May 30 '22 07:05 insider89