From cae0a5f53695dfb8da42d076dc9dbe269b7d383e Mon Sep 17 00:00:00 2001 From: AWS Controllers for Kubernetes Bot <82905295+ack-bot@users.noreply.github.com> Date: Fri, 4 Feb 2022 10:18:50 -0800 Subject: [PATCH] Update ACK runtime to `v0.16.4` (#32) ### Update ACK runtime to `v0.16.4` ---------- * ACK code-generator `v0.16.4` [release notes](https://github.com/aws-controllers-k8s/code-generator/releases/tag/v0.16.4) * ACK runtime `v0.16.4` [release notes](https://github.com/aws-controllers-k8s/runtime/releases/tag/v0.16.4) ---------- NOTE: This PR increments the release version of service controller from `v0.0.10` to `v0.0.11` Once this PR is merged, release `v0.0.11` will be automatically created for `mq-controller` **Please close this PR, if you do not want the new patch release for `mq-controller`** ---------- #### stdout for `make build-controller`: ``` building ack-generate ... ok. ==== building mq-controller ==== Copying common custom resource definitions into mq Building Kubernetes API objects for mq Generating deepcopy code for mq Generating custom resource definitions for mq Building service controller for mq Generating RBAC manifests for mq Running gofmt against generated code for mq Updating additional GitHub repository maintenance files ==== building mq-controller release artifacts ==== Building release artifacts for mq-v0.0.11 Generating common custom resource definitions Generating custom resource definitions for mq Generating RBAC manifests for mq ``` ---------- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- apis/v1alpha1/ack-generate-metadata.yaml | 10 ++-- apis/v1alpha1/broker.go | 24 +++++--- apis/v1alpha1/types.go | 60 +++++++++++-------- config/controller/deployment.yaml | 1 + config/controller/kustomization.yaml | 4 +- .../bases/mq.services.k8s.aws_brokers.yaml | 28 ++++++--- config/rbac/cluster-role-binding.yaml | 2 +- config/rbac/kustomization.yaml | 2 + config/rbac/service-account.yaml | 6 ++ go.mod | 4 +- go.sum | 9 +-- helm/Chart.yaml | 4 +- helm/crds/mq.services.k8s.aws_brokers.yaml | 28 ++++++--- helm/templates/NOTES.txt | 2 +- helm/values.yaml | 2 +- pkg/resource/broker/manager.go | 16 +++++ pkg/resource/broker/sdk.go | 52 ++++++++++++---- .../resources/broker_rabbitmq_non_public.yaml | 2 + 18 files changed, 178 insertions(+), 78 deletions(-) create mode 100644 config/rbac/service-account.yaml diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 089db41..11eac6e 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,11 +1,11 @@ ack_generate_info: - build_date: "2022-01-24T20:28:05Z" - build_hash: cccec82a27ddd880095383360df1fdc8f530842f + build_date: "2022-02-02T21:37:59Z" + build_hash: 8f02d7700eaa65a51e99c37d296056def0b70647 go_version: go1.17.5 - version: v0.16.3 -api_directory_checksum: f41af9c64ad2f9436486daf87a125f07fca220e8 + version: v0.16.4 +api_directory_checksum: 3e29a195961c3174ff9a0d00ade5f66d90e8e6bb api_version: v1alpha1 -aws_sdk_go_version: v1.37.10 +aws_sdk_go_version: v1.42.0 generator_config_info: file_checksum: db889711567c0f434fa07a6cad1cfeaf0f6a08d6 original_file_name: generator.yaml diff --git a/apis/v1alpha1/broker.go b/apis/v1alpha1/broker.go index 8c7de1b..7481520 100644 --- a/apis/v1alpha1/broker.go +++ b/apis/v1alpha1/broker.go @@ -24,21 +24,26 @@ import ( type BrokerSpec struct { AuthenticationStrategy *string `json:"authenticationStrategy,omitempty"` - AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade,omitempty"` + // +kubebuilder:validation:Required + AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade"` Configuration *ConfigurationID `json:"configuration,omitempty"` CreatorRequestID *string `json:"creatorRequestID,omitempty"` - DeploymentMode *string `json:"deploymentMode,omitempty"` + // +kubebuilder:validation:Required + DeploymentMode *string `json:"deploymentMode"` EncryptionOptions *EncryptionOptions `json:"encryptionOptions,omitempty"` - EngineType *string `json:"engineType,omitempty"` + // +kubebuilder:validation:Required + EngineType *string `json:"engineType"` - EngineVersion *string `json:"engineVersion,omitempty"` + // +kubebuilder:validation:Required + EngineVersion *string `json:"engineVersion"` - HostInstanceType *string `json:"hostInstanceType,omitempty"` + // +kubebuilder:validation:Required + HostInstanceType *string `json:"hostInstanceType"` LDAPServerMetadata *LDAPServerMetadataInput `json:"ldapServerMetadata,omitempty"` @@ -46,9 +51,11 @@ type BrokerSpec struct { MaintenanceWindowStartTime *WeeklyStartTime `json:"maintenanceWindowStartTime,omitempty"` - Name *string `json:"name,omitempty"` + // +kubebuilder:validation:Required + Name *string `json:"name"` - PubliclyAccessible *bool `json:"publiclyAccessible,omitempty"` + // +kubebuilder:validation:Required + PubliclyAccessible *bool `json:"publiclyAccessible"` SecurityGroups []*string `json:"securityGroups,omitempty"` @@ -58,7 +65,8 @@ type BrokerSpec struct { Tags map[string]*string `json:"tags,omitempty"` - Users []*User `json:"users,omitempty"` + // +kubebuilder:validation:Required + Users []*User `json:"users"` } // BrokerStatus defines the observed state of Broker diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index 7b9a445..db9ad28 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -35,8 +35,7 @@ type AvailabilityZone struct { // Types of broker engines. type BrokerEngineType struct { - // The type of broker engine. Note: Currently, Amazon MQ supports ActiveMQ and - // RabbitMQ. + // The type of broker engine. Amazon MQ supports ActiveMQ and RabbitMQ. EngineType *string `json:"engineType,omitempty"` } @@ -49,28 +48,27 @@ type BrokerInstance struct { // Option for host instance type. type BrokerInstanceOption struct { - // The type of broker engine. Note: Currently, Amazon MQ supports ActiveMQ and - // RabbitMQ. + // The type of broker engine. Amazon MQ supports ActiveMQ and RabbitMQ. EngineType *string `json:"engineType,omitempty"` HostInstanceType *string `json:"hostInstanceType,omitempty"` - // The storage type of the broker. EFS is currently not Supported for RabbitMQ - // engine type. + // The broker's storage type. + // + // EFS is not supported for RabbitMQ engine type. StorageType *string `json:"storageType,omitempty"` SupportedEngineVersions []*string `json:"supportedEngineVersions,omitempty"` } -// The Amazon Resource Name (ARN) of the broker. +// Returns information about all brokers. type BrokerSummary struct { BrokerARN *string `json:"brokerARN,omitempty"` BrokerID *string `json:"brokerID,omitempty"` BrokerName *string `json:"brokerName,omitempty"` - // The status of the broker. + // The broker's status. BrokerState *string `json:"brokerState,omitempty"` Created *metav1.Time `json:"created,omitempty"` - // The deployment mode of the broker. + // The broker's deployment mode. DeploymentMode *string `json:"deploymentMode,omitempty"` - // The type of broker engine. Note: Currently, Amazon MQ supports ActiveMQ and - // RabbitMQ. + // The type of broker engine. Amazon MQ supports ActiveMQ and RabbitMQ. EngineType *string `json:"engineType,omitempty"` HostInstanceType *string `json:"hostInstanceType,omitempty"` } @@ -78,12 +76,12 @@ type BrokerSummary struct { // Returns information about all configurations. type Configuration struct { ARN *string `json:"arn,omitempty"` - // The authentication strategy used to secure the broker. + // Optional. The authentication strategy used to secure the broker. The default + // is SIMPLE. AuthenticationStrategy *string `json:"authenticationStrategy,omitempty"` Created *metav1.Time `json:"created,omitempty"` Description *string `json:"description,omitempty"` - // The type of broker engine. Note: Currently, Amazon MQ supports ActiveMQ and - // RabbitMQ. + // The type of broker engine. Amazon MQ supports ActiveMQ and RabbitMQ. EngineType *string `json:"engineType,omitempty"` EngineVersion *string `json:"engineVersion,omitempty"` ID *string `json:"id,omitempty"` @@ -91,8 +89,9 @@ type Configuration struct { Tags map[string]*string `json:"tags,omitempty"` } -// A list of information about the configuration. Does not apply to RabbitMQ -// brokers. +// A list of information about the configuration. +// +// Does not apply to RabbitMQ brokers. type ConfigurationID struct { ID *string `json:"id,omitempty"` Revision *int64 `json:"revision,omitempty"` @@ -107,15 +106,19 @@ type ConfigurationRevision struct { // Broker configuration information type Configurations struct { - // A list of information about the configuration. Does not apply to RabbitMQ - // brokers. + // A list of information about the configuration. + // + // Does not apply to RabbitMQ brokers. Current *ConfigurationID `json:"current,omitempty"` History []*ConfigurationID `json:"history,omitempty"` - // A list of information about the configuration. Does not apply to RabbitMQ - // brokers. + // A list of information about the configuration. + // + // Does not apply to RabbitMQ brokers. Pending *ConfigurationID `json:"pending,omitempty"` } +// Does not apply to RabbitMQ brokers. +// // Encryption options for the broker. type EncryptionOptions struct { KMSKeyID *string `json:"kmsKeyID,omitempty"` @@ -127,8 +130,10 @@ type EngineVersion struct { Name *string `json:"name,omitempty"` } -// The metadata of the LDAP server used to authenticate and authorize connections -// to the broker. Currently not supported for RabbitMQ engine type. +// Optional. The metadata of the LDAP server used to authenticate and authorize +// connections to the broker. +// +// Does not apply to RabbitMQ brokers. type LDAPServerMetadataInput struct { Hosts []*string `json:"hosts,omitempty"` RoleBase *string `json:"roleBase,omitempty"` @@ -143,8 +148,8 @@ type LDAPServerMetadataInput struct { UserSearchSubtree *bool `json:"userSearchSubtree,omitempty"` } -// The metadata of the LDAP server used to authenticate and authorize connections -// to the broker. +// Optional. The metadata of the LDAP server used to authenticate and authorize +// connections to the broker. type LDAPServerMetadataOutput struct { Hosts []*string `json:"hosts,omitempty"` RoleBase *string `json:"roleBase,omitempty"` @@ -188,7 +193,10 @@ type SanitizationWarning struct { ElementName *string `json:"elementName,omitempty"` } -// A user associated with the broker. +// A user associated with the broker. For RabbitMQ brokers, one and only one +// administrative user is accepted and created when a broker is first provisioned. +// All subsequent broker users are created by making RabbitMQ API calls directly +// to brokers or via the RabbitMQ web console. type User struct { ConsoleAccess *bool `json:"consoleAccess,omitempty"` Groups []*string `json:"groups,omitempty"` @@ -205,7 +213,7 @@ type UserPendingChanges struct { PendingChange *string `json:"pendingChange,omitempty"` } -// Returns a list of all broker users. +// Returns a list of all broker users. Does not apply to RabbitMQ brokers. type UserSummary struct { // The type of change pending for the ActiveMQ user. PendingChange *string `json:"pendingChange,omitempty"` diff --git a/config/controller/deployment.yaml b/config/controller/deployment.yaml index e587030..55b15d3 100644 --- a/config/controller/deployment.yaml +++ b/config/controller/deployment.yaml @@ -61,6 +61,7 @@ spec: drop: - ALL terminationGracePeriodSeconds: 10 + serviceAccountName: ack-mq-controller hostIPC: false hostNetwork: false hostPID: false diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index 12e89c3..7ba98e0 100644 --- a/config/controller/kustomization.yaml +++ b/config/controller/kustomization.yaml @@ -5,5 +5,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: ack-mq-controller - newTag: latest + newName: public.ecr.aws/aws-controllers-k8s/mq-controller + newTag: v0.0.11 diff --git a/config/crd/bases/mq.services.k8s.aws_brokers.yaml b/config/crd/bases/mq.services.k8s.aws_brokers.yaml index 0958931..02d42c5 100644 --- a/config/crd/bases/mq.services.k8s.aws_brokers.yaml +++ b/config/crd/bases/mq.services.k8s.aws_brokers.yaml @@ -41,8 +41,8 @@ spec: autoMinorVersionUpgrade: type: boolean configuration: - description: A list of information about the configuration. Does not - apply to RabbitMQ brokers. + description: "A list of information about the configuration. \n Does + not apply to RabbitMQ brokers." properties: id: type: string @@ -55,7 +55,8 @@ spec: deploymentMode: type: string encryptionOptions: - description: Encryption options for the broker. + description: "Does not apply to RabbitMQ brokers. \n Encryption options + for the broker." properties: kmsKeyID: type: string @@ -69,9 +70,9 @@ spec: hostInstanceType: type: string ldapServerMetadata: - description: The metadata of the LDAP server used to authenticate - and authorize connections to the broker. Currently not supported - for RabbitMQ engine type. + description: "Optional. The metadata of the LDAP server used to authenticate + and authorize connections to the broker. \n Does not apply to RabbitMQ + brokers." properties: hosts: items: @@ -138,7 +139,11 @@ spec: type: object users: items: - description: A user associated with the broker. + description: A user associated with the broker. For RabbitMQ brokers, + one and only one administrative user is accepted and created when + a broker is first provisioned. All subsequent broker users are + created by making RabbitMQ API calls directly to brokers or via + the RabbitMQ web console. properties: consoleAccess: type: boolean @@ -168,6 +173,15 @@ spec: type: string type: object type: array + required: + - autoMinorVersionUpgrade + - deploymentMode + - engineType + - engineVersion + - hostInstanceType + - name + - publiclyAccessible + - users type: object status: description: BrokerStatus defines the observed state of Broker diff --git a/config/rbac/cluster-role-binding.yaml b/config/rbac/cluster-role-binding.yaml index 6a2a818..014e8a9 100644 --- a/config/rbac/cluster-role-binding.yaml +++ b/config/rbac/cluster-role-binding.yaml @@ -8,5 +8,5 @@ roleRef: name: ack-mq-controller subjects: - kind: ServiceAccount - name: default + name: ack-mq-controller namespace: ack-system diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml index 08df5b9..eb7df60 100644 --- a/config/rbac/kustomization.yaml +++ b/config/rbac/kustomization.yaml @@ -3,3 +3,5 @@ resources: - cluster-role-controller.yaml - role-reader.yaml - role-writer.yaml +- service-account.yaml + diff --git a/config/rbac/service-account.yaml b/config/rbac/service-account.yaml new file mode 100644 index 0000000..f21637a --- /dev/null +++ b/config/rbac/service-account.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ack-mq-controller + namespace: ack-system diff --git a/go.mod b/go.mod index 95bf788..213a1cb 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/aws-controllers-k8s/mq-controller go 1.17 require ( - github.com/aws-controllers-k8s/runtime v0.16.3 - github.com/aws/aws-sdk-go v1.37.10 + github.com/aws-controllers-k8s/runtime v0.16.4 + github.com/aws/aws-sdk-go v1.42.0 github.com/go-logr/logr v1.2.0 github.com/spf13/pflag v1.0.5 k8s.io/api v0.23.0 diff --git a/go.sum b/go.sum index 7803d74..1c7a9ef 100644 --- a/go.sum +++ b/go.sum @@ -64,10 +64,10 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws-controllers-k8s/runtime v0.16.3 h1:AaufF1pkfX3M3G4WK6m9OTcI6yEzKnFsffpuWTIy5wY= -github.com/aws-controllers-k8s/runtime v0.16.3/go.mod h1:DHwPczqO/nK4L1kqWlmng5GuIQuX5MSSWbTQMuL4LnM= -github.com/aws/aws-sdk-go v1.37.10 h1:LRwl+97B4D69Z7tz+eRUxJ1C7baBaIYhgrn5eLtua+Q= -github.com/aws/aws-sdk-go v1.37.10/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws-controllers-k8s/runtime v0.16.4 h1:gV8jT09PwaCQWaC46NEnaEggqPm8Lxke6G0f7SxVsys= +github.com/aws-controllers-k8s/runtime v0.16.4/go.mod h1:9c2CL3w0BlVkse+foHlP1SkJRqYWLs9H+4X/z+2kE3w= +github.com/aws/aws-sdk-go v1.42.0 h1:BMZws0t8NAhHFsfnT3B40IwD13jVDG5KerlRksctVIw= +github.com/aws/aws-sdk-go v1.42.0/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -592,6 +592,7 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 533bf65..26fb4b6 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 name: mq-chart description: A Helm chart for the ACK service controller for Amazon MQ (MQ) -version: v0.0.10 -appVersion: v0.0.10 +version: v0.0.11 +appVersion: v0.0.11 home: https://github.com/aws-controllers-k8s/mq-controller icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png sources: diff --git a/helm/crds/mq.services.k8s.aws_brokers.yaml b/helm/crds/mq.services.k8s.aws_brokers.yaml index 0958931..02d42c5 100644 --- a/helm/crds/mq.services.k8s.aws_brokers.yaml +++ b/helm/crds/mq.services.k8s.aws_brokers.yaml @@ -41,8 +41,8 @@ spec: autoMinorVersionUpgrade: type: boolean configuration: - description: A list of information about the configuration. Does not - apply to RabbitMQ brokers. + description: "A list of information about the configuration. \n Does + not apply to RabbitMQ brokers." properties: id: type: string @@ -55,7 +55,8 @@ spec: deploymentMode: type: string encryptionOptions: - description: Encryption options for the broker. + description: "Does not apply to RabbitMQ brokers. \n Encryption options + for the broker." properties: kmsKeyID: type: string @@ -69,9 +70,9 @@ spec: hostInstanceType: type: string ldapServerMetadata: - description: The metadata of the LDAP server used to authenticate - and authorize connections to the broker. Currently not supported - for RabbitMQ engine type. + description: "Optional. The metadata of the LDAP server used to authenticate + and authorize connections to the broker. \n Does not apply to RabbitMQ + brokers." properties: hosts: items: @@ -138,7 +139,11 @@ spec: type: object users: items: - description: A user associated with the broker. + description: A user associated with the broker. For RabbitMQ brokers, + one and only one administrative user is accepted and created when + a broker is first provisioned. All subsequent broker users are + created by making RabbitMQ API calls directly to brokers or via + the RabbitMQ web console. properties: consoleAccess: type: boolean @@ -168,6 +173,15 @@ spec: type: string type: object type: array + required: + - autoMinorVersionUpgrade + - deploymentMode + - engineType + - engineVersion + - hostInstanceType + - name + - publiclyAccessible + - users type: object status: description: BrokerStatus defines the observed state of Broker diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 3ce9d22..69ffc6b 100644 --- a/helm/templates/NOTES.txt +++ b/helm/templates/NOTES.txt @@ -1,5 +1,5 @@ {{ .Chart.Name }} has been installed. -This chart deploys "public.ecr.aws/aws-controllers-k8s/mq-controller:v0.0.10". +This chart deploys "public.ecr.aws/aws-controllers-k8s/mq-controller:v0.0.11". Check its status by running: kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/instance={{ .Release.Name }}" diff --git a/helm/values.yaml b/helm/values.yaml index 329699b..f982fe1 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ image: repository: public.ecr.aws/aws-controllers-k8s/mq-controller - tag: v0.0.10 + tag: v0.0.11 pullPolicy: IfNotPresent pullSecrets: [] diff --git a/pkg/resource/broker/manager.go b/pkg/resource/broker/manager.go index 7f99ccf..45c7278 100644 --- a/pkg/resource/broker/manager.go +++ b/pkg/resource/broker/manager.go @@ -29,6 +29,7 @@ import ( ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" + ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" "github.com/aws/aws-sdk-go/aws/session" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" @@ -37,6 +38,10 @@ import ( svcsdkapi "github.com/aws/aws-sdk-go/service/mq/mqiface" ) +var ( + _ = ackutil.InStrings +) + // +kubebuilder:rbac:groups=mq.services.k8s.aws,resources=brokers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=mq.services.k8s.aws,resources=brokers/status,verbs=get;update;patch @@ -241,6 +246,17 @@ func (rm *resourceManager) lateInitializeFromReadOneOutput( return latest } +// IsSynced returns true if the resource is synced. +func (rm *resourceManager) IsSynced(ctx context.Context, res acktypes.AWSResource) (bool, error) { + r := rm.concreteResource(res) + if r.ko == nil { + // Should never happen... if it does, it's buggy code. + panic("resource manager's IsSynced() method received resource with nil CR object") + } + + return true, nil +} + // newResourceManager returns a new struct implementing // acktypes.AWSResourceManager func newResourceManager( diff --git a/pkg/resource/broker/sdk.go b/pkg/resource/broker/sdk.go index 58fe735..4997cc2 100644 --- a/pkg/resource/broker/sdk.go +++ b/pkg/resource/broker/sdk.go @@ -689,14 +689,29 @@ func (rm *resourceManager) sdkUpdate( } else { ko.Spec.Logs = nil } + if resp.MaintenanceWindowStartTime != nil { + f8 := &svcapitypes.WeeklyStartTime{} + if resp.MaintenanceWindowStartTime.DayOfWeek != nil { + f8.DayOfWeek = resp.MaintenanceWindowStartTime.DayOfWeek + } + if resp.MaintenanceWindowStartTime.TimeOfDay != nil { + f8.TimeOfDay = resp.MaintenanceWindowStartTime.TimeOfDay + } + if resp.MaintenanceWindowStartTime.TimeZone != nil { + f8.TimeZone = resp.MaintenanceWindowStartTime.TimeZone + } + ko.Spec.MaintenanceWindowStartTime = f8 + } else { + ko.Spec.MaintenanceWindowStartTime = nil + } if resp.SecurityGroups != nil { - f8 := []*string{} - for _, f8iter := range resp.SecurityGroups { - var f8elem string - f8elem = *f8iter - f8 = append(f8, &f8elem) + f9 := []*string{} + for _, f9iter := range resp.SecurityGroups { + var f9elem string + f9elem = *f9iter + f9 = append(f9, &f9elem) } - ko.Spec.SecurityGroups = f8 + ko.Spec.SecurityGroups = f9 } else { ko.Spec.SecurityGroups = nil } @@ -791,14 +806,27 @@ func (rm *resourceManager) newUpdateRequestPayload( } res.SetLogs(f7) } + if r.ko.Spec.MaintenanceWindowStartTime != nil { + f8 := &svcsdk.WeeklyStartTime{} + if r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek != nil { + f8.SetDayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek) + } + if r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay != nil { + f8.SetTimeOfDay(*r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay) + } + if r.ko.Spec.MaintenanceWindowStartTime.TimeZone != nil { + f8.SetTimeZone(*r.ko.Spec.MaintenanceWindowStartTime.TimeZone) + } + res.SetMaintenanceWindowStartTime(f8) + } if r.ko.Spec.SecurityGroups != nil { - f8 := []*string{} - for _, f8iter := range r.ko.Spec.SecurityGroups { - var f8elem string - f8elem = *f8iter - f8 = append(f8, &f8elem) + f9 := []*string{} + for _, f9iter := range r.ko.Spec.SecurityGroups { + var f9elem string + f9elem = *f9iter + f9 = append(f9, &f9elem) } - res.SetSecurityGroups(f8) + res.SetSecurityGroups(f9) } return res, nil diff --git a/test/e2e/resources/broker_rabbitmq_non_public.yaml b/test/e2e/resources/broker_rabbitmq_non_public.yaml index 53eafd9..ae8d565 100644 --- a/test/e2e/resources/broker_rabbitmq_non_public.yaml +++ b/test/e2e/resources/broker_rabbitmq_non_public.yaml @@ -4,10 +4,12 @@ metadata: name: $BROKER_NAME spec: name: $BROKER_NAME + autoMinorVersionUpgrade: false deploymentMode: SINGLE_INSTANCE engineType: RabbitMQ engineVersion: $MQ_RABBITMQ_ENGINE_VERSION hostInstanceType: $MQ_HOST_INSTANCE_TYPE + publiclyAccessible: false users: - password: namespace: $ADMIN_USER_PASS_SECRET_NAMESPACE