From e1703cf159f5ef751f0100a27f6bd18209dd2c37 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Tue, 12 Sep 2023 15:32:16 -0700 Subject: [PATCH 1/7] add two selectors for kafka configuration --- apis/kafka/v1beta1/reference.go | 24 ++++++++++++++++++++++++ config/kafka/config.go | 8 ++++++++ examples/kafka/cluster.yaml | 27 ++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 apis/kafka/v1beta1/reference.go diff --git a/apis/kafka/v1beta1/reference.go b/apis/kafka/v1beta1/reference.go new file mode 100644 index 0000000000..c7abdfacaa --- /dev/null +++ b/apis/kafka/v1beta1/reference.go @@ -0,0 +1,24 @@ +package v1beta1 + +import ( + "github.com/crossplane/crossplane-runtime/pkg/fieldpath" + "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" +) + +// Lovingly ripped off from config/common/ARNExtractor. Is there a better way? +func GetConfigurationRevision() reference.ExtractValueFn { + return func(mg xpresource.Managed) string { + paved, err := fieldpath.PaveObject(mg) + if err != nil { + // todo(hasan): should we log this error? + return "" + } + r, err := paved.GetString("status.atProvider.revision") + if err != nil { + // todo(hasan): should we log this error? + return "" + } + return r + } +} diff --git a/config/kafka/config.go b/config/kafka/config.go index c236b448d7..7128c23a39 100644 --- a/config/kafka/config.go +++ b/config/kafka/config.go @@ -25,6 +25,14 @@ func Configure(p *config.Provider) { r.References["broker_node_group_info.security_groups"] = config.Reference{ Type: "github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup", } + r.References["configuration_info.arn"] = config.Reference{ + Type: "Configuration", + Extractor: common.PathARNExtractor, + } + r.References["configuration_info.revision"] = config.Reference{ + Type: "Configuration", + Extractor: "GetConfigurationRevision()", + } r.UseAsync = true }) } diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index 65045681c1..d23ce170c8 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -10,13 +10,20 @@ spec: - clientSubnetsRefs: - name: subnet-az1 - name: subnet-az2 - instanceType: kafka.m5.large + instanceType: kafka.t3.small securityGroupsRefs: - name: sg storageInfo: - ebsStorageInfo: - volumeSize: 1000 clusterName: example + configurationInfo: + arnSelector: + matchLabels: + testing.upbound.io/example-name: example + revisionSelector: + matchLabels: + testing.upbound.io/example-name: example encryptionInfo: - encryptionAtRestKmsKeyArnSelector: matchLabels: @@ -42,6 +49,24 @@ spec: --- +apiVersion: kafka.aws.upbound.io/v1beta1 +kind: Configuration +metadata: + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + kafkaVersions: + - 2.6.0 + name: example + region: us-west-1 + serverProperties: | + auto.create.topics.enable = true + delete.topic.enable = true + +--- + apiVersion: iam.aws.upbound.io/v1beta1 kind: Role metadata: From 5db43cd505748bf017753011e556c4f67e6ed850 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Tue, 12 Sep 2023 15:43:19 -0700 Subject: [PATCH 2/7] codegen kafka configuration references --- apis/kafka/v1beta1/zz_cluster_types.go | 30 +++- apis/kafka/v1beta1/zz_generated.deepcopy.go | 34 ++-- apis/kafka/v1beta1/zz_generated.resolvers.go | 36 ++++ .../crds/kafka.aws.upbound.io_clusters.yaml | 161 +++++++++++++++++- 4 files changed, 231 insertions(+), 30 deletions(-) diff --git a/apis/kafka/v1beta1/zz_cluster_types.go b/apis/kafka/v1beta1/zz_cluster_types.go index 729a70339a..4e8452c6c3 100755 --- a/apis/kafka/v1beta1/zz_cluster_types.go +++ b/apis/kafka/v1beta1/zz_cluster_types.go @@ -379,12 +379,6 @@ type ClusterParameters struct { } type ConfigurationInfoInitParameters struct { - - // Amazon Resource Name (ARN) of the MSK Configuration to use in the cluster. - Arn *string `json:"arn,omitempty" tf:"arn,omitempty"` - - // Revision of the MSK Configuration to use in the cluster. - Revision *float64 `json:"revision,omitempty" tf:"revision,omitempty"` } type ConfigurationInfoObservation struct { @@ -399,12 +393,32 @@ type ConfigurationInfoObservation struct { type ConfigurationInfoParameters struct { // Amazon Resource Name (ARN) of the MSK Configuration to use in the cluster. + // +crossplane:generate:reference:type=Configuration + // +crossplane:generate:reference:extractor=github.com/upbound/provider-aws/config/common.ARNExtractor() // +kubebuilder:validation:Optional - Arn *string `json:"arn" tf:"arn,omitempty"` + Arn *string `json:"arn,omitempty" tf:"arn,omitempty"` + + // Reference to a Configuration to populate arn. + // +kubebuilder:validation:Optional + ArnRef *v1.Reference `json:"arnRef,omitempty" tf:"-"` + + // Selector for a Configuration to populate arn. + // +kubebuilder:validation:Optional + 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=GetConfigurationRevision() + // +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 - Revision *float64 `json:"revision" tf:"revision,omitempty"` + RevisionSelector *v1.Selector `json:"revisionSelector,omitempty" tf:"-"` } type ConnectivityInfoInitParameters struct { diff --git a/apis/kafka/v1beta1/zz_generated.deepcopy.go b/apis/kafka/v1beta1/zz_generated.deepcopy.go index 8ff6f2204d..6a4b7ef342 100644 --- a/apis/kafka/v1beta1/zz_generated.deepcopy.go +++ b/apis/kafka/v1beta1/zz_generated.deepcopy.go @@ -556,9 +556,7 @@ func (in *ClusterInitParameters) DeepCopyInto(out *ClusterInitParameters) { if in.ConfigurationInfo != nil { in, out := &in.ConfigurationInfo, &out.ConfigurationInfo *out = make([]ConfigurationInfoInitParameters, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } if in.EncryptionInfo != nil { in, out := &in.EncryptionInfo, &out.EncryptionInfo @@ -999,16 +997,6 @@ 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.Arn != nil { - in, out := &in.Arn, &out.Arn - *out = new(string) - **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. @@ -1054,11 +1042,31 @@ func (in *ConfigurationInfoParameters) DeepCopyInto(out *ConfigurationInfoParame *out = new(string) **out = **in } + if in.ArnRef != nil { + in, out := &in.ArnRef, &out.ArnRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ArnSelector != nil { + in, out := &in.ArnSelector, &out.ArnSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Revision != nil { in, out := &in.Revision, &out.Revision *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 de13b3f268..e1ee1a772e 100644 --- a/apis/kafka/v1beta1/zz_generated.resolvers.go +++ b/apis/kafka/v1beta1/zz_generated.resolvers.go @@ -62,6 +62,42 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroups = reference.ToPtrValues(mrsp.ResolvedValues) mg.Spec.ForProvider.BrokerNodeGroupInfo[i3].SecurityGroupsRefs = mrsp.ResolvedReferences + } + for i3 := 0; i3 < len(mg.Spec.ForProvider.ConfigurationInfo); i3++ { + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ConfigurationInfo[i3].Arn), + Extract: common.ARNExtractor(), + Reference: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnRef, + Selector: mg.Spec.ForProvider.ConfigurationInfo[i3].ArnSelector, + To: reference.To{ + List: &ConfigurationList{}, + Managed: &Configuration{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.ConfigurationInfo[i3].Arn") + } + 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: GetConfigurationRevision(), + 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/package/crds/kafka.aws.upbound.io_clusters.yaml b/package/crds/kafka.aws.upbound.io_clusters.yaml index 880a172cd5..e4b0bb9542 100644 --- a/package/crds/kafka.aws.upbound.io_clusters.yaml +++ b/package/crds/kafka.aws.upbound.io_clusters.yaml @@ -377,10 +377,162 @@ spec: description: Amazon Resource Name (ARN) of the MSK Configuration to use in the cluster. type: string + arnRef: + description: Reference to a Configuration to populate arn. + 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 + arnSelector: + description: Selector for a Configuration to populate arn. + 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 revision: 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: @@ -1002,15 +1154,6 @@ spec: description: Configuration block for specifying a MSK Configuration to attach to Kafka brokers. See below. items: - properties: - arn: - description: Amazon Resource Name (ARN) of the MSK Configuration - to use in the cluster. - type: string - revision: - description: Revision of the MSK Configuration to use in - the cluster. - type: number type: object type: array encryptionInfo: From 6a12b9cbd978b988475a7ebe19b285b15fb928b4 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Wed, 13 Sep 2023 16:44:40 -0700 Subject: [PATCH 3/7] Use ExtractParamPath --- apis/kafka/v1beta1/reference.go | 24 -------------------- apis/kafka/v1beta1/zz_cluster_types.go | 2 +- apis/kafka/v1beta1/zz_generated.resolvers.go | 2 +- config/kafka/config.go | 2 +- 4 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 apis/kafka/v1beta1/reference.go diff --git a/apis/kafka/v1beta1/reference.go b/apis/kafka/v1beta1/reference.go deleted file mode 100644 index c7abdfacaa..0000000000 --- a/apis/kafka/v1beta1/reference.go +++ /dev/null @@ -1,24 +0,0 @@ -package v1beta1 - -import ( - "github.com/crossplane/crossplane-runtime/pkg/fieldpath" - "github.com/crossplane/crossplane-runtime/pkg/reference" - xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" -) - -// Lovingly ripped off from config/common/ARNExtractor. Is there a better way? -func GetConfigurationRevision() reference.ExtractValueFn { - return func(mg xpresource.Managed) string { - paved, err := fieldpath.PaveObject(mg) - if err != nil { - // todo(hasan): should we log this error? - return "" - } - r, err := paved.GetString("status.atProvider.revision") - if err != nil { - // todo(hasan): should we log this error? - return "" - } - return r - } -} diff --git a/apis/kafka/v1beta1/zz_cluster_types.go b/apis/kafka/v1beta1/zz_cluster_types.go index 4e8452c6c3..47d90c4d7e 100755 --- a/apis/kafka/v1beta1/zz_cluster_types.go +++ b/apis/kafka/v1beta1/zz_cluster_types.go @@ -408,7 +408,7 @@ type ConfigurationInfoParameters struct { // Revision of the MSK Configuration to use in the cluster. // +crossplane:generate:reference:type=Configuration - // +crossplane:generate:reference:extractor=GetConfigurationRevision() + // +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"` diff --git a/apis/kafka/v1beta1/zz_generated.resolvers.go b/apis/kafka/v1beta1/zz_generated.resolvers.go index e1ee1a772e..8152b24f95 100644 --- a/apis/kafka/v1beta1/zz_generated.resolvers.go +++ b/apis/kafka/v1beta1/zz_generated.resolvers.go @@ -84,7 +84,7 @@ func (mg *Cluster) ResolveReferences(ctx context.Context, c client.Reader) error 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: GetConfigurationRevision(), + Extract: resource.ExtractParamPath("latest_revision", true), Reference: mg.Spec.ForProvider.ConfigurationInfo[i3].RevisionRef, Selector: mg.Spec.ForProvider.ConfigurationInfo[i3].RevisionSelector, To: reference.To{ diff --git a/config/kafka/config.go b/config/kafka/config.go index 7128c23a39..a9ac05dd22 100644 --- a/config/kafka/config.go +++ b/config/kafka/config.go @@ -31,7 +31,7 @@ func Configure(p *config.Provider) { } r.References["configuration_info.revision"] = config.Reference{ Type: "Configuration", - Extractor: "GetConfigurationRevision()", + Extractor: `github.com/upbound/upjet/pkg/resource.ExtractParamPath("latest_revision",true)`, } r.UseAsync = true }) From 02ed2d8da2fece3b701ee27dbccebbd2aed127be Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Wed, 13 Sep 2023 18:13:21 -0700 Subject: [PATCH 4/7] update kafka cluster example --- examples/kafka/cluster.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index d23ce170c8..a02b9f21d7 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -1,6 +1,8 @@ apiVersion: kafka.aws.upbound.io/v1beta1 kind: Cluster metadata: + annotations: + uptest.upbound.io/timeout: "7200" labels: testing.upbound.io/example-name: example name: example @@ -18,12 +20,12 @@ spec: - volumeSize: 1000 clusterName: example configurationInfo: - arnSelector: - matchLabels: - testing.upbound.io/example-name: example - revisionSelector: - matchLabels: - testing.upbound.io/example-name: example + - arnSelector: + matchLabels: + testing.upbound.io/example-name: example + revisionSelector: + matchLabels: + testing.upbound.io/example-name: example encryptionInfo: - encryptionAtRestKmsKeyArnSelector: matchLabels: From 4a6eb3272c5c755ed2440d8669ac61096619bf4e Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Thu, 14 Sep 2023 14:25:44 -0700 Subject: [PATCH 5/7] update firehose config in kafka example --- examples/kafka/cluster.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index a02b9f21d7..ec69ba9359 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -99,18 +99,19 @@ kind: DeliveryStream metadata: labels: testing.upbound.io/example-name: test_stream - name: test-stream + name: example spec: forProvider: - destination: s3 + destination: extended_s3 region: us-west-1 - s3Configuration: + extendedS3Configuration: - bucketArnSelector: matchLabels: testing.upbound.io/example-name: bucket roleArnSelector: matchLabels: testing.upbound.io/example-name: firehose_role + name: example tags: LogDeliveryEnabled: placeholder From 1a05febbe84479510b9fbf1b0518f8c73275a61f Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Tue, 19 Sep 2023 11:01:40 -0700 Subject: [PATCH 6/7] 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: From 84ce0b3597a49a5e8851d74011a7de0ced0beac5 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Thu, 21 Sep 2023 12:12:08 -0700 Subject: [PATCH 7/7] move example to us-east-2 which has more AZs than us-west-1 --- examples/kafka/cluster.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index 1841892bef..4fba8eeab9 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -43,7 +43,7 @@ spec: - enabledInBroker: true nodeExporter: - enabledInBroker: true - region: us-west-1 + region: us-east-2 tags: foo: bar @@ -60,7 +60,7 @@ spec: kafkaVersions: - 2.6.0 name: example - region: us-west-1 + region: us-east-2 serverProperties: | auto.create.topics.enable = true delete.topic.enable = true @@ -101,7 +101,7 @@ metadata: spec: forProvider: destination: extended_s3 - region: us-west-1 + region: us-east-2 extendedS3Configuration: - bucketArnSelector: matchLabels: @@ -124,7 +124,7 @@ metadata: spec: forProvider: description: example - region: us-west-1 + region: us-east-2 --- @@ -136,7 +136,7 @@ metadata: name: ${Rand.RFC1123Subdomain} spec: forProvider: - region: us-west-1 + region: us-east-2 --- @@ -148,7 +148,7 @@ metadata: name: sg spec: forProvider: - region: us-west-1 + region: us-east-2 vpcIdSelector: matchLabels: testing.upbound.io/example-name: vpc @@ -161,9 +161,9 @@ metadata: name: subnet-az1 spec: forProvider: - availabilityZone: us-west-1b + availabilityZone: us-east-2a cidrBlock: 192.168.0.0/24 - region: us-west-1 + region: us-east-2 vpcIdSelector: matchLabels: testing.upbound.io/example-name: vpc @@ -176,9 +176,9 @@ metadata: name: subnet-az2 spec: forProvider: - availabilityZone: us-west-1c + availabilityZone: us-east-2b cidrBlock: 192.168.1.0/24 - region: us-west-1 + region: us-east-2 vpcIdSelector: matchLabels: testing.upbound.io/example-name: vpc @@ -194,7 +194,7 @@ metadata: spec: forProvider: cidrBlock: 192.168.0.0/22 - region: us-west-1 + region: us-east-2 --- @@ -204,7 +204,7 @@ metadata: name: test spec: forProvider: - region: us-west-1 + region: us-east-2 tags: Application: serviceA Environment: production