Set writeConnectionSecretToRef.name on create
This commit is contained in:
parent
cfa726a028
commit
241c1e9b28
1 changed files with 10 additions and 1 deletions
|
@ -587,6 +587,15 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
)
|
||||
|
||||
try:
|
||||
spec_data = spec_data or {}
|
||||
if "writeConnectionSecretToRef" not in spec_data:
|
||||
spec_data["writeConnectionSecretToRef"] = {}
|
||||
|
||||
if not spec_data["writeConnectionSecretToRef"].get("name"):
|
||||
service_slug = context.service_offering.service.slug
|
||||
secret_name = f"{organization.slug}-{instance.pk}-{service_slug}"
|
||||
spec_data["writeConnectionSecretToRef"]["name"] = secret_name
|
||||
|
||||
create_data = {
|
||||
"apiVersion": f"{context.group}/{context.version}",
|
||||
"kind": context.kind,
|
||||
|
@ -594,7 +603,7 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
"name": name,
|
||||
"namespace": organization.namespace,
|
||||
},
|
||||
"spec": spec_data or {},
|
||||
"spec": spec_data,
|
||||
}
|
||||
if label := context.control_plane.required_label:
|
||||
create_data["metadata"]["labels"] = {settings.DEFAULT_LABEL_KEY: label}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue