From 8de36ff2950b3c757f912e81d2fc4be3ea4b60af Mon Sep 17 00:00:00 2001 From: Zheng Xi Zhou Date: Fri, 3 Dec 2021 13:08:54 +0800 Subject: [PATCH] Backport: pass on properties of Terraform typed application to Configuration (#2872) Pass on properties like writeConnectionSecretRef, Region and providerRef to Configuration. Backport #2847 Signed-off-by: Zheng Xi Zhou --- apis/core.oam.dev/common/types.go | 3 + .../crds/core.oam.dev_traitdefinitions.yaml | 44 +++- .../core.oam.dev_workloaddefinitions.yaml | 44 +++- .../core.oam.dev_applicationrevisions.yaml | 192 +++++++++++++++++- .../core.oam.dev_componentdefinitions.yaml | 44 +++- .../core.oam.dev_definitionrevisions.yaml | 96 ++++++++- .../crds/core.oam.dev_policydefinitions.yaml | 22 +- .../crds/core.oam.dev_traitdefinitions.yaml | 44 +++- .../core.oam.dev_workflowstepdefinitions.yaml | 22 +- .../core.oam.dev_workloaddefinitions.yaml | 44 +++- .../core.oam.dev_applicationrevisions.yaml | 192 +++++++++++++++++- .../core.oam.dev_definitionrevisions.yaml | 96 ++++++++- .../crds/core.oam.dev_policydefinitions.yaml | 22 +- .../crds/core.oam.dev_traitdefinitions.yaml | 44 +++- .../core.oam.dev_workflowstepdefinitions.yaml | 22 +- .../core.oam.dev_workloaddefinitions.yaml | 44 +++- go.mod | 2 +- go.sum | 4 +- .../core.oam.dev_applicationrevisions.yaml | 192 +++++++++++++++++- .../core.oam.dev_componentdefinitions.yaml | 44 +++- .../core.oam.dev_definitionrevisions.yaml | 96 ++++++++- .../crds/core.oam.dev_policydefinitions.yaml | 22 +- .../crds/core.oam.dev_traitdefinitions.yaml | 44 +++- .../core.oam.dev_workflowstepdefinitions.yaml | 22 +- .../core.oam.dev_workloaddefinitions.yaml | 44 +++- pkg/appfile/appfile.go | 44 ++-- pkg/appfile/appfile_test.go | 35 ++-- 27 files changed, 1423 insertions(+), 101 deletions(-) diff --git a/apis/core.oam.dev/common/types.go b/apis/core.oam.dev/common/types.go index 073df0001..2db0f842f 100644 --- a/apis/core.oam.dev/common/types.go +++ b/apis/core.oam.dev/common/types.go @@ -112,6 +112,9 @@ type Terraform struct { // +kubebuilder:validation:Enum:=hcl;json;remote Type string `json:"type,omitempty"` + // Path is the sub-directory of remote git repository. It's valid when remote is set + Path string `json:"path,omitempty"` + v1beta1.BaseConfigurationSpec `json:",inline"` } diff --git a/charts/oam-runtime/crds/core.oam.dev_traitdefinitions.yaml b/charts/oam-runtime/crds/core.oam.dev_traitdefinitions.yaml index 73f5e55b6..7e7d3a322 100644 --- a/charts/oam-runtime/crds/core.oam.dev_traitdefinitions.yaml +++ b/charts/oam-runtime/crds/core.oam.dev_traitdefinitions.yaml @@ -206,11 +206,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -220,6 +224,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -495,11 +515,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -509,6 +533,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/oam-runtime/crds/core.oam.dev_workloaddefinitions.yaml b/charts/oam-runtime/crds/core.oam.dev_workloaddefinitions.yaml index 68441b531..acc0ff2f0 100644 --- a/charts/oam-runtime/crds/core.oam.dev_workloaddefinitions.yaml +++ b/charts/oam-runtime/crds/core.oam.dev_workloaddefinitions.yaml @@ -211,11 +211,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -225,6 +229,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -481,11 +501,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -495,6 +519,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml index bd9517705..4426b5bea 100644 --- a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml @@ -1251,11 +1251,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1265,6 +1270,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1664,11 +1686,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1678,6 +1705,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1975,11 +2019,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1989,6 +2038,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3409,11 +3475,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3423,6 +3494,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3715,11 +3803,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3729,6 +3822,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4110,11 +4220,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4124,6 +4239,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4384,11 +4516,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4398,6 +4535,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4678,11 +4832,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4692,6 +4851,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_componentdefinitions.yaml b/charts/vela-core/crds/core.oam.dev_componentdefinitions.yaml index 6579a1839..3d8536f8d 100644 --- a/charts/vela-core/crds/core.oam.dev_componentdefinitions.yaml +++ b/charts/vela-core/crds/core.oam.dev_componentdefinitions.yaml @@ -197,11 +197,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -211,6 +215,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -490,11 +510,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -504,6 +528,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_definitionrevisions.yaml b/charts/vela-core/crds/core.oam.dev_definitionrevisions.yaml index b6ee804b9..f8ad51e3a 100644 --- a/charts/vela-core/crds/core.oam.dev_definitionrevisions.yaml +++ b/charts/vela-core/crds/core.oam.dev_definitionrevisions.yaml @@ -241,11 +241,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -255,6 +260,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -535,11 +557,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -549,6 +576,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -822,11 +866,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -836,6 +885,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1090,11 +1156,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1104,6 +1175,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_policydefinitions.yaml b/charts/vela-core/crds/core.oam.dev_policydefinitions.yaml index 6639a4b7e..b52ec782b 100644 --- a/charts/vela-core/crds/core.oam.dev_policydefinitions.yaml +++ b/charts/vela-core/crds/core.oam.dev_policydefinitions.yaml @@ -169,11 +169,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -183,6 +187,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_traitdefinitions.yaml b/charts/vela-core/crds/core.oam.dev_traitdefinitions.yaml index 73f5e55b6..7e7d3a322 100644 --- a/charts/vela-core/crds/core.oam.dev_traitdefinitions.yaml +++ b/charts/vela-core/crds/core.oam.dev_traitdefinitions.yaml @@ -206,11 +206,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -220,6 +224,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -495,11 +515,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -509,6 +533,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_workflowstepdefinitions.yaml b/charts/vela-core/crds/core.oam.dev_workflowstepdefinitions.yaml index 72073dfa0..f1458f47b 100644 --- a/charts/vela-core/crds/core.oam.dev_workflowstepdefinitions.yaml +++ b/charts/vela-core/crds/core.oam.dev_workflowstepdefinitions.yaml @@ -166,11 +166,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -180,6 +184,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-core/crds/core.oam.dev_workloaddefinitions.yaml b/charts/vela-core/crds/core.oam.dev_workloaddefinitions.yaml index 68441b531..acc0ff2f0 100644 --- a/charts/vela-core/crds/core.oam.dev_workloaddefinitions.yaml +++ b/charts/vela-core/crds/core.oam.dev_workloaddefinitions.yaml @@ -211,11 +211,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -225,6 +229,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -481,11 +501,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -495,6 +519,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml index bd9517705..4426b5bea 100644 --- a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml @@ -1251,11 +1251,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1265,6 +1270,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1664,11 +1686,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1678,6 +1705,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1975,11 +2019,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1989,6 +2038,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3409,11 +3475,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3423,6 +3494,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3715,11 +3803,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3729,6 +3822,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4110,11 +4220,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4124,6 +4239,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4384,11 +4516,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4398,6 +4535,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4678,11 +4832,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4692,6 +4851,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_definitionrevisions.yaml b/charts/vela-minimal/crds/core.oam.dev_definitionrevisions.yaml index b6ee804b9..f8ad51e3a 100644 --- a/charts/vela-minimal/crds/core.oam.dev_definitionrevisions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_definitionrevisions.yaml @@ -241,11 +241,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -255,6 +260,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -535,11 +557,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -549,6 +576,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -822,11 +866,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -836,6 +885,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1090,11 +1156,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1104,6 +1175,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_policydefinitions.yaml b/charts/vela-minimal/crds/core.oam.dev_policydefinitions.yaml index 6639a4b7e..b52ec782b 100644 --- a/charts/vela-minimal/crds/core.oam.dev_policydefinitions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_policydefinitions.yaml @@ -169,11 +169,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -183,6 +187,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_traitdefinitions.yaml b/charts/vela-minimal/crds/core.oam.dev_traitdefinitions.yaml index 73f5e55b6..7e7d3a322 100644 --- a/charts/vela-minimal/crds/core.oam.dev_traitdefinitions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_traitdefinitions.yaml @@ -206,11 +206,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -220,6 +224,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -495,11 +515,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -509,6 +533,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_workflowstepdefinitions.yaml b/charts/vela-minimal/crds/core.oam.dev_workflowstepdefinitions.yaml index 72073dfa0..f1458f47b 100644 --- a/charts/vela-minimal/crds/core.oam.dev_workflowstepdefinitions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_workflowstepdefinitions.yaml @@ -166,11 +166,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -180,6 +184,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_workloaddefinitions.yaml b/charts/vela-minimal/crds/core.oam.dev_workloaddefinitions.yaml index 68441b531..acc0ff2f0 100644 --- a/charts/vela-minimal/crds/core.oam.dev_workloaddefinitions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_workloaddefinitions.yaml @@ -211,11 +211,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -225,6 +229,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -481,11 +501,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -495,6 +519,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/go.mod b/go.mod index 13f6ec4d8..1e6cf8172 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/mitchellh/hashstructure/v2 v2.0.1 github.com/oam-dev/cluster-gateway v1.1.6 github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 - github.com/oam-dev/terraform-controller v0.2.8 + github.com/oam-dev/terraform-controller v0.2.12 github.com/olekukonko/tablewriter v0.0.5 github.com/onsi/ginkgo v1.16.4 github.com/onsi/gomega v1.16.0 diff --git a/go.sum b/go.sum index 58a4ba485..ba9db2d20 100644 --- a/go.sum +++ b/go.sum @@ -1217,8 +1217,8 @@ github.com/oam-dev/stern v1.13.1 h1:Gt7xMBmQjRueHVFjRo5CHDTVhiYrssjlmvPwRiZtq7c= github.com/oam-dev/stern v1.13.1/go.mod h1:0pLjZt0amXE/ErF16Rdrgd98H2owN8Hmn3/7CX5+AeA= github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 h1:tD8HiFKnt0jnwdTWjeqUnfnUYLD/+Nsmj8ZGIxqDWiU= github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28/go.mod h1:Mu8i0/DdplvnjwRbAYPsc8+LRR27n/mp8VWdkN10GzE= -github.com/oam-dev/terraform-controller v0.2.8 h1:DXqDDP4mWLNThVgPwr/9uvHC1TR40drBCU2XnlRkmm0= -github.com/oam-dev/terraform-controller v0.2.8/go.mod h1:6YPAr54np9qwBCmOdK7OAhJ9sOlm3JgSFMP4QfiS4FY= +github.com/oam-dev/terraform-controller v0.2.12 h1:WIcpV4JWVOiN52DOjwiOTvy4+snSWzX2ltFAnXP1QqE= +github.com/oam-dev/terraform-controller v0.2.12/go.mod h1:DbdquoYxiWoZnYpRsHH/HKdR1REYdwRQycYJuC1CUdQ= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml index c391b38fb..a2d4d4f4a 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml @@ -1251,11 +1251,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1265,6 +1270,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1664,11 +1686,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1678,6 +1705,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1975,11 +2019,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1989,6 +2038,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3409,11 +3475,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3423,6 +3494,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -3715,11 +3803,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -3729,6 +3822,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4110,11 +4220,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4124,6 +4239,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4384,11 +4516,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4398,6 +4535,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -4678,11 +4832,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -4692,6 +4851,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_componentdefinitions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_componentdefinitions.yaml index 7077bf557..9e127118e 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_componentdefinitions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_componentdefinitions.yaml @@ -197,11 +197,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -211,6 +215,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -490,11 +510,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -504,6 +528,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_definitionrevisions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_definitionrevisions.yaml index 16226c92d..de35e8a12 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_definitionrevisions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_definitionrevisions.yaml @@ -241,11 +241,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -255,6 +260,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -535,11 +557,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -549,6 +576,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -822,11 +866,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -836,6 +885,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -1090,11 +1156,16 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It + will override the region in the region field of + ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -1104,6 +1175,23 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required to + connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_policydefinitions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_policydefinitions.yaml index 944262ee0..9632f2313 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_policydefinitions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_policydefinitions.yaml @@ -169,11 +169,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -183,6 +187,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_traitdefinitions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_traitdefinitions.yaml index ba9640f1c..25577de88 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_traitdefinitions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_traitdefinitions.yaml @@ -206,11 +206,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -220,6 +224,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -495,11 +515,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -509,6 +533,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflowstepdefinitions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflowstepdefinitions.yaml index 008abfc92..81a8d11e6 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflowstepdefinitions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflowstepdefinitions.yaml @@ -166,11 +166,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -180,6 +184,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workloaddefinitions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workloaddefinitions.yaml index 8af6fe857..a342c9242 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workloaddefinitions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workloaddefinitions.yaml @@ -211,11 +211,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -225,6 +229,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object @@ -481,11 +501,15 @@ spec: type: string namespace: default: default - description: Namespace of the secret. + description: Namespace of the referenced object. type: string required: - name type: object + region: + description: Region is cloud provider's region. It will override + the region in the region field of ProviderReference + type: string type: default: hcl description: Type specifies which Terraform configuration @@ -495,6 +519,22 @@ spec: - json - remote type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the + namespace and name of a Secret to which any connection details + for this managed resource should be written. Connection + details frequently include the endpoint, username, and password + required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object required: - configuration type: object diff --git a/pkg/appfile/appfile.go b/pkg/appfile/appfile.go index 4d67f0dbd..dbe140c18 100644 --- a/pkg/appfile/appfile.go +++ b/pkg/appfile/appfile.go @@ -50,14 +50,20 @@ import ( // constant error information const ( - errInvalidValueType = "require %q type parameter value" - errTerraformConfigurationIsNotSet = "terraform configuration is not set" - errFailToConvertTerraformComponentProperties = "failed to convert Terraform component properties" - errTerraformNameOfWriteConnectionSecretToRefNotSet = "the name of writeConnectionSecretToRef of terraform component is not set" + errInvalidValueType = "require %q type parameter value" + errTerraformConfigurationIsNotSet = "terraform configuration is not set" + errFailToConvertTerraformComponentProperties = "failed to convert Terraform component properties" + errConvertTerraformBaseConfigurationSpec = "failed to convert properties to Terraform Configuration spec" ) -// WriteConnectionSecretToRefKey is used to create a secret for cloud resource connection -const WriteConnectionSecretToRefKey = "writeConnectionSecretToRef" +const ( + // WriteConnectionSecretToRefKey is used to create a secret for cloud resource connection + WriteConnectionSecretToRefKey = "writeConnectionSecretToRef" + // RegionKey is the region of a Cloud Provider + RegionKey = "region" + // ProviderRefKey is the reference of a Provider + ProviderRefKey = "providerRef" +) // Workload is component type Workload struct { @@ -678,19 +684,24 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu configuration.Spec.Path = wl.FullTemplate.Terraform.Path } - if wl.FullTemplate.Terraform.ProviderReference != nil { - configuration.Spec.ProviderReference = wl.FullTemplate.Terraform.ProviderReference - } - // 1. parse writeConnectionSecretToRef - if err := json.Unmarshal(params, &configuration.Spec); err != nil { + if err := json.Unmarshal(params, &configuration); err != nil { return nil, errors.Wrap(err, errFailToConvertTerraformComponentProperties) } - if configuration.Spec.WriteConnectionSecretToReference != nil { - if configuration.Spec.WriteConnectionSecretToReference.Name == "" { - return nil, errors.New(errTerraformNameOfWriteConnectionSecretToRefNotSet) - } + var spec terraformapi.BaseConfigurationSpec + if err := json.Unmarshal(params, &spec); err != nil { + return nil, errors.Wrap(err, errConvertTerraformBaseConfigurationSpec) + } + if spec.ProviderReference != nil && !reflect.DeepEqual(configuration.Spec.ProviderReference, spec.ProviderReference) { + configuration.Spec.ProviderReference = spec.ProviderReference + } + if spec.Region != "" && configuration.Spec.Region != spec.Region { + configuration.Spec.Region = spec.Region + } + if spec.WriteConnectionSecretToReference != nil && spec.WriteConnectionSecretToReference.Name != "" && + !reflect.DeepEqual(configuration.Spec.WriteConnectionSecretToReference, spec.WriteConnectionSecretToReference) { + configuration.Spec.WriteConnectionSecretToReference = spec.WriteConnectionSecretToReference // set namespace for writeConnectionSecretToRef, developer needn't manually set it if configuration.Spec.WriteConnectionSecretToReference.Namespace == "" { configuration.Spec.WriteConnectionSecretToReference.Namespace = ns @@ -708,11 +719,14 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu return nil, errors.Wrap(err, errFailToConvertTerraformComponentProperties) } delete(variableMap, WriteConnectionSecretToRefKey) + delete(variableMap, RegionKey) + delete(variableMap, ProviderRefKey) data, err := json.Marshal(variableMap) if err != nil { return nil, errors.Wrap(err, errFailToConvertTerraformComponentProperties) } + configuration.Spec.Variable = &runtime.RawExtension{Raw: data} raw := util.Object2RawExtension(&configuration) return util.RawExtension2Unstructured(raw) diff --git a/pkg/appfile/appfile_test.go b/pkg/appfile/appfile_test.go index 8f328feb0..82b99da02 100644 --- a/pkg/appfile/appfile_test.go +++ b/pkg/appfile/appfile_test.go @@ -608,12 +608,12 @@ variable "password" { }, Spec: terraformapi.ConfigurationSpec{ - HCL: configuration, - Variable: raw, - WriteConnectionSecretToReference: &terraformtypes.SecretReference{Name: "db", Namespace: "default"}, + HCL: configuration, + Variable: raw, }, Status: terraformapi.ConfigurationStatus{}, } + workload.Spec.WriteConnectionSecretToReference = &terraformtypes.SecretReference{Name: "db", Namespace: "default"} expectCompManifest := &oamtypes.ComponentManifest{ Name: compName, @@ -920,13 +920,6 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) { args args want want }{ - "json workload with invalid secret": { - args: args{ - json: "abc", - params: map[string]interface{}{"acl": "private", "writeConnectionSecretToRef": map[string]interface{}{"name": "", "namespace": ""}}, - }, - want: want{err: errors.New(errTerraformNameOfWriteConnectionSecretToRefNotSet)}}, - "json workload with secret": { args: args{ @@ -998,10 +991,10 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) { }, } configSpec = terraformapi.ConfigurationSpec{ - HCL: tc.args.hcl, - Variable: raw, - WriteConnectionSecretToReference: tc.args.writeConnectionSecretToRef, + HCL: tc.args.hcl, + Variable: raw, } + configSpec.WriteConnectionSecretToReference = tc.args.writeConnectionSecretToRef } if tc.args.json != "" { template = &Template{ @@ -1011,10 +1004,10 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) { }, } configSpec = terraformapi.ConfigurationSpec{ - JSON: tc.args.json, - Variable: raw, - WriteConnectionSecretToReference: tc.args.writeConnectionSecretToRef, + JSON: tc.args.json, + Variable: raw, } + configSpec.WriteConnectionSecretToReference = tc.args.writeConnectionSecretToRef } if tc.args.remote != "" { template = &Template{ @@ -1024,10 +1017,10 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) { }, } configSpec = terraformapi.ConfigurationSpec{ - Remote: tc.args.remote, - Variable: raw, - WriteConnectionSecretToReference: tc.args.writeConnectionSecretToRef, + Remote: tc.args.remote, + Variable: raw, } + configSpec.WriteConnectionSecretToReference = tc.args.writeConnectionSecretToRef } if tc.args.hcl == "" && tc.args.json == "" && tc.args.remote == "" { template = &Template{ @@ -1035,9 +1028,9 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) { } configSpec = terraformapi.ConfigurationSpec{ - Variable: raw, - WriteConnectionSecretToReference: tc.args.writeConnectionSecretToRef, + Variable: raw, } + configSpec.WriteConnectionSecretToReference = tc.args.writeConnectionSecretToRef } if tc.args.providerRef != nil { template.Terraform.ProviderReference = tc.args.providerRef