From 1a05febbe84479510b9fbf1b0518f8c73275a61f Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Tue, 19 Sep 2023 11:01:40 -0700 Subject: [PATCH] Remove revision selector because it's not a string --- apis/kafka/v1beta1/zz_cluster_types.go | 15 +--- apis/kafka/v1beta1/zz_generated.deepcopy.go | 19 ++--- apis/kafka/v1beta1/zz_generated.resolvers.go | 18 ----- config/kafka/config.go | 4 - examples/kafka/cluster.yaml | 4 +- .../crds/kafka.aws.upbound.io_clusters.yaml | 81 ++----------------- 6 files changed, 18 insertions(+), 123 deletions(-) diff --git a/apis/kafka/v1beta1/zz_cluster_types.go b/apis/kafka/v1beta1/zz_cluster_types.go index 47d90c4d7e..a104622a85 100755 --- a/apis/kafka/v1beta1/zz_cluster_types.go +++ b/apis/kafka/v1beta1/zz_cluster_types.go @@ -379,6 +379,9 @@ type ClusterParameters struct { } type ConfigurationInfoInitParameters struct { + + // Revision of the MSK Configuration to use in the cluster. + Revision *float64 `json:"revision,omitempty" tf:"revision,omitempty"` } type ConfigurationInfoObservation struct { @@ -407,18 +410,8 @@ type ConfigurationInfoParameters struct { ArnSelector *v1.Selector `json:"arnSelector,omitempty" tf:"-"` // Revision of the MSK Configuration to use in the cluster. - // +crossplane:generate:reference:type=Configuration - // +crossplane:generate:reference:extractor=github.com/upbound/upjet/pkg/resource.ExtractParamPath("latest_revision",true) - // +kubebuilder:validation:Optional - Revision *float64 `json:"revision,omitempty" tf:"revision,omitempty"` - - // Reference to a Configuration to populate revision. - // +kubebuilder:validation:Optional - RevisionRef *v1.Reference `json:"revisionRef,omitempty" tf:"-"` - - // Selector for a Configuration to populate revision. // +kubebuilder:validation:Optional - RevisionSelector *v1.Selector `json:"revisionSelector,omitempty" tf:"-"` + Revision *float64 `json:"revision" tf:"revision,omitempty"` } type ConnectivityInfoInitParameters struct { diff --git a/apis/kafka/v1beta1/zz_generated.deepcopy.go b/apis/kafka/v1beta1/zz_generated.deepcopy.go index 6a4b7ef342..a69bf4c106 100644 --- a/apis/kafka/v1beta1/zz_generated.deepcopy.go +++ b/apis/kafka/v1beta1/zz_generated.deepcopy.go @@ -556,7 +556,9 @@ func (in *ClusterInitParameters) DeepCopyInto(out *ClusterInitParameters) { if in.ConfigurationInfo != nil { in, out := &in.ConfigurationInfo, &out.ConfigurationInfo *out = make([]ConfigurationInfoInitParameters, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.EncryptionInfo != nil { in, out := &in.EncryptionInfo, &out.EncryptionInfo @@ -997,6 +999,11 @@ func (in *Configuration) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigurationInfoInitParameters) DeepCopyInto(out *ConfigurationInfoInitParameters) { *out = *in + if in.Revision != nil { + in, out := &in.Revision, &out.Revision + *out = new(float64) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigurationInfoInitParameters. @@ -1057,16 +1064,6 @@ func (in *ConfigurationInfoParameters) DeepCopyInto(out *ConfigurationInfoParame *out = new(float64) **out = **in } - if in.RevisionRef != nil { - in, out := &in.RevisionRef, &out.RevisionRef - *out = new(v1.Reference) - (*in).DeepCopyInto(*out) - } - if in.RevisionSelector != nil { - in, out := &in.RevisionSelector, &out.RevisionSelector - *out = new(v1.Selector) - (*in).DeepCopyInto(*out) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigurationInfoParameters. diff --git a/apis/kafka/v1beta1/zz_generated.resolvers.go b/apis/kafka/v1beta1/zz_generated.resolvers.go index 8152b24f95..520dd0c4a1 100644 --- a/apis/kafka/v1beta1/zz_generated.resolvers.go +++ b/apis/kafka/v1beta1/zz_generated.resolvers.go @@ -80,24 +80,6 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.ConfigurationInfo[i3].Arn = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ConfigurationInfo[i3].ArnRef = rsp.ResolvedReference - } - for i3 := 0; i3 < len(mg.Spec.ForProvider.ConfigurationInfo); i3++ { - rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ - CurrentValue: reference.FromFloatPtrValue(mg.Spec.ForProvider.ConfigurationInfo[i3].Revision), - Extract: resource.ExtractParamPath("latest_revision", true), - Reference: mg.Spec.ForProvider.ConfigurationInfo[i3].RevisionRef, - Selector: mg.Spec.ForProvider.ConfigurationInfo[i3].RevisionSelector, - To: reference.To{ - List: &ConfigurationList{}, - Managed: &Configuration{}, - }, - }) - if err != nil { - return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationInfo[i3].Revision") - } - mg.Spec.ForProvider.ConfigurationInfo[i3].Revision = reference.ToFloatPtrValue(rsp.ResolvedValue) - mg.Spec.ForProvider.ConfigurationInfo[i3].RevisionRef = rsp.ResolvedReference - } for i3 := 0; i3 < len(mg.Spec.ForProvider.EncryptionInfo); i3++ { rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ diff --git a/config/kafka/config.go b/config/kafka/config.go index a9ac05dd22..4528f945a8 100644 --- a/config/kafka/config.go +++ b/config/kafka/config.go @@ -29,10 +29,6 @@ func Configure(p *config.Provider) { Type: "Configuration", Extractor: common.PathARNExtractor, } - r.References["configuration_info.revision"] = config.Reference{ - Type: "Configuration", - Extractor: `github.com/upbound/upjet/pkg/resource.ExtractParamPath("latest_revision",true)`, - } r.UseAsync = true }) } diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index ec69ba9359..1841892bef 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -23,9 +23,7 @@ spec: - arnSelector: matchLabels: testing.upbound.io/example-name: example - revisionSelector: - matchLabels: - testing.upbound.io/example-name: example + revision: 1 encryptionInfo: - encryptionAtRestKmsKeyArnSelector: matchLabels: diff --git a/package/crds/kafka.aws.upbound.io_clusters.yaml b/package/crds/kafka.aws.upbound.io_clusters.yaml index e4b0bb9542..28eb1280fc 100644 --- a/package/crds/kafka.aws.upbound.io_clusters.yaml +++ b/package/crds/kafka.aws.upbound.io_clusters.yaml @@ -457,82 +457,6 @@ spec: description: Revision of the MSK Configuration to use in the cluster. type: number - revisionRef: - description: Reference to a Configuration to populate revision. - 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 - revisionSelector: - description: Selector for a Configuration to populate revision. - 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 type: array encryptionInfo: @@ -1154,6 +1078,11 @@ spec: description: Configuration block for specifying a MSK Configuration to attach to Kafka brokers. See below. items: + properties: + revision: + description: Revision of the MSK Configuration to use in + the cluster. + type: number type: object type: array encryptionInfo: