mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 12:06:38 +00:00
Fix: support exposing cloud resource identifier and console url (#2825)
* Fix: support exposing cloud resource identifier and console url To help users quickly navigate to the instance in the web console, exposing necessary information in ComponentDefinition and convert them to Configuration * fix ci * Check whether wl.FullTemplate.ComponentDefinition is nil before getting annotations
This commit is contained in:
@@ -92,6 +92,8 @@ data:
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
cloud-resource/console-url: https://oss.console.aliyun.com/bucket/oss-{ALICLOUD_REGION}/{BUCKET_NAME}/overview
|
||||
cloud-resource/identifier: BUCKET_NAME
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
OSS object
|
||||
labels:
|
||||
@@ -119,6 +121,9 @@ data:
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
cloud-resource/console-url: https://rdsnext.console.aliyun.com/detail/{DB_ID}/basicInfo?®ion={ALICLOUD_REGION}
|
||||
cloud-resource/identifier: DB_ID
|
||||
cloud-resource/sensitive-outputs: DB_PASSWORD
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
RDS object
|
||||
labels:
|
||||
@@ -142,6 +147,10 @@ data:
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_ID" {
|
||||
value = module.rds.db_instance_id
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = module.rds.this_db_instance_name
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: app-rds-sample
|
||||
spec:
|
||||
components:
|
||||
- name: sample-db
|
||||
type: alibaba-rds
|
||||
properties:
|
||||
instance_name: sample-db
|
||||
account_name: oamtest
|
||||
password: U34rfwefwefffaked
|
||||
writeConnectionSecretToRef:
|
||||
name: db-conn
|
||||
@@ -664,8 +664,14 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu
|
||||
}
|
||||
|
||||
configuration := terraformapi.Configuration{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "terraform.core.oam.dev/v1beta1", Kind: "Configuration"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: wl.Name, Namespace: ns},
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: "terraform.core.oam.dev/v1beta1", Kind: "Configuration"},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: wl.Name,
|
||||
Namespace: ns,
|
||||
},
|
||||
}
|
||||
if wl.FullTemplate.ComponentDefinition != nil {
|
||||
configuration.ObjectMeta.Annotations = wl.FullTemplate.ComponentDefinition.Annotations
|
||||
}
|
||||
|
||||
switch wl.FullTemplate.Terraform.Type {
|
||||
|
||||
@@ -89,6 +89,8 @@ spec:
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
cloud-resource/console-url: https://oss.console.aliyun.com/bucket/oss-{ALICLOUD_REGION}/{BUCKET_NAME}/overview
|
||||
cloud-resource/identifier: BUCKET_NAME
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
OSS object
|
||||
labels:
|
||||
@@ -116,6 +118,9 @@ spec:
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
cloud-resource/console-url: https://rdsnext.console.aliyun.com/detail/{DB_ID}/basicInfo?®ion={ALICLOUD_REGION}
|
||||
cloud-resource/identifier: DB_ID
|
||||
cloud-resource/sensitive-outputs: DB_PASSWORD
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
RDS object
|
||||
labels:
|
||||
@@ -139,6 +144,10 @@ spec:
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_ID" {
|
||||
value = module.rds.db_instance_id
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = module.rds.this_db_instance_name
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ metadata:
|
||||
namespace: vela-system
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud OSS object
|
||||
# identifier of this cloud resource
|
||||
cloud-resource/identifier: BUCKET_NAME
|
||||
# the console url of this cloud resource
|
||||
cloud-resource/console-url: "https://oss.console.aliyun.com/bucket/oss-{ALICLOUD_REGION}/{BUCKET_NAME}/overview"
|
||||
# the outputs which are sensitive. Separate them by a comma if there are more than one
|
||||
labels:
|
||||
type: terraform
|
||||
spec:
|
||||
|
||||
@@ -5,6 +5,12 @@ metadata:
|
||||
namespace: vela-system
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud RDS object
|
||||
# identifier of this cloud resource
|
||||
cloud-resource/identifier: DB_ID
|
||||
# the console url of this cloud resource
|
||||
cloud-resource/console-url: "https://rdsnext.console.aliyun.com/detail/{DB_ID}/basicInfo?®ion={ALICLOUD_REGION}"
|
||||
# the outputs which are sensitive. Separate them by a comma if there are more than one
|
||||
cloud-resource/sensitive-outputs: "DB_PASSWORD"
|
||||
labels:
|
||||
type: terraform
|
||||
spec:
|
||||
@@ -28,6 +34,10 @@ spec:
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_ID" {
|
||||
value = module.rds.db_instance_id
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = module.rds.this_db_instance_name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user