Automating Deployment of DataHub with GCP Cloud MySQL in Kubernetes Cluster

Original Slack Thread

I’m currently deploying datahub against a GCP cloud mysql db. I create the GCP cloud mysql db through terraform, then pass the ip address along as a k8s secret in the k8s cluster that hosts my datahub deployment. In an effort to automate deployments, I want to pass this db’s ip address to certain attributes in the values.yaml file, similar to how I was already passing in the password. Here is a working version of my values.yaml file

    datasource:
      host: "10.120.48.2:3306"
      hostForMysqlClient: "10.120.48.2"
      port: "3306"
      url: "jdbc:<mysql://10.120.48.2:3306/datahub?verifyServerCertificate=false&useSSL=true&useUnicode=yes&characterEncoding=UTF-8&enabledTLSProtocols=TLSv1.2>"
      driver: "com.mysql.cj.jdbc.Driver"
      username: "root"
      password:
        secretRef: mysql-secrets
        secretKey: mysql-root-password```
Here is a something I tried, but didn't work.
```  sql:
    datasource:
      host: "10.120.48.14:3306"
      hostForMysqlClient: 
        secretRef: datahub-db-ip
        secretKey: datahub-db-ip
      port: "3306"
      url: "jdbc:<mysql://10.120.48.14:3306/datahub?verifyServerCertificate=false&useSSL=true&useUnicode=yes&characterEncoding=UTF-8&enabledTLSProtocols=TLSv1.2>"
      driver: "com.mysql.cj.jdbc.Driver"
      username: "datahub"
      password:
        secretRef: mysql-secrets
        secretKey: mysql-root-password```
However this errored out this error: `bad hostname provided: <tcp://map>[secretKey:datahub-ip. parse "<tcp://map>[secretKey:datahub-ip": invalid port ":datahub-ip" after host`

I’m not super familiar with helm charts and how best to pass values in to these values.yaml files, but I thought I could mirror the password and how I’m passing that in by storing the value in a k8s secret.

Hey Aaron- let me take a look here…