Skip to content

Commit cef58c7

Browse files
zzxwillZheng Xi Zhou
and
Zheng Xi Zhou
authored
Feat: expose region in status (kubevela#318)
Region is the region for the cloud resources created by this Configuration. If spec.region is not empty, it's the value of it. Otherwise, it's the value of spec.providerReference.region. Signed-off-by: Zheng Xi Zhou <zhengxi.zzx@alibaba-inc.com> Co-authored-by: Zheng Xi Zhou <zhengxi.zzx@alibaba-inc.com>
1 parent ae8296e commit cef58c7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

api/v1beta2/configuration_types.go

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ type ConfigurationApplyStatus struct {
9393
State state.ConfigurationState `json:"state,omitempty"`
9494
Message string `json:"message,omitempty"`
9595
Outputs map[string]Property `json:"outputs,omitempty"`
96+
// Region is the region for the cloud resources created by this Configuration. If spec.region is not empty, it's the
97+
// value of it. Otherwise, it's the value of spec.providerReference.region.
98+
Region string `json:"region,omitempty"`
9699
}
97100

98101
// ConfigurationDestroyStatus is the status for Configuration destroy

chart/crds/terraform.core.oam.dev_configurations.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ spec:
307307
type: string
308308
type: object
309309
type: object
310+
region:
311+
description: Region is the region for the cloud resources created
312+
by this Configuration. If spec.region is not empty, it's the
313+
value of it. Otherwise, it's the value of spec.providerReference.region.
314+
type: string
310315
state:
311316
description: A ConfigurationState represents the status of a resource
312317
type: string

controllers/configuration_controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ type TFConfigurationMeta struct {
208208
VariableSecretName string
209209
VariableSecretData map[string][]byte
210210
DeleteResource bool
211+
Region string
211212
Credentials map[string]string
212213

213214
Backend backend.Backend
@@ -582,6 +583,7 @@ func (meta *TFConfigurationMeta) updateApplyStatus(ctx context.Context, k8sClien
582583
configuration.Status.Apply = v1beta2.ConfigurationApplyStatus{
583584
State: state,
584585
Message: message,
586+
Region: meta.Region,
585587
}
586588
configuration.Status.ObservedGeneration = configuration.Generation
587589
if state == types.Available {
@@ -1110,5 +1112,6 @@ func (meta *TFConfigurationMeta) getCredentials(ctx context.Context, k8sClient c
11101112
return errors.New(provider.ErrCredentialNotRetrieved)
11111113
}
11121114
meta.Credentials = credentials
1115+
meta.Region = region
11131116
return nil
11141117
}

0 commit comments

Comments
 (0)