1616Crossplane will automatically wait for dependencies to be ready before creating dependent resources.
1717"""
1818
19- import base64
2019import dataclasses
2120import ipaddress
2221import secrets
@@ -149,11 +148,6 @@ async def RunFunction(
149148 subnet_group_resource = self ._create_subnet_group (config )
150149 resources .append (("subnet_group" , subnet_group_resource ))
151150
152- # 8.1. Create secret for database password
153- log .info ("Creating password secret definition" )
154- password_secret_resource = self ._create_password_secret (config )
155- resources .append (("password_secret" , password_secret_resource ))
156-
157151 # 9. Create Aurora cluster (depends on subnet group and security group)
158152 log .info ("Creating Aurora cluster definition" )
159153 aurora_resource = self ._create_aurora_cluster (config )
@@ -593,25 +587,6 @@ def _create_subnet_group(self, config: VectorDBConfig) -> dict:
593587 },
594588 }
595589
596- def _create_password_secret (self , config : VectorDBConfig ) -> dict :
597- """Create a secret for the database password."""
598- return {
599- "apiVersion" : "v1" ,
600- "kind" : "Secret" ,
601- "type" : "Opaque" ,
602- "stringData" : {
603- "password" : base64 .b64encode (config .master_password .encode ()).decode (),
604- },
605- "metadata" : {
606- "name" : f"vectordb-password-{ config .environment_suffix } " ,
607- "namespace" : config .namespace ,
608- "labels" : {
609- "app" : "vectordb" ,
610- "environment" : config .environment_suffix ,
611- },
612- },
613- }
614-
615590 def _create_aurora_cluster (self , config : VectorDBConfig ) -> dict :
616591 """Create Aurora PostgreSQL cluster."""
617592 return {
@@ -625,6 +600,7 @@ def _create_aurora_cluster(self, config: VectorDBConfig) -> dict:
625600 "engineMode" : "provisioned" ,
626601 "storageEncrypted" : True ,
627602 "masterUsername" : config .master_username ,
603+ "autoGeneratePassword" : True ,
628604 "masterPasswordSecretRef" : {
629605 "name" : f"vectordb-password-{ config .environment_suffix } " ,
630606 "key" : "password" ,
0 commit comments