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

GCP Postgres CloudSQL database observation writes replicaConfiguration which is only applicable for MySQL #499

Open
jonnylangefeld opened this issue Mar 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jonnylangefeld
Copy link

When creating a multi-region replicated postgres CloudSQL database, where the secondary instance has a reference via spec.forProvider.masterInstanceName, then the secondary instance gets the field spec.forProvider.replicaConfiguration set with a list entry of an empty struct by the provider. Because of this the secondary resource gets an error like the following and can never become ready:

observe failed: cannot run refresh: refresh failed: Missing required argument: "replica_configuration.0.verify_server_certificate": one of `replica_configuration.0.ca_certificate,replica_configuration.0.client_certificate,replica_configuration.0.client_key,replica_configuration.0.connect_retry_interval,replica_configuration.0.dump_file_path,replica_configuration.0.failover_target,replica_configuration.0.master_heartbeat_period,replica_configuration.0.password,replica_configuration.0.ssl_cipher,replica_configuration.0.username,replica_configuration.0.verify_server_certificate` must be specified

What happened?

The spec.forProvider.replicaConfiguration is set by the provider as I can see in the managedFields

        f:spec:
          f:forProvider:
            f:maintenanceVersion: {}
            f:project: {}
            f:replicaConfiguration: {}

The field looks like this on the secondary instance (the primary doesn't have this)

      replicaConfiguration:
      - {}

The replicaConfiguration says in the docs that it's only for MySQL:

// MysqlReplicaConfiguration: MySQL specific configuration when
// replicating from a MySQL on-premises primary instance. Replication
// configuration information such as the username, password,
// certificates, and keys are not stored in the instance metadata. The
// configuration information is used only to set up the replication
// connection and is stored by MySQL in a file named **master.info** in
// the data directory.
// +optional
MysqlReplicaConfiguration *MySqlReplicaConfiguration `json:"mysqlReplicaConfiguration,omitempty"`

How can we reproduce it?

create a composition with the following resources:

- name: database-instance
  base:
    # https://doc.crds.dev/github.com/upbound/provider-gcp/sql.gcp.upbound.io/DatabaseInstance/v1beta1
    apiVersion: sql.gcp.upbound.io/v1beta1
    kind: DatabaseInstance
    metadata:
      labels:
        provisioning.getcruise.com/instance: primary
    spec:
      forProvider:
        databaseVersion: POSTGRES_13
        region: "us-west1"
        settings:
          - tier: "db-f1-micro"
            availabilityType: "REGIONAL"
        deletionProtection: false
  patches:
    - type: CombineFromComposite
      combine:
        variables:
          - fromFieldPath: metadata.name
        strategy: string
        string:
          fmt: "%s-primary"
      toFieldPath: metadata.annotations[crossplane.io/external-name]
      policy:
        fromFieldPath: Required
- name: database-instance-secondary
  base:
    # https://doc.crds.dev/github.com/upbound/provider-gcp/sql.gcp.upbound.io/DatabaseInstance/v1beta1
    apiVersion: sql.gcp.upbound.io/v1beta1
    kind: DatabaseInstance
    metadata:
      labels:
        provisioning.getcruise.com/instance: secondary
    spec:
      forProvider:
        databaseVersion: POSTGRES_13
        region: "us-west2"
        settings:
          - tier: "db-f1-micro"
            availabilityType: "ZONAL"
        deletionProtection: false
  patches:
    - type: CombineFromComposite
      combine:
        variables:
          - fromFieldPath: metadata.name
        strategy: string
        string:
          fmt: "%s-secondary"
      toFieldPath: metadata.annotations[crossplane.io/external-name]
      policy:
        fromFieldPath: Required
    - type: CombineFromComposite
      combine:
        variables:
          - fromFieldPath: metadata.name
        strategy: string
        string:
          fmt: "%s-primary"
      toFieldPath: spec.forProvider.masterInstanceName
      policy:
        fromFieldPath: Required

What environment did it happen in?

Crossplane version: v1.10.1
GCP provider version: v0.27.0

@jonnylangefeld jonnylangefeld added the bug Something isn't working label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant