fast-easter-23401
12/20/2022, 2:44 PMcloudidentity
, but am not quite sure this is the best way to go. Any thoughts?
Many thanks,lemon-wire-69305
12/27/2022, 2:27 AMrefined-pilot-45584
12/29/2022, 7:10 AMrefined-pilot-45584
12/29/2022, 10:52 AMdry-engine-17210
01/01/2023, 7:57 PMmillions-branch-13617
01/02/2023, 6:25 AMlemon-wire-69305
01/03/2023, 10:41 PMproject:region:db_instance_name
.
I can see in the following in the DB logs when it attempts to connect:
authorizationInfo: [
0: {
granted: true
permission: "cloudsql.instances.connect"
resource: "projects/uxu-io-staging/instances/database-instance-uxu-8898595"
resourceAttributes: {
name: "projects/uxu-io-staging/instances/database-instance-uxu-8898595"
service: "<http://sqladmin.googleapis.com|sqladmin.googleapis.com>"
type: "<http://sqladmin.googleapis.com/Instance|sqladmin.googleapis.com/Instance>"
}}]
methodName: "cloudsql.instances.connect"
lemon-wire-69305
01/03/2023, 11:05 PMhost
as "localhost", as the host given in the connection string is `projectregiondb_instance_name`_._
I can see in the following in the DB logs when it attempts to connect:
authorizationInfo: [
0: {
granted: true
permission: "cloudsql.instances.connect"
resource: "projects/my-project/instances/my-db-instance-8898595"
resourceAttributes: {
name: "projects/my-project/instances/my-db-instance-8898595"
service: "<http://sqladmin.googleapis.com|sqladmin.googleapis.com>"
type: "<http://sqladmin.googleapis.com/Instance|sqladmin.googleapis.com/Instance>"
}}]
methodName: "cloudsql.instances.connect"
So can see it's correctly reaching out for the right db etc, but that's the only message in the logs.
The ping code is basically doing:
driverName := "cloudsql-postgres"
cleanup, err := pgxv4.RegisterDriver(driverName, cloudsqlconn.WithIAMAuthN())
connStr := fmt.Sprintf("host=%v user=%v dbname=%v sslmode=disable", host, user, name)
db, err := sql.Open(driverName, connStr)
ctx, cancelfunc := context.WithTimeout(context.Background(), 30*time.Second)
pingErr := db.PingContext(ctx) // times out here
if pingErr != nil {
log.Fatalf("server: Got error: %v\n", pingErr) // logs error here due to timeout
}
and my k8s IAM setup is basically:
const saJob = new gcp.serviceaccount.Account("sa-job", {
accountId: "sa-for-job",
displayName: "My Service Account for the ping Job",
});
const iamDBEditor = new gcp.projects.IAMBinding("iam-db-editor", {
project: gcpProject,
role: "roles/cloudsql.editor",
members: [pulumi.interpolate`serviceAccount:${saJob.email}`],
}, {
parent: saJob
});
const iamDBUser = new gcp.projects.IAMBinding("iam-db-user", {
project: gcpProject,
role: "roles/cloudsql.instanceUser",
members: [pulumi.interpolate`serviceAccount:${saJob.email}`],
}, {
parent: saJob
});
const k8sSAJob = new k8s.core.v1.ServiceAccount("k8s-sa-job", {
metadata: {
namespace: namespaceName,
annotations: {
"<http://iam.gke.io/gcp-service-account|iam.gke.io/gcp-service-account>": saJob.email,
},
}
},
{
provider: clusterProvider,
})
const iamK8sBinding = new gcp.serviceaccount.IAMBinding("iam-k8s-db-editor", {
serviceAccountId: saJob.name,
role: "roles/iam.workloadIdentityUser",
members: [pulumi.interpolate`serviceAccount:${gcpProject}.svc.id.goog[${namespaceName}/${k8sSAJob.metadata.name}]`],
})
/* Create a user with the configured IAM credentials (linked to the service account).
For more info:
* <https://cloud.google.com/sql/docs/postgres/iam-logins>
* <https://cloud.google.com/sql/docs/postgres/add-manage-iam-users#creating-a-database-user>
*/
const dbUserJobAPIServerMigration = new gcp.sql.User("api_server_migrator", {
instance: db.instance.name,
name: saJob.email.apply((v) =>
v.replace(".<http://gserviceaccount.com|gserviceaccount.com>", "")
),
project: gcpProject,
type: "CLOUD_IAM_SERVICE_ACCOUNT",
});
I've also tested locally connecting to CloudSQL with pretty much the same golang code except using a cloudsqlconn.WithCredentialsFile("/Users/me/creds/sa-creds.json")
file instead of `cloudsqlconn.WithIAMAuthN()`along with a different db user and the ping code works as expected.
So, I'm thinking the problem might be something related to perhaps kubernetes and IAM auth, but I'm honestly just a bit stuck and hence the reach out.
Apologies for the long post, I'm hoping someone's been through this pain before and can offer a tip or two on troubleshooting or what might be going on. Thanks for your help!kind-room-82948
01/10/2023, 6:56 PMaloof-leather-66267
01/10/2023, 8:40 PMIAMMemberCondition
are all strings and not Output<string>
?refined-pilot-45584
01/11/2023, 8:13 PMstocky-sundown-45608
01/12/2023, 4:23 AMstocky-sundown-45608
01/12/2023, 4:23 AMError: invocation of kubernetes:helm:template returned an error: failed to generate YAML for specified Helm chart: failed to create chart from template: execution error at (neo4j-cluster-core/templates/_helpers.tpl:73:16): No node exists in the cluster which has all the below labels (.Values.nodeSelector)
%smap[<http://cloud.google.com/gke-nodepool:primarynodes-1d024b4|cloud.google.com/gke-nodepool:primarynodes-1d024b4>]
at Object.callback (/e/node_modules/@pulumi/runtime/invoke.ts:172:33)
at Object.onReceiveStatus (/node_modules/@grpc/grpc-js/src/client.ts:338:26)
at Object.onReceiveStatus (/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
at Object.onReceiveStatus (/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
at /node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
at processTicksAndRejections (node:internal/process/task_queues:77:11)
brash-hairdresser-60389
01/13/2023, 12:37 AMgcp.sql.Database
and gcp.sql.User
(using Postgres)
In my pulumi script, I use to create in order:
1. The gcp.sql.User
2. the gcp.sql.Database
This works fine until I try to destroy the stack, I have always the issue the User cannot be deleted because there’s a reference (the database).
I tried to change the order of creation Database first, then User, but this doesn’t bind the user correctly to the database.
I’ve seen there’s the need in such a case to set up the deletionPolicy: 'ABANDON'
on the Database, but in doing so, the Database is not deleted, and then if I try to recreate the database, it fails because it already exists.
It is possible there is no way to manage these GCP resources correctly using Pulumi? I can’t believe I have to delete it manually.
Thank you for any answer.lemon-wire-69305
01/14/2023, 5:20 AMpulumi up
process, or scripted in such a way that after a pulumi up
no other manual process needs to be run?
It's also possible that I'm thinking of this in the wrong way, so I'm curious to hear if there's a better solution to this problem.dry-keyboard-94795
01/16/2023, 9:26 AMstocky-sundown-45608
01/16/2023, 3:47 PMstocky-sundown-45608
01/16/2023, 3:47 PMconst issuer = new k8s.apiextensions.CustomResource(issuerName, {
apiVersion: "<http://cert-manager.io/v1|cert-manager.io/v1>",
kind: "Issuer",
metadata: {
namespace: appNs.metadata.name,
name: issuerName,
},
spec: {
acme: {
server: "<https://acme-v02.api.letsencrypt.org/directory>",
email: "",
privateKeySecretRef: {
name: issuerSecret.metadata.name,
},
solvers: [{
http01: {
ingress: {
name: "api-ingress-dev"
},
},
}],
},
},
stocky-sundown-45608
01/16/2023, 3:47 PMeager-keyboard-30823
01/19/2023, 5:38 PM// Create a PubSub Topic
let requests = new gcp.pubsub.Topic("requests");
requests.onMessagePublished("newMessage", (data) => {
// Print out a log message for every message on the Topic.
// Change this code to fit your needs!
console.log(Buffer.from(data.data, "base64").toString());
});
After:
// Create a PubSub Topic
let requests = await gcp.pubsub.getTopic("requests");
/// ???
requests.onMessagePublished("newMessage", (data) => {
// Print out a log message for every message on the Topic.
// Change this code to fit your needs!
console.log(Buffer.from(data.data, "base64").toString());
});
eager-keyboard-30823
01/19/2023, 8:39 PMgcp.cloudfunctions.CallbackFunction
? I’m trying to use @google-cloud/workflows
in the callback. For reference:magnificent-rainbow-92633
01/21/2023, 1:59 AMrefined-pilot-45584
01/23/2023, 1:12 PMstocky-sundown-45608
02/02/2023, 6:57 AMgsutil iam ch serviceAccount:<sa-name>:<bucketrole> gs://<bucket-name>
to give access for the sa to the bucket. How do I do that in pulumi,lively-leather-32109
02/02/2023, 12:36 PMflaky-twilight-44520
02/03/2023, 8:03 AM@pulumi/postgresql.Provider
to start cloud sql/alloydb auth proxy before connecting to the instance?best-summer-38252
02/04/2023, 6:47 AMerror: error sending request: googleapi: Error 429: Project docket-grabber-dev exceeded its quota. Resource Exhausted:
best-summer-38252
02/04/2023, 7:23 PMrefined-pilot-45584
02/04/2023, 7:31 PMbest-summer-38252
02/04/2023, 7:56 PM