From 98f8e5f997d99c78cb1d5c57e947209f7b922ae6 Mon Sep 17 00:00:00 2001 From: anton-sidelnikov Date: Wed, 28 Aug 2024 13:28:54 +0200 Subject: [PATCH 1/3] feat: add dds instance and backup selectors --- apis/dds/v1alpha1/zz_backupv3_terraformed.go | 129 ++++ apis/dds/v1alpha1/zz_backupv3_types.go | 185 ++++++ .../v1alpha1/zz_generated.conversion_hubs.go | 3 + apis/dds/v1alpha1/zz_generated.deepcopy.go | 416 ++++++++++++- apis/dds/v1alpha1/zz_generated.managed.go | 60 ++ apis/dds/v1alpha1/zz_generated.managedlist.go | 9 + apis/dds/v1alpha1/zz_generated.resolvers.go | 164 ++++++ apis/dds/v1alpha1/zz_instancev3_types.go | 167 ++++-- config/dds/config.go | 29 + config/external_name.go | 1 + config/provider.go | 2 + examples-generated/dds/v1alpha1/backupv3.yaml | 14 + .../dds/v1alpha1/instancev3.yaml | 12 +- examples/dds/backup.yaml | 14 + examples/dds/instance.yaml | 132 +++++ .../controller/dds/backupv3/zz_controller.go | 87 +++ internal/controller/zz_setup.go | 6 +- ...ntelekomcloud.crossplane.io_backupv3s.yaml | 556 ++++++++++++++++++ ...elekomcloud.crossplane.io_instancev3s.yaml | 460 ++++++++++++++- 19 files changed, 2350 insertions(+), 96 deletions(-) create mode 100755 apis/dds/v1alpha1/zz_backupv3_terraformed.go create mode 100755 apis/dds/v1alpha1/zz_backupv3_types.go create mode 100644 apis/dds/v1alpha1/zz_generated.resolvers.go create mode 100644 config/dds/config.go create mode 100644 examples-generated/dds/v1alpha1/backupv3.yaml create mode 100644 examples/dds/backup.yaml create mode 100644 examples/dds/instance.yaml create mode 100755 internal/controller/dds/backupv3/zz_controller.go create mode 100644 package/crds/dds.opentelekomcloud.crossplane.io_backupv3s.yaml diff --git a/apis/dds/v1alpha1/zz_backupv3_terraformed.go b/apis/dds/v1alpha1/zz_backupv3_terraformed.go new file mode 100755 index 0000000..2646094 --- /dev/null +++ b/apis/dds/v1alpha1/zz_backupv3_terraformed.go @@ -0,0 +1,129 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this BackupV3 +func (mg *BackupV3) GetTerraformResourceType() string { + return "opentelekomcloud_dds_backup_v3" +} + +// GetConnectionDetailsMapping for this BackupV3 +func (tr *BackupV3) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this BackupV3 +func (tr *BackupV3) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this BackupV3 +func (tr *BackupV3) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this BackupV3 +func (tr *BackupV3) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this BackupV3 +func (tr *BackupV3) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this BackupV3 +func (tr *BackupV3) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this BackupV3 +func (tr *BackupV3) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this BackupV3 +func (tr *BackupV3) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this BackupV3 using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *BackupV3) LateInitialize(attrs []byte) (bool, error) { + params := &BackupV3Parameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *BackupV3) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dds/v1alpha1/zz_backupv3_types.go b/apis/dds/v1alpha1/zz_backupv3_types.go new file mode 100755 index 0000000..5fe6aa4 --- /dev/null +++ b/apis/dds/v1alpha1/zz_backupv3_types.go @@ -0,0 +1,185 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type BackupV3InitParameters struct { + + // Specifies the manual backup description. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Specifies the ID of a DDS instance. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/dds/v1alpha1.InstanceV3 + InstanceID *string `json:"instanceId,omitempty" tf:"instance_id,omitempty"` + + // Reference to a InstanceV3 in dds to populate instanceId. + // +kubebuilder:validation:Optional + InstanceIDRef *v1.Reference `json:"instanceIdRef,omitempty" tf:"-"` + + // Selector for a InstanceV3 in dds to populate instanceId. + // +kubebuilder:validation:Optional + InstanceIDSelector *v1.Selector `json:"instanceIdSelector,omitempty" tf:"-"` + + // Specifies the manual backup name. + // The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + // It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + Name *string `json:"name,omitempty" tf:"name,omitempty"` +} + +type BackupV3Observation struct { + + // Indicates the start time of the backup. The format is yyyy-mm-dd hh:mm:ss. The value is in UTC format. + BeginTime *string `json:"beginTime,omitempty" tf:"begin_time,omitempty"` + + // Indicates the database version. + // The datastore structure is documented below. + Datastore []DatastoreObservation `json:"datastore,omitempty" tf:"datastore,omitempty"` + + // Specifies the manual backup description. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Indicates the end time of the backup. The format is yyyy-mm-dd hh:mm:ss. The value is in UTC format. + EndTime *string `json:"endTime,omitempty" tf:"end_time,omitempty"` + + // The resource ID. + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // Specifies the ID of a DDS instance. + InstanceID *string `json:"instanceId,omitempty" tf:"instance_id,omitempty"` + + // Indicates the name of a DDS instance. + InstanceName *string `json:"instanceName,omitempty" tf:"instance_name,omitempty"` + + // Specifies the manual backup name. + // The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + // It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // Indicates the region in which resource was created. + Region *string `json:"region,omitempty" tf:"region,omitempty"` + + // Indicates the backup size in KB. + Size *float64 `json:"size,omitempty" tf:"size,omitempty"` + + // Indicates the backup status. Valid value: + Status *string `json:"status,omitempty" tf:"status,omitempty"` + + // Indicates the backup type. Valid value: + Type *string `json:"type,omitempty" tf:"type,omitempty"` +} + +type BackupV3Parameters struct { + + // Specifies the manual backup description. + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Specifies the ID of a DDS instance. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/dds/v1alpha1.InstanceV3 + // +kubebuilder:validation:Optional + InstanceID *string `json:"instanceId,omitempty" tf:"instance_id,omitempty"` + + // Reference to a InstanceV3 in dds to populate instanceId. + // +kubebuilder:validation:Optional + InstanceIDRef *v1.Reference `json:"instanceIdRef,omitempty" tf:"-"` + + // Selector for a InstanceV3 in dds to populate instanceId. + // +kubebuilder:validation:Optional + InstanceIDSelector *v1.Selector `json:"instanceIdSelector,omitempty" tf:"-"` + + // Specifies the manual backup name. + // The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + // It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + // +kubebuilder:validation:Optional + Name *string `json:"name,omitempty" tf:"name,omitempty"` +} + +type DatastoreInitParameters struct { +} + +type DatastoreObservation struct { + + // Indicates the database storage engine. + StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` + + // Indicates the DB engine. + Type *string `json:"type,omitempty" tf:"type,omitempty"` + + // Indicates the database version. + Version *string `json:"version,omitempty" tf:"version,omitempty"` +} + +type DatastoreParameters struct { +} + +// BackupV3Spec defines the desired state of BackupV3 +type BackupV3Spec struct { + v1.ResourceSpec `json:",inline"` + ForProvider BackupV3Parameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider BackupV3InitParameters `json:"initProvider,omitempty"` +} + +// BackupV3Status defines the observed state of BackupV3. +type BackupV3Status struct { + v1.ResourceStatus `json:",inline"` + AtProvider BackupV3Observation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// BackupV3 is the Schema for the BackupV3s API. Manages a DDS backup resource within OpenTelekomCloud. +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,opentelekomcloud} +type BackupV3 struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.name) || (has(self.initProvider) && has(self.initProvider.name))",message="spec.forProvider.name is a required parameter" + Spec BackupV3Spec `json:"spec"` + Status BackupV3Status `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// BackupV3List contains a list of BackupV3s +type BackupV3List struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BackupV3 `json:"items"` +} + +// Repository type metadata. +var ( + BackupV3_Kind = "BackupV3" + BackupV3_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: BackupV3_Kind}.String() + BackupV3_KindAPIVersion = BackupV3_Kind + "." + CRDGroupVersion.String() + BackupV3_GroupVersionKind = CRDGroupVersion.WithKind(BackupV3_Kind) +) + +func init() { + SchemeBuilder.Register(&BackupV3{}, &BackupV3List{}) +} diff --git a/apis/dds/v1alpha1/zz_generated.conversion_hubs.go b/apis/dds/v1alpha1/zz_generated.conversion_hubs.go index eec29c3..22aca78 100755 --- a/apis/dds/v1alpha1/zz_generated.conversion_hubs.go +++ b/apis/dds/v1alpha1/zz_generated.conversion_hubs.go @@ -6,5 +6,8 @@ Copyright 2022 Upbound Inc. package v1alpha1 +// Hub marks this type as a conversion hub. +func (tr *BackupV3) Hub() {} + // Hub marks this type as a conversion hub. func (tr *InstanceV3) Hub() {} diff --git a/apis/dds/v1alpha1/zz_generated.deepcopy.go b/apis/dds/v1alpha1/zz_generated.deepcopy.go index db9717b..0ed4b4e 100644 --- a/apis/dds/v1alpha1/zz_generated.deepcopy.go +++ b/apis/dds/v1alpha1/zz_generated.deepcopy.go @@ -9,6 +9,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "github.com/crossplane/crossplane-runtime/apis/common/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -103,40 +104,161 @@ func (in *BackupStrategyParameters) DeepCopy() *BackupStrategyParameters { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DatastoreInitParameters) DeepCopyInto(out *DatastoreInitParameters) { +func (in *BackupV3) DeepCopyInto(out *BackupV3) { *out = *in - if in.StorageEngine != nil { - in, out := &in.StorageEngine, &out.StorageEngine + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3. +func (in *BackupV3) DeepCopy() *BackupV3 { + if in == nil { + return nil + } + out := new(BackupV3) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupV3) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupV3InitParameters) DeepCopyInto(out *BackupV3InitParameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description *out = new(string) **out = **in } - if in.Type != nil { - in, out := &in.Type, &out.Type + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID *out = new(string) **out = **in } - if in.Version != nil { - in, out := &in.Version, &out.Version + if in.InstanceIDRef != nil { + in, out := &in.InstanceIDRef, &out.InstanceIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.InstanceIDSelector != nil { + in, out := &in.InstanceIDSelector, &out.InstanceIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.Name != nil { + in, out := &in.Name, &out.Name *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreInitParameters. -func (in *DatastoreInitParameters) DeepCopy() *DatastoreInitParameters { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3InitParameters. +func (in *BackupV3InitParameters) DeepCopy() *BackupV3InitParameters { if in == nil { return nil } - out := new(DatastoreInitParameters) + out := new(BackupV3InitParameters) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DatastoreObservation) DeepCopyInto(out *DatastoreObservation) { +func (in *BackupV3List) DeepCopyInto(out *BackupV3List) { *out = *in - if in.StorageEngine != nil { - in, out := &in.StorageEngine, &out.StorageEngine + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackupV3, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3List. +func (in *BackupV3List) DeepCopy() *BackupV3List { + if in == nil { + return nil + } + out := new(BackupV3List) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupV3List) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupV3Observation) DeepCopyInto(out *BackupV3Observation) { + *out = *in + if in.BeginTime != nil { + in, out := &in.BeginTime, &out.BeginTime + *out = new(string) + **out = **in + } + if in.Datastore != nil { + in, out := &in.Datastore, &out.Datastore + *out = make([]DatastoreObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.EndTime != nil { + in, out := &in.EndTime, &out.EndTime + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *out = new(string) + **out = **in + } + if in.InstanceName != nil { + in, out := &in.InstanceName, &out.InstanceName + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.Size != nil { + in, out := &in.Size, &out.Size + *out = new(float64) + **out = **in + } + if in.Status != nil { + in, out := &in.Status, &out.Status *out = new(string) **out = **in } @@ -145,25 +267,110 @@ func (in *DatastoreObservation) DeepCopyInto(out *DatastoreObservation) { *out = new(string) **out = **in } - if in.Version != nil { - in, out := &in.Version, &out.Version +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3Observation. +func (in *BackupV3Observation) DeepCopy() *BackupV3Observation { + if in == nil { + return nil + } + out := new(BackupV3Observation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupV3Parameters) DeepCopyInto(out *BackupV3Parameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.InstanceID != nil { + in, out := &in.InstanceID, &out.InstanceID + *out = new(string) + **out = **in + } + if in.InstanceIDRef != nil { + in, out := &in.InstanceIDRef, &out.InstanceIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.InstanceIDSelector != nil { + in, out := &in.InstanceIDSelector, &out.InstanceIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.Name != nil { + in, out := &in.Name, &out.Name *out = new(string) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreObservation. -func (in *DatastoreObservation) DeepCopy() *DatastoreObservation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3Parameters. +func (in *BackupV3Parameters) DeepCopy() *BackupV3Parameters { if in == nil { return nil } - out := new(DatastoreObservation) + out := new(BackupV3Parameters) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DatastoreParameters) DeepCopyInto(out *DatastoreParameters) { +func (in *BackupV3Spec) DeepCopyInto(out *BackupV3Spec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3Spec. +func (in *BackupV3Spec) DeepCopy() *BackupV3Spec { + if in == nil { + return nil + } + out := new(BackupV3Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupV3Status) DeepCopyInto(out *BackupV3Status) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupV3Status. +func (in *BackupV3Status) DeepCopy() *BackupV3Status { + if in == nil { + return nil + } + out := new(BackupV3Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreInitParameters) DeepCopyInto(out *DatastoreInitParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreInitParameters. +func (in *DatastoreInitParameters) DeepCopy() *DatastoreInitParameters { + if in == nil { + return nil + } + out := new(DatastoreInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreObservation) DeepCopyInto(out *DatastoreObservation) { *out = *in if in.StorageEngine != nil { in, out := &in.StorageEngine, &out.StorageEngine @@ -182,6 +389,21 @@ func (in *DatastoreParameters) DeepCopyInto(out *DatastoreParameters) { } } +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreObservation. +func (in *DatastoreObservation) DeepCopy() *DatastoreObservation { + if in == nil { + return nil + } + out := new(DatastoreObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreParameters) DeepCopyInto(out *DatastoreParameters) { + *out = *in +} + // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreParameters. func (in *DatastoreParameters) DeepCopy() *DatastoreParameters { if in == nil { @@ -339,6 +561,96 @@ func (in *InstanceV3) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceV3DatastoreInitParameters) DeepCopyInto(out *InstanceV3DatastoreInitParameters) { + *out = *in + if in.StorageEngine != nil { + in, out := &in.StorageEngine, &out.StorageEngine + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceV3DatastoreInitParameters. +func (in *InstanceV3DatastoreInitParameters) DeepCopy() *InstanceV3DatastoreInitParameters { + if in == nil { + return nil + } + out := new(InstanceV3DatastoreInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceV3DatastoreObservation) DeepCopyInto(out *InstanceV3DatastoreObservation) { + *out = *in + if in.StorageEngine != nil { + in, out := &in.StorageEngine, &out.StorageEngine + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceV3DatastoreObservation. +func (in *InstanceV3DatastoreObservation) DeepCopy() *InstanceV3DatastoreObservation { + if in == nil { + return nil + } + out := new(InstanceV3DatastoreObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceV3DatastoreParameters) DeepCopyInto(out *InstanceV3DatastoreParameters) { + *out = *in + if in.StorageEngine != nil { + in, out := &in.StorageEngine, &out.StorageEngine + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceV3DatastoreParameters. +func (in *InstanceV3DatastoreParameters) DeepCopy() *InstanceV3DatastoreParameters { + if in == nil { + return nil + } + out := new(InstanceV3DatastoreParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstanceV3InitParameters) DeepCopyInto(out *InstanceV3InitParameters) { *out = *in @@ -356,7 +668,7 @@ func (in *InstanceV3InitParameters) DeepCopyInto(out *InstanceV3InitParameters) } if in.Datastore != nil { in, out := &in.Datastore, &out.Datastore - *out = make([]DatastoreInitParameters, len(*in)) + *out = make([]InstanceV3DatastoreInitParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -404,11 +716,31 @@ func (in *InstanceV3InitParameters) DeepCopyInto(out *InstanceV3InitParameters) *out = new(string) **out = **in } + if in.SecurityGroupIDRef != nil { + in, out := &in.SecurityGroupIDRef, &out.SecurityGroupIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.SecurityGroupIDSelector != nil { + in, out := &in.SecurityGroupIDSelector, &out.SecurityGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) **out = **in } + if in.SubnetIDRef != nil { + in, out := &in.SubnetIDRef, &out.SubnetIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.SubnetIDSelector != nil { + in, out := &in.SubnetIDSelector, &out.SubnetIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make(map[string]*string, len(*in)) @@ -430,6 +762,16 @@ func (in *InstanceV3InitParameters) DeepCopyInto(out *InstanceV3InitParameters) *out = new(string) **out = **in } + if in.VPCIDRef != nil { + in, out := &in.VPCIDRef, &out.VPCIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.VPCIDSelector != nil { + in, out := &in.VPCIDSelector, &out.VPCIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceV3InitParameters. @@ -501,7 +843,7 @@ func (in *InstanceV3Observation) DeepCopyInto(out *InstanceV3Observation) { } if in.Datastore != nil { in, out := &in.Datastore, &out.Datastore - *out = make([]DatastoreObservation, len(*in)) + *out = make([]InstanceV3DatastoreObservation, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -635,7 +977,7 @@ func (in *InstanceV3Parameters) DeepCopyInto(out *InstanceV3Parameters) { } if in.Datastore != nil { in, out := &in.Datastore, &out.Datastore - *out = make([]DatastoreParameters, len(*in)) + *out = make([]InstanceV3DatastoreParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -683,11 +1025,31 @@ func (in *InstanceV3Parameters) DeepCopyInto(out *InstanceV3Parameters) { *out = new(string) **out = **in } + if in.SecurityGroupIDRef != nil { + in, out := &in.SecurityGroupIDRef, &out.SecurityGroupIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.SecurityGroupIDSelector != nil { + in, out := &in.SecurityGroupIDSelector, &out.SecurityGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) **out = **in } + if in.SubnetIDRef != nil { + in, out := &in.SubnetIDRef, &out.SubnetIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.SubnetIDSelector != nil { + in, out := &in.SubnetIDSelector, &out.SubnetIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Tags != nil { in, out := &in.Tags, &out.Tags *out = make(map[string]*string, len(*in)) @@ -709,6 +1071,16 @@ func (in *InstanceV3Parameters) DeepCopyInto(out *InstanceV3Parameters) { *out = new(string) **out = **in } + if in.VPCIDRef != nil { + in, out := &in.VPCIDRef, &out.VPCIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.VPCIDSelector != nil { + in, out := &in.VPCIDSelector, &out.VPCIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceV3Parameters. diff --git a/apis/dds/v1alpha1/zz_generated.managed.go b/apis/dds/v1alpha1/zz_generated.managed.go index 5a0c274..6f1e5e4 100644 --- a/apis/dds/v1alpha1/zz_generated.managed.go +++ b/apis/dds/v1alpha1/zz_generated.managed.go @@ -7,6 +7,66 @@ package v1alpha1 import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +// GetCondition of this BackupV3. +func (mg *BackupV3) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this BackupV3. +func (mg *BackupV3) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this BackupV3. +func (mg *BackupV3) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this BackupV3. +func (mg *BackupV3) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this BackupV3. +func (mg *BackupV3) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this BackupV3. +func (mg *BackupV3) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this BackupV3. +func (mg *BackupV3) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this BackupV3. +func (mg *BackupV3) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this BackupV3. +func (mg *BackupV3) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this BackupV3. +func (mg *BackupV3) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this BackupV3. +func (mg *BackupV3) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this BackupV3. +func (mg *BackupV3) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + // GetCondition of this InstanceV3. func (mg *InstanceV3) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) diff --git a/apis/dds/v1alpha1/zz_generated.managedlist.go b/apis/dds/v1alpha1/zz_generated.managedlist.go index 114ba05..5d157c2 100644 --- a/apis/dds/v1alpha1/zz_generated.managedlist.go +++ b/apis/dds/v1alpha1/zz_generated.managedlist.go @@ -7,6 +7,15 @@ package v1alpha1 import resource "github.com/crossplane/crossplane-runtime/pkg/resource" +// GetItems of this BackupV3List. +func (l *BackupV3List) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this InstanceV3List. func (l *InstanceV3List) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/dds/v1alpha1/zz_generated.resolvers.go b/apis/dds/v1alpha1/zz_generated.resolvers.go new file mode 100644 index 0000000..5e21659 --- /dev/null +++ b/apis/dds/v1alpha1/zz_generated.resolvers.go @@ -0,0 +1,164 @@ +/* +Copyright 2022 Upbound Inc. +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + reference "github.com/crossplane/crossplane-runtime/pkg/reference" + v1alpha1 "github.com/opentelekomcloud/provider-opentelekomcloud/apis/compute/v1alpha1" + v1alpha11 "github.com/opentelekomcloud/provider-opentelekomcloud/apis/vpc/v1alpha1" + common "github.com/opentelekomcloud/provider-opentelekomcloud/config/common" + errors "github.com/pkg/errors" + client "sigs.k8s.io/controller-runtime/pkg/client" +) + +// ResolveReferences of this BackupV3. +func (mg *BackupV3) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.InstanceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.InstanceIDRef, + Selector: mg.Spec.ForProvider.InstanceIDSelector, + To: reference.To{ + List: &InstanceV3List{}, + Managed: &InstanceV3{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.InstanceID") + } + mg.Spec.ForProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.InstanceIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.InstanceID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.InstanceIDRef, + Selector: mg.Spec.InitProvider.InstanceIDSelector, + To: reference.To{ + List: &InstanceV3List{}, + Managed: &InstanceV3{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.InstanceID") + } + mg.Spec.InitProvider.InstanceID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.InstanceIDRef = rsp.ResolvedReference + + return nil +} + +// ResolveReferences of this InstanceV3. +func (mg *InstanceV3) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{ + List: &v1alpha1.SecgroupV2List{}, + Managed: &v1alpha1.SecgroupV2{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupID") + } + mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SubnetID), + Extract: common.ExtractNetworkID(), + Reference: mg.Spec.ForProvider.SubnetIDRef, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{ + List: &v1alpha11.SubnetV1List{}, + Managed: &v1alpha11.SubnetV1{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.SubnetID") + } + mg.Spec.ForProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.SubnetIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{ + List: &v1alpha11.VpcV1List{}, + Managed: &v1alpha11.VpcV1{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") + } + mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.SecurityGroupIDRef, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{ + List: &v1alpha1.SecgroupV2List{}, + Managed: &v1alpha1.SecgroupV2{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupID") + } + mg.Spec.InitProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.SecurityGroupIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SubnetID), + Extract: common.ExtractNetworkID(), + Reference: mg.Spec.InitProvider.SubnetIDRef, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{ + List: &v1alpha11.SubnetV1List{}, + Managed: &v1alpha11.SubnetV1{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.SubnetID") + } + mg.Spec.InitProvider.SubnetID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.SubnetIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.VPCIDRef, + Selector: mg.Spec.InitProvider.VPCIDSelector, + To: reference.To{ + List: &v1alpha11.VpcV1List{}, + Managed: &v1alpha11.VpcV1{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.VPCID") + } + mg.Spec.InitProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.VPCIDRef = rsp.ResolvedReference + + return nil +} diff --git a/apis/dds/v1alpha1/zz_instancev3_types.go b/apis/dds/v1alpha1/zz_instancev3_types.go index 1fb274f..0ecb2c6 100755 --- a/apis/dds/v1alpha1/zz_instancev3_types.go +++ b/apis/dds/v1alpha1/zz_instancev3_types.go @@ -61,57 +61,6 @@ type BackupStrategyParameters struct { StartTime *string `json:"startTime" tf:"start_time,omitempty"` } -type DatastoreInitParameters struct { - - // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB - // storage engine. The values are wiredTiger, rocksDB. - // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 - StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` - - // Specifies the database type. DDS Community Edition is supported. - // The value is DDS-Community. - Type *string `json:"type,omitempty" tf:"type,omitempty"` - - // Specifies the database version. - // The values are 3.2, 3.4, 4.0, 4.2, 4.4. - Version *string `json:"version,omitempty" tf:"version,omitempty"` -} - -type DatastoreObservation struct { - - // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB - // storage engine. The values are wiredTiger, rocksDB. - // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 - StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` - - // Specifies the database type. DDS Community Edition is supported. - // The value is DDS-Community. - Type *string `json:"type,omitempty" tf:"type,omitempty"` - - // Specifies the database version. - // The values are 3.2, 3.4, 4.0, 4.2, 4.4. - Version *string `json:"version,omitempty" tf:"version,omitempty"` -} - -type DatastoreParameters struct { - - // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB - // storage engine. The values are wiredTiger, rocksDB. - // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 - // +kubebuilder:validation:Optional - StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` - - // Specifies the database type. DDS Community Edition is supported. - // The value is DDS-Community. - // +kubebuilder:validation:Optional - Type *string `json:"type" tf:"type,omitempty"` - - // Specifies the database version. - // The values are 3.2, 3.4, 4.0, 4.2, 4.4. - // +kubebuilder:validation:Optional - Version *string `json:"version" tf:"version,omitempty"` -} - type FlavorInitParameters struct { // Specifies the node quantity. Valid value: @@ -171,6 +120,57 @@ type FlavorParameters struct { Type *string `json:"type" tf:"type,omitempty"` } +type InstanceV3DatastoreInitParameters struct { + + // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB + // storage engine. The values are wiredTiger, rocksDB. + // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 + StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` + + // Specifies the database type. DDS Community Edition is supported. + // The value is DDS-Community. + Type *string `json:"type,omitempty" tf:"type,omitempty"` + + // Specifies the database version. + // The values are 3.2, 3.4, 4.0, 4.2, 4.4. + Version *string `json:"version,omitempty" tf:"version,omitempty"` +} + +type InstanceV3DatastoreObservation struct { + + // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB + // storage engine. The values are wiredTiger, rocksDB. + // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 + StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` + + // Specifies the database type. DDS Community Edition is supported. + // The value is DDS-Community. + Type *string `json:"type,omitempty" tf:"type,omitempty"` + + // Specifies the database version. + // The values are 3.2, 3.4, 4.0, 4.2, 4.4. + Version *string `json:"version,omitempty" tf:"version,omitempty"` +} + +type InstanceV3DatastoreParameters struct { + + // Specifies the storage engine. Currently, DDS supports the WiredTiger and RocksDB + // storage engine. The values are wiredTiger, rocksDB. + // WiredTiger engine supports versions 3.2, 3.4, 4.0 while RocksDB supports versions 4.2, 4.4 + // +kubebuilder:validation:Optional + StorageEngine *string `json:"storageEngine,omitempty" tf:"storage_engine,omitempty"` + + // Specifies the database type. DDS Community Edition is supported. + // The value is DDS-Community. + // +kubebuilder:validation:Optional + Type *string `json:"type" tf:"type,omitempty"` + + // Specifies the database version. + // The values are 3.2, 3.4, 4.0, 4.2, 4.4. + // +kubebuilder:validation:Optional + Version *string `json:"version" tf:"version,omitempty"` +} + type InstanceV3InitParameters struct { // Specifies the ID of the availability zone. @@ -182,7 +182,7 @@ type InstanceV3InitParameters struct { // Specifies database information. The structure is described // below. - Datastore []DatastoreInitParameters `json:"datastore,omitempty" tf:"datastore,omitempty"` + Datastore []InstanceV3DatastoreInitParameters `json:"datastore,omitempty" tf:"datastore,omitempty"` // Specifies the disk encryption ID of the instance. DiskEncryptionID *string `json:"diskEncryptionId,omitempty" tf:"disk_encryption_id,omitempty"` @@ -213,18 +213,46 @@ type InstanceV3InitParameters struct { SSL *bool `json:"ssl,omitempty" tf:"ssl,omitempty"` // Specifies the security group ID of the DDS instance. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/compute/v1alpha1.SecgroupV2 SecurityGroupID *string `json:"securityGroupId,omitempty" tf:"security_group_id,omitempty"` + // Reference to a SecgroupV2 in compute to populate securityGroupId. + // +kubebuilder:validation:Optional + SecurityGroupIDRef *v1.Reference `json:"securityGroupIdRef,omitempty" tf:"-"` + + // Selector for a SecgroupV2 in compute to populate securityGroupId. + // +kubebuilder:validation:Optional + SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` + // Specifies the subnet Network ID. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/vpc/v1alpha1.SubnetV1 + // +crossplane:generate:reference:extractor=github.com/opentelekomcloud/provider-opentelekomcloud/config/common.ExtractNetworkID() SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"` + // Reference to a SubnetV1 in vpc to populate subnetId. + // +kubebuilder:validation:Optional + SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"` + + // Selector for a SubnetV1 in vpc to populate subnetId. + // +kubebuilder:validation:Optional + SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"` + // Tags key/value pairs to associate with the volume. // Changing this updates the existing volume tags. // +mapType=granular Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` // Specifies the VPC ID. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/vpc/v1alpha1.VpcV1 VPCID *string `json:"vpcId,omitempty" tf:"vpc_id,omitempty"` + + // Reference to a VpcV1 in vpc to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDRef *v1.Reference `json:"vpcIdRef,omitempty" tf:"-"` + + // Selector for a VpcV1 in vpc to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDSelector *v1.Selector `json:"vpcIdSelector,omitempty" tf:"-"` } type InstanceV3Observation struct { @@ -244,7 +272,7 @@ type InstanceV3Observation struct { // Specifies database information. The structure is described // below. - Datastore []DatastoreObservation `json:"datastore,omitempty" tf:"datastore,omitempty"` + Datastore []InstanceV3DatastoreObservation `json:"datastore,omitempty" tf:"datastore,omitempty"` // Specifies the disk encryption ID of the instance. DiskEncryptionID *string `json:"diskEncryptionId,omitempty" tf:"disk_encryption_id,omitempty"` @@ -318,7 +346,7 @@ type InstanceV3Parameters struct { // Specifies database information. The structure is described // below. // +kubebuilder:validation:Optional - Datastore []DatastoreParameters `json:"datastore,omitempty" tf:"datastore,omitempty"` + Datastore []InstanceV3DatastoreParameters `json:"datastore,omitempty" tf:"datastore,omitempty"` // Specifies the disk encryption ID of the instance. // +kubebuilder:validation:Optional @@ -357,13 +385,32 @@ type InstanceV3Parameters struct { SSL *bool `json:"ssl,omitempty" tf:"ssl,omitempty"` // Specifies the security group ID of the DDS instance. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/compute/v1alpha1.SecgroupV2 // +kubebuilder:validation:Optional SecurityGroupID *string `json:"securityGroupId,omitempty" tf:"security_group_id,omitempty"` + // Reference to a SecgroupV2 in compute to populate securityGroupId. + // +kubebuilder:validation:Optional + SecurityGroupIDRef *v1.Reference `json:"securityGroupIdRef,omitempty" tf:"-"` + + // Selector for a SecgroupV2 in compute to populate securityGroupId. + // +kubebuilder:validation:Optional + SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` + // Specifies the subnet Network ID. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/vpc/v1alpha1.SubnetV1 + // +crossplane:generate:reference:extractor=github.com/opentelekomcloud/provider-opentelekomcloud/config/common.ExtractNetworkID() // +kubebuilder:validation:Optional SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"` + // Reference to a SubnetV1 in vpc to populate subnetId. + // +kubebuilder:validation:Optional + SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"` + + // Selector for a SubnetV1 in vpc to populate subnetId. + // +kubebuilder:validation:Optional + SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"` + // Tags key/value pairs to associate with the volume. // Changing this updates the existing volume tags. // +kubebuilder:validation:Optional @@ -371,8 +418,17 @@ type InstanceV3Parameters struct { Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` // Specifies the VPC ID. + // +crossplane:generate:reference:type=github.com/opentelekomcloud/provider-opentelekomcloud/apis/vpc/v1alpha1.VpcV1 // +kubebuilder:validation:Optional VPCID *string `json:"vpcId,omitempty" tf:"vpc_id,omitempty"` + + // Reference to a VpcV1 in vpc to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDRef *v1.Reference `json:"vpcIdRef,omitempty" tf:"-"` + + // Selector for a VpcV1 in vpc to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDSelector *v1.Selector `json:"vpcIdSelector,omitempty" tf:"-"` } type NodesInitParameters struct { @@ -449,9 +505,6 @@ type InstanceV3 struct { // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.mode) || (has(self.initProvider) && has(self.initProvider.mode))",message="spec.forProvider.mode is a required parameter" // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.name) || (has(self.initProvider) && has(self.initProvider.name))",message="spec.forProvider.name is a required parameter" // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.passwordSecretRef)",message="spec.forProvider.passwordSecretRef is a required parameter" - // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.securityGroupId) || (has(self.initProvider) && has(self.initProvider.securityGroupId))",message="spec.forProvider.securityGroupId is a required parameter" - // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.subnetId) || (has(self.initProvider) && has(self.initProvider.subnetId))",message="spec.forProvider.subnetId is a required parameter" - // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.vpcId) || (has(self.initProvider) && has(self.initProvider.vpcId))",message="spec.forProvider.vpcId is a required parameter" Spec InstanceV3Spec `json:"spec"` Status InstanceV3Status `json:"status,omitempty"` } diff --git a/config/dds/config.go b/config/dds/config.go new file mode 100644 index 0000000..eab2973 --- /dev/null +++ b/config/dds/config.go @@ -0,0 +1,29 @@ +package dds + +import ( + "github.com/crossplane/upjet/pkg/config" + "github.com/opentelekomcloud/provider-opentelekomcloud/config/common" +) + +// Configure configures individual resources by adding custom ResourceConfigurators. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("opentelekomcloud_dds_instance_v3", func(r *config.Resource) { + r.UseAsync = true + r.References["security_group_id"] = config.Reference{ + TerraformName: "opentelekomcloud_compute_secgroup_v2", + } + r.References["vpc_id"] = config.Reference{ + TerraformName: "opentelekomcloud_vpc_v1", + } + r.References["subnet_id"] = config.Reference{ + TerraformName: "opentelekomcloud_vpc_subnet_v1", + Extractor: common.NetworkIDExtractor, + } + }) + p.AddResourceConfigurator("opentelekomcloud_dds_backup_v3", func(r *config.Resource) { + r.UseAsync = true + r.References["instance_id"] = config.Reference{ + TerraformName: "opentelekomcloud_dds_instance_v3", + } + }) +} diff --git a/config/external_name.go b/config/external_name.go index 5961071..2cfd33c 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -36,6 +36,7 @@ var ExternalNameConfigs = map[string]config.ExternalName{ // DDS "opentelekomcloud_dds_instance_v3": config.IdentifierFromProvider, + "opentelekomcloud_dds_backup_v3": config.IdentifierFromProvider, // DEH "opentelekomcloud_deh_host_v1": config.IdentifierFromProvider, diff --git a/config/provider.go b/config/provider.go index 98a4ec6..94ce35a 100644 --- a/config/provider.go +++ b/config/provider.go @@ -7,6 +7,7 @@ package config import ( // Note(turkenh): we are importing this to embed provider schema document _ "embed" + "github.com/opentelekomcloud/provider-opentelekomcloud/config/dds" "github.com/opentelekomcloud/provider-opentelekomcloud/config/vpc" @@ -63,6 +64,7 @@ func GetProvider() *ujconfig.Provider { cce.Configure, compute.Configure, dcs.Configure, + dds.Configure, deh.Configure, dis.Configure, dms.Configure, diff --git a/examples-generated/dds/v1alpha1/backupv3.yaml b/examples-generated/dds/v1alpha1/backupv3.yaml new file mode 100644 index 0000000..4e6f8a9 --- /dev/null +++ b/examples-generated/dds/v1alpha1/backupv3.yaml @@ -0,0 +1,14 @@ +apiVersion: dds.opentelekomcloud.crossplane.io/v1alpha1 +kind: BackupV3 +metadata: + annotations: + meta.upbound.io/example-id: dds/v1alpha1/backupv3 + labels: + testing.upbound.io/example-name: backup + name: backup +spec: + forProvider: + instanceIdSelector: + matchLabels: + testing.upbound.io/example-name: example + name: ${var.name} diff --git a/examples-generated/dds/v1alpha1/instancev3.yaml b/examples-generated/dds/v1alpha1/instancev3.yaml index e01c820..ab9521a 100644 --- a/examples-generated/dds/v1alpha1/instancev3.yaml +++ b/examples-generated/dds/v1alpha1/instancev3.yaml @@ -25,9 +25,15 @@ spec: key: example-key name: example-secret namespace: upbound-system - securityGroupId: ${var.security_group_id} - subnetId: ${var.subnet_id} + securityGroupIdSelector: + matchLabels: + testing.upbound.io/example-name: example + subnetIdSelector: + matchLabels: + testing.upbound.io/example-name: example tags: foo: bar new_test: new_test2 - vpcId: ${var.vpc_id} + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: example diff --git a/examples/dds/backup.yaml b/examples/dds/backup.yaml new file mode 100644 index 0000000..ebfaf12 --- /dev/null +++ b/examples/dds/backup.yaml @@ -0,0 +1,14 @@ +apiVersion: dds.opentelekomcloud.crossplane.io/v1alpha1 +kind: BackupV3 +metadata: + annotations: + meta.upbound.io/example-id: dds/v1alpha1/backupv3 + labels: + testing.upbound.io/example-name: sample-dds-backup + name: sample-dds-backup +spec: + forProvider: + instanceIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + name: crossplane-dds-backup diff --git a/examples/dds/instance.yaml b/examples/dds/instance.yaml new file mode 100644 index 0000000..b64dbde --- /dev/null +++ b/examples/dds/instance.yaml @@ -0,0 +1,132 @@ +apiVersion: v1 +kind: Secret +metadata: + name: example-dds-password + namespace: crossplane-system +type: Opaque +data: + example-dds-key: UG9zdGdyZXNAIzIwMjQ= + +--- + +apiVersion: vpc.opentelekomcloud.crossplane.io/v1alpha1 +kind: VpcV1 +metadata: + annotations: + meta.upbound.io/example-id: vpc/v1alpha1/v1 + labels: + testing.upbound.io/example-name: sample-dds-instance + name: sample-dds-instance +spec: + forProvider: + cidr: "192.168.0.0/16" + name: crossplane-vpc + tags: + managed-by: crossplane +--- + +apiVersion: vpc.opentelekomcloud.crossplane.io/v1alpha1 +kind: SubnetV1 +metadata: + annotations: + meta.upbound.io/example-id: vpc/v1alpha1/subnetv1 + labels: + testing.upbound.io/example-name: sample-dds-instance + name: sample-dds-instance +spec: + forProvider: + cidr: "192.168.0.0/16" + gatewayIp: "192.168.0.1" + name: crossplane-subnet + ntpAddresses: "10.100.0.33,10.100.0.34" + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + tags: + managed-by: crossplane + +--- + +apiVersion: compute.opentelekomcloud.crossplane.io/v1alpha1 +kind: SecgroupV2 +metadata: + annotations: + meta.upbound.io/example-id: compute/v1alpha1/secgroupv2 + labels: + testing.upbound.io/example-name: sample-dds-instance + name: sample-dds-instance +spec: + forProvider: + description: crossplane security group + name: crossplane-sg + rule: + - cidr: 0.0.0.0/0 + fromPort: 22 + ipProtocol: tcp + toPort: 22 + - cidr: 0.0.0.0/0 + fromPort: 8080 + ipProtocol: tcp + toPort: 8080 + - cidr: 0.0.0.0/0 + fromPort: 27017 + ipProtocol: tcp + toPort: 27017 + +--- + +apiVersion: dds.opentelekomcloud.crossplane.io/v1alpha1 +kind: InstanceV3 +metadata: + annotations: + meta.upbound.io/example-id: dds/v1alpha1/instancev3 + labels: + testing.upbound.io/example-name: sample-dds-instance + name: sample-dds-instance +spec: + forProvider: + availabilityZone: eu-de-01 + datastore: + - storageEngine: wiredTiger + type: DDS-Community + version: "3.4" + flavor: + - num: 1 + size: 30 + specCode: dds.mongodb.s2.medium.4.repset + storage: ULTRAHIGH + type: replica + mode: ReplicaSet + name: crossplane-dds-instance + passwordSecretRef: + key: example-dds-key + name: example-dds-password + namespace: crossplane-system + subnetIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + securityGroupIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + tags: + managed-by: crossplane + +--- + +apiVersion: dds.opentelekomcloud.crossplane.io/v1alpha1 +kind: BackupV3 +metadata: + annotations: + meta.upbound.io/example-id: dds/v1alpha1/backupv3 + labels: + testing.upbound.io/example-name: sample-dds-backup + name: sample-dds-backup +spec: + forProvider: + instanceIdSelector: + matchLabels: + testing.upbound.io/example-name: sample-dds-instance + name: crossplane-dds-backup \ No newline at end of file diff --git a/internal/controller/dds/backupv3/zz_controller.go b/internal/controller/dds/backupv3/zz_controller.go new file mode 100755 index 0000000..7613027 --- /dev/null +++ b/internal/controller/dds/backupv3/zz_controller.go @@ -0,0 +1,87 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package backupv3 + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/terraform" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/opentelekomcloud/provider-opentelekomcloud/apis/dds/v1alpha1" + features "github.com/opentelekomcloud/provider-opentelekomcloud/internal/features" +) + +// Setup adds a controller that reconciles BackupV3 managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.BackupV3_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1alpha1.BackupV3_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.BackupV3_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["opentelekomcloud_dds_backup_v3"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), + tjcontroller.WithCallbackProvider(ac), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1alpha1.BackupV3 + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1alpha1.BackupV3{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1alpha1.BackupV3") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.BackupV3List{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.BackupV3List") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.BackupV3_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1alpha1.BackupV3{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 9580f1c..61a2593 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -22,6 +22,7 @@ import ( servergroupv2 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/compute/servergroupv2" volumeattachv2 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/compute/volumeattachv2" instancev2dcs "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/dcs/instancev2" + backupv3 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/dds/backupv3" instancev3 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/dds/instancev3" hostv1 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/deh/hostv1" appv2 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/dis/appv2" @@ -112,7 +113,7 @@ import ( bucketpolicy "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/obs/bucketpolicy" bucketreplication "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/obs/bucketreplication" providerconfig "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/providerconfig" - backupv3 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/rds/backupv3" + backupv3rds "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/rds/backupv3" instancev3rds "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/rds/instancev3" parametergroupv3 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/rds/parametergroupv3" readreplicav3 "github.com/opentelekomcloud/provider-opentelekomcloud/internal/controller/rds/readreplicav3" @@ -176,6 +177,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { servergroupv2.Setup, volumeattachv2.Setup, instancev2dcs.Setup, + backupv3.Setup, instancev3.Setup, hostv1.Setup, appv2.Setup, @@ -266,7 +268,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { bucketpolicy.Setup, bucketreplication.Setup, providerconfig.Setup, - backupv3.Setup, + backupv3rds.Setup, instancev3rds.Setup, parametergroupv3.Setup, readreplicav3.Setup, diff --git a/package/crds/dds.opentelekomcloud.crossplane.io_backupv3s.yaml b/package/crds/dds.opentelekomcloud.crossplane.io_backupv3s.yaml new file mode 100644 index 0000000..02a3318 --- /dev/null +++ b/package/crds/dds.opentelekomcloud.crossplane.io_backupv3s.yaml @@ -0,0 +1,556 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: backupv3s.dds.opentelekomcloud.crossplane.io +spec: + group: dds.opentelekomcloud.crossplane.io + names: + categories: + - crossplane + - managed + - opentelekomcloud + kind: BackupV3 + listKind: BackupV3List + plural: backupv3s + singular: backupv3 + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: BackupV3 is the Schema for the BackupV3s API. Manages a DDS backup + resource within OpenTelekomCloud. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: BackupV3Spec defines the desired state of BackupV3 + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + description: + description: Specifies the manual backup description. + type: string + instanceId: + description: Specifies the ID of a DDS instance. + type: string + instanceIdRef: + description: Reference to a InstanceV3 in dds to populate instanceId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + instanceIdSelector: + description: Selector for a InstanceV3 in dds to populate instanceId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + name: + description: |- + Specifies the manual backup name. + The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + type: string + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + description: + description: Specifies the manual backup description. + type: string + instanceId: + description: Specifies the ID of a DDS instance. + type: string + instanceIdRef: + description: Reference to a InstanceV3 in dds to populate instanceId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + instanceIdSelector: + description: Selector for a InstanceV3 in dds to populate instanceId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + name: + description: |- + Specifies the manual backup name. + The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + type: string + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config 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: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + 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. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.name is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.name) + || (has(self.initProvider) && has(self.initProvider.name))' + status: + description: BackupV3Status defines the observed state of BackupV3. + properties: + atProvider: + properties: + beginTime: + description: Indicates the start time of the backup. The format + is yyyy-mm-dd hh:mm:ss. The value is in UTC format. + type: string + datastore: + description: |- + Indicates the database version. + The datastore structure is documented below. + items: + properties: + storageEngine: + description: Indicates the database storage engine. + type: string + type: + description: Indicates the DB engine. + type: string + version: + description: Indicates the database version. + type: string + type: object + type: array + description: + description: Specifies the manual backup description. + type: string + endTime: + description: Indicates the end time of the backup. The format + is yyyy-mm-dd hh:mm:ss. The value is in UTC format. + type: string + id: + description: The resource ID. + type: string + instanceId: + description: Specifies the ID of a DDS instance. + type: string + instanceName: + description: Indicates the name of a DDS instance. + type: string + name: + description: |- + Specifies the manual backup name. + The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z). + It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_). + type: string + region: + description: Indicates the region in which resource was created. + type: string + size: + description: Indicates the backup size in KB. + type: number + status: + description: 'Indicates the backup status. Valid value:' + type: string + type: + description: 'Indicates the backup type. Valid value:' + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/package/crds/dds.opentelekomcloud.crossplane.io_instancev3s.yaml b/package/crds/dds.opentelekomcloud.crossplane.io_instancev3s.yaml index 19cb619..516d125 100644 --- a/package/crds/dds.opentelekomcloud.crossplane.io_instancev3s.yaml +++ b/package/crds/dds.opentelekomcloud.crossplane.io_instancev3s.yaml @@ -187,6 +187,82 @@ spec: securityGroupId: description: Specifies the security group ID of the DDS instance. type: string + securityGroupIdRef: + description: Reference to a SecgroupV2 in compute to populate + securityGroupId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + securityGroupIdSelector: + description: Selector for a SecgroupV2 in compute to populate + securityGroupId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object ssl: description: |- Specifies whether to enable or disable SSL. Defaults to true. @@ -195,6 +271,80 @@ spec: subnetId: description: Specifies the subnet Network ID. type: string + subnetIdRef: + description: Reference to a SubnetV1 in vpc to populate subnetId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + subnetIdSelector: + description: Selector for a SubnetV1 in vpc to populate subnetId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object tags: additionalProperties: type: string @@ -206,6 +356,80 @@ spec: vpcId: description: Specifies the VPC ID. type: string + vpcIdRef: + description: Reference to a VpcV1 in vpc to populate vpcId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + vpcIdSelector: + description: Selector for a VpcV1 in vpc to populate vpcId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object type: object initProvider: description: |- @@ -334,6 +558,82 @@ spec: securityGroupId: description: Specifies the security group ID of the DDS instance. type: string + securityGroupIdRef: + description: Reference to a SecgroupV2 in compute to populate + securityGroupId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + securityGroupIdSelector: + description: Selector for a SecgroupV2 in compute to populate + securityGroupId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object ssl: description: |- Specifies whether to enable or disable SSL. Defaults to true. @@ -342,6 +642,80 @@ spec: subnetId: description: Specifies the subnet Network ID. type: string + subnetIdRef: + description: Reference to a SubnetV1 in vpc to populate subnetId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + subnetIdSelector: + description: Selector for a SubnetV1 in vpc to populate subnetId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object tags: additionalProperties: type: string @@ -353,6 +727,80 @@ spec: vpcId: description: Specifies the VPC ID. type: string + vpcIdRef: + description: Reference to a VpcV1 in vpc to populate vpcId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + vpcIdSelector: + description: Selector for a VpcV1 in vpc to populate vpcId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object required: - passwordSecretRef type: object @@ -547,18 +995,6 @@ spec: - message: spec.forProvider.passwordSecretRef is a required parameter rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies || ''Update'' in self.managementPolicies) || has(self.forProvider.passwordSecretRef)' - - message: spec.forProvider.securityGroupId is a required parameter - rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies - || ''Update'' in self.managementPolicies) || has(self.forProvider.securityGroupId) - || (has(self.initProvider) && has(self.initProvider.securityGroupId))' - - message: spec.forProvider.subnetId is a required parameter - rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies - || ''Update'' in self.managementPolicies) || has(self.forProvider.subnetId) - || (has(self.initProvider) && has(self.initProvider.subnetId))' - - message: spec.forProvider.vpcId is a required parameter - rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies - || ''Update'' in self.managementPolicies) || has(self.forProvider.vpcId) - || (has(self.initProvider) && has(self.initProvider.vpcId))' status: description: InstanceV3Status defines the observed state of InstanceV3. properties: From e7f92c712c77fc8ef4f370c462d2c6c58cdb0302 Mon Sep 17 00:00:00 2001 From: anton-sidelnikov Date: Wed, 28 Aug 2024 13:30:16 +0200 Subject: [PATCH 2/3] endline --- examples/dds/instance.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dds/instance.yaml b/examples/dds/instance.yaml index b64dbde..807eeb9 100644 --- a/examples/dds/instance.yaml +++ b/examples/dds/instance.yaml @@ -129,4 +129,4 @@ spec: instanceIdSelector: matchLabels: testing.upbound.io/example-name: sample-dds-instance - name: crossplane-dds-backup \ No newline at end of file + name: crossplane-dds-backup From f7a65912e60d8cd0d256a9f11d5e3ba7fae9355b Mon Sep 17 00:00:00 2001 From: anton-sidelnikov Date: Wed, 28 Aug 2024 13:50:12 +0200 Subject: [PATCH 3/3] sort imports --- Makefile | 2 +- config/provider.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5706e13..9bd2d8d 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ NPROCS ?= 1 GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 ))) GO_REQUIRED_VERSION ?= 1.22 -GOLANGCILINT_VERSION ?= 1.50.0 +GOLANGCILINT_VERSION ?= 1.54.0 GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION) GO_SUBDIRS += cmd internal apis diff --git a/config/provider.go b/config/provider.go index 94ce35a..f7f1788 100644 --- a/config/provider.go +++ b/config/provider.go @@ -7,14 +7,12 @@ package config import ( // Note(turkenh): we are importing this to embed provider schema document _ "embed" - "github.com/opentelekomcloud/provider-opentelekomcloud/config/dds" - - "github.com/opentelekomcloud/provider-opentelekomcloud/config/vpc" "github.com/opentelekomcloud/provider-opentelekomcloud/config/blockstorage" "github.com/opentelekomcloud/provider-opentelekomcloud/config/cce" "github.com/opentelekomcloud/provider-opentelekomcloud/config/compute" "github.com/opentelekomcloud/provider-opentelekomcloud/config/dcs" + "github.com/opentelekomcloud/provider-opentelekomcloud/config/dds" "github.com/opentelekomcloud/provider-opentelekomcloud/config/deh" "github.com/opentelekomcloud/provider-opentelekomcloud/config/dis" "github.com/opentelekomcloud/provider-opentelekomcloud/config/dms" @@ -30,6 +28,7 @@ import ( "github.com/opentelekomcloud/provider-opentelekomcloud/config/rds" "github.com/opentelekomcloud/provider-opentelekomcloud/config/sfs" "github.com/opentelekomcloud/provider-opentelekomcloud/config/smn" + "github.com/opentelekomcloud/provider-opentelekomcloud/config/vpc" "github.com/opentelekomcloud/provider-opentelekomcloud/config/vpcep" "github.com/opentelekomcloud/provider-opentelekomcloud/config/vpnaas" "github.com/opentelekomcloud/provider-opentelekomcloud/config/wafd"