From 1c88bdc9ea1569a52d7133391dbf995e05275110 Mon Sep 17 00:00:00 2001 From: AWS Controllers for Kubernetes Bot <82905295+ack-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:40:44 -0800 Subject: [PATCH] Update to ACK runtime `v0.40.0`, code-generator `v0.40.0` (#24) ### Update to ACK runtime `v0.40.0`, code-generator `v0.40.0` ---------- * ACK code-generator `v0.40.0` [release notes](https://github.com/aws-controllers-k8s/code-generator/releases/tag/v0.40.0) * ACK runtime `v0.40.0` [release notes](https://github.com/aws-controllers-k8s/runtime/releases/tag/v0.40.0) ---------- NOTE: This PR increments the release version of service controller from `v1.0.1` to `v1.0.2` Once this PR is merged, release `v1.0.2` will be automatically created for `efs-controller` **Please close this PR, if you do not want the new patch release for `efs-controller`** ---------- #### stdout for `make build-controller`: ``` building ack-generate ... ok. ==== building efs-controller ==== Copying common custom resource definitions into efs Building Kubernetes API objects for efs Generating deepcopy code for efs Generating custom resource definitions for efs Building service controller for efs Generating RBAC manifests for efs Running gofmt against generated code for efs Updating additional GitHub repository maintenance files ==== building efs-controller release artifacts ==== Building release artifacts for efs-v1.0.2 Generating common custom resource definitions Generating custom resource definitions for efs Generating RBAC manifests for efs ``` ---------- 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 | 8 ++++---- config/controller/deployment.yaml | 4 ++++ config/controller/kustomization.yaml | 2 +- go.mod | 2 +- go.sum | 4 ++-- helm/Chart.yaml | 4 ++-- helm/templates/NOTES.txt | 2 +- helm/templates/caches-role-binding.yaml | 6 +++--- helm/values.yaml | 6 ++++-- pkg/resource/access_point/descriptor.go | 10 +++++----- pkg/resource/access_point/resource.go | 16 ++++++++++++++++ pkg/resource/file_system/descriptor.go | 10 +++++----- pkg/resource/file_system/resource.go | 11 +++++++++++ pkg/resource/mount_target/descriptor.go | 10 +++++----- pkg/resource/mount_target/resource.go | 16 ++++++++++++++++ 15 files changed, 80 insertions(+), 31 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 7fabe43..c629bb8 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,8 +1,8 @@ ack_generate_info: - build_date: "2024-10-10T04:02:47Z" - build_hash: 36c2d234498c2bc4f60773ab8df632af4067f43b - go_version: go1.23.2 - version: v0.39.1 + build_date: "2024-12-09T17:36:10Z" + build_hash: 631aeb190e332addb8379672df6367a0875dce88 + go_version: go1.23.3 + version: v0.40.0 api_directory_checksum: 3dac0a046021e0a9f5828ed93eb269ab4d4420a0 api_version: v1alpha1 aws_sdk_go_version: v1.50.0 diff --git a/config/controller/deployment.yaml b/config/controller/deployment.yaml index 5725efb..ffc19dc 100644 --- a/config/controller/deployment.yaml +++ b/config/controller/deployment.yaml @@ -41,6 +41,8 @@ spec: - "$(LEADER_ELECTION_NAMESPACE)" - --reconcile-default-max-concurrent-syncs - "$(RECONCILE_DEFAULT_MAX_CONCURRENT_SYNCS)" + - --feature-gates + - "$(FEATURE_GATES)" image: controller:latest name: controller ports: @@ -76,6 +78,8 @@ spec: value: "ack-system" - name: "RECONCILE_DEFAULT_MAX_CONCURRENT_SYNCS" value: "1" + - name: "FEATURE_GATES" + value: "" securityContext: allowPrivilegeEscalation: false privileged: false diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index 48dfacb..f5b8c15 100644 --- a/config/controller/kustomization.yaml +++ b/config/controller/kustomization.yaml @@ -6,4 +6,4 @@ kind: Kustomization images: - name: controller newName: public.ecr.aws/aws-controllers-k8s/efs-controller - newTag: 1.0.1 + newTag: 1.0.2 diff --git a/go.mod b/go.mod index 91ba249..be02f8e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.5 require ( github.com/aws-controllers-k8s/ec2-controller v1.2.2 github.com/aws-controllers-k8s/kms-controller v1.0.9 - github.com/aws-controllers-k8s/runtime v0.39.0 + github.com/aws-controllers-k8s/runtime v0.40.0 github.com/aws/aws-sdk-go v1.49.24 github.com/go-logr/logr v1.4.2 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 4d4d2d8..f4183f4 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/aws-controllers-k8s/ec2-controller v1.2.2 h1:ek/cGd76XTWQXe6185nxrmEm github.com/aws-controllers-k8s/ec2-controller v1.2.2/go.mod h1:4e2L1aHo1fk3ihVTRmnhA6VJ2NSSoYPEf1GZNYYPwLw= github.com/aws-controllers-k8s/kms-controller v1.0.9 h1:GZHSnuZBoWp9r6RaJ3siyDn5BRhDuaZJXtdBKeAiLSw= github.com/aws-controllers-k8s/kms-controller v1.0.9/go.mod h1:Pnz0d5sly7dUgmYMDJWSRIKASOujJFi/b8N2q1qCLqU= -github.com/aws-controllers-k8s/runtime v0.39.0 h1:IgOXluSzvb4UcDr9eU7SPw5MJnL7kt5R6DuF5Qu9zVQ= -github.com/aws-controllers-k8s/runtime v0.39.0/go.mod h1:G07g26y1cxyZO6Ngp+LwXf03CqFyLNL7os4Py4IdyGY= +github.com/aws-controllers-k8s/runtime v0.40.0 h1:FplFYgzCIbQsPafarP3dy/4bG1uGR8G1OLYOWO4a7Lc= +github.com/aws-controllers-k8s/runtime v0.40.0/go.mod h1:G07g26y1cxyZO6Ngp+LwXf03CqFyLNL7os4Py4IdyGY= github.com/aws/aws-sdk-go v1.49.24 h1:2ekq9ZvaoB2aRbTDfARzgVGUBB9N8XD2QYhFmTBlp+c= github.com/aws/aws-sdk-go v1.49.24/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 955b576..6750f16 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 name: efs-chart description: A Helm chart for the ACK service controller for Amazon Elastic File System (EFS) -version: 1.0.1 -appVersion: 1.0.1 +version: 1.0.2 +appVersion: 1.0.2 home: https://github.com/aws-controllers-k8s/efs-controller icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png sources: diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 40dee6f..449501a 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/efs-controller:1.0.1". +This chart deploys "public.ecr.aws/aws-controllers-k8s/efs-controller:1.0.2". Check its status by running: kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/instance={{ .Release.Name }}" diff --git a/helm/templates/caches-role-binding.yaml b/helm/templates/caches-role-binding.yaml index 25ba0d3..e6efb41 100644 --- a/helm/templates/caches-role-binding.yaml +++ b/helm/templates/caches-role-binding.yaml @@ -8,7 +8,7 @@ roleRef: name: ack-namespaces-cache-efs-controller subjects: - kind: ServiceAccount - name: ack-efs-controller + name: {{ include "ack-efs-controller.service-account.name" . }} namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 @@ -22,5 +22,5 @@ roleRef: name: ack-configmaps-cache-efs-controller subjects: - kind: ServiceAccount - name: ack-efs-controller - namespace: {{ .Release.Namespace }} \ No newline at end of file + name: {{ include "ack-efs-controller.service-account.name" . }} + namespace: {{ .Release.Namespace }} diff --git a/helm/values.yaml b/helm/values.yaml index 3a32068..426f595 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ image: repository: public.ecr.aws/aws-controllers-k8s/efs-controller - tag: 1.0.1 + tag: 1.0.2 pullPolicy: IfNotPresent pullSecrets: [] @@ -163,4 +163,6 @@ featureGates: # Enables the Team level granularity for CARM. See https://github.com/aws-controllers-k8s/community/issues/2031 TeamLevelCARM: false # Enable ReadOnlyResources feature/annotation. - ReadOnlyResources: false \ No newline at end of file + ReadOnlyResources: false + # Enable ResourceAdoption feature/annotation. + ResourceAdoption: false \ No newline at end of file diff --git a/pkg/resource/access_point/descriptor.go b/pkg/resource/access_point/descriptor.go index 3b2fe54..3a900c7 100644 --- a/pkg/resource/access_point/descriptor.go +++ b/pkg/resource/access_point/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.efs.services.k8s.aws/AccessPoint" + FinalizerString = "finalizers.efs.services.k8s.aws/AccessPoint" ) var ( @@ -88,8 +88,8 @@ func (d *resourceDescriptor) IsManaged( // https://github.com/kubernetes-sigs/controller-runtime/issues/994 is // fixed. This should be able to be: // - // return k8sctrlutil.ContainsFinalizer(obj, finalizerString) - return containsFinalizer(obj, finalizerString) + // return k8sctrlutil.ContainsFinalizer(obj, FinalizerString) + return containsFinalizer(obj, FinalizerString) } // Remove once https://github.com/kubernetes-sigs/controller-runtime/issues/994 @@ -118,7 +118,7 @@ func (d *resourceDescriptor) MarkManaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.AddFinalizer(obj, finalizerString) + k8sctrlutil.AddFinalizer(obj, FinalizerString) } // MarkUnmanaged removes the supplied resource from management by ACK. What @@ -133,7 +133,7 @@ func (d *resourceDescriptor) MarkUnmanaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.RemoveFinalizer(obj, finalizerString) + k8sctrlutil.RemoveFinalizer(obj, FinalizerString) } // MarkAdopted places descriptors on the custom resource that indicate the diff --git a/pkg/resource/access_point/resource.go b/pkg/resource/access_point/resource.go index 5df0834..8cebb27 100644 --- a/pkg/resource/access_point/resource.go +++ b/pkg/resource/access_point/resource.go @@ -98,6 +98,22 @@ func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error return nil } +// PopulateResourceFromAnnotation populates the fields passed from adoption annotation +func (r *resource) PopulateResourceFromAnnotation(fields map[string]string) error { + tmp, ok := fields["accessPointID"] + if !ok { + return ackerrors.MissingNameIdentifier + } + r.ko.Status.AccessPointID = &tmp + + f1, f1ok := fields["fileSystemID"] + if f1ok { + r.ko.Spec.FileSystemID = &f1 + } + + return nil +} + // DeepCopy will return a copy of the resource func (r *resource) DeepCopy() acktypes.AWSResource { koCopy := r.ko.DeepCopy() diff --git a/pkg/resource/file_system/descriptor.go b/pkg/resource/file_system/descriptor.go index e118596..4f1d112 100644 --- a/pkg/resource/file_system/descriptor.go +++ b/pkg/resource/file_system/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.efs.services.k8s.aws/FileSystem" + FinalizerString = "finalizers.efs.services.k8s.aws/FileSystem" ) var ( @@ -88,8 +88,8 @@ func (d *resourceDescriptor) IsManaged( // https://github.com/kubernetes-sigs/controller-runtime/issues/994 is // fixed. This should be able to be: // - // return k8sctrlutil.ContainsFinalizer(obj, finalizerString) - return containsFinalizer(obj, finalizerString) + // return k8sctrlutil.ContainsFinalizer(obj, FinalizerString) + return containsFinalizer(obj, FinalizerString) } // Remove once https://github.com/kubernetes-sigs/controller-runtime/issues/994 @@ -118,7 +118,7 @@ func (d *resourceDescriptor) MarkManaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.AddFinalizer(obj, finalizerString) + k8sctrlutil.AddFinalizer(obj, FinalizerString) } // MarkUnmanaged removes the supplied resource from management by ACK. What @@ -133,7 +133,7 @@ func (d *resourceDescriptor) MarkUnmanaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.RemoveFinalizer(obj, finalizerString) + k8sctrlutil.RemoveFinalizer(obj, FinalizerString) } // MarkAdopted places descriptors on the custom resource that indicate the diff --git a/pkg/resource/file_system/resource.go b/pkg/resource/file_system/resource.go index cfc2f67..b6f8fba 100644 --- a/pkg/resource/file_system/resource.go +++ b/pkg/resource/file_system/resource.go @@ -93,6 +93,17 @@ func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error return nil } +// PopulateResourceFromAnnotation populates the fields passed from adoption annotation +func (r *resource) PopulateResourceFromAnnotation(fields map[string]string) error { + tmp, ok := fields["fileSystemID"] + if !ok { + return ackerrors.MissingNameIdentifier + } + r.ko.Status.FileSystemID = &tmp + + return nil +} + // DeepCopy will return a copy of the resource func (r *resource) DeepCopy() acktypes.AWSResource { koCopy := r.ko.DeepCopy() diff --git a/pkg/resource/mount_target/descriptor.go b/pkg/resource/mount_target/descriptor.go index f591d23..bfe7e3f 100644 --- a/pkg/resource/mount_target/descriptor.go +++ b/pkg/resource/mount_target/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.efs.services.k8s.aws/MountTarget" + FinalizerString = "finalizers.efs.services.k8s.aws/MountTarget" ) var ( @@ -88,8 +88,8 @@ func (d *resourceDescriptor) IsManaged( // https://github.com/kubernetes-sigs/controller-runtime/issues/994 is // fixed. This should be able to be: // - // return k8sctrlutil.ContainsFinalizer(obj, finalizerString) - return containsFinalizer(obj, finalizerString) + // return k8sctrlutil.ContainsFinalizer(obj, FinalizerString) + return containsFinalizer(obj, FinalizerString) } // Remove once https://github.com/kubernetes-sigs/controller-runtime/issues/994 @@ -118,7 +118,7 @@ func (d *resourceDescriptor) MarkManaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.AddFinalizer(obj, finalizerString) + k8sctrlutil.AddFinalizer(obj, FinalizerString) } // MarkUnmanaged removes the supplied resource from management by ACK. What @@ -133,7 +133,7 @@ func (d *resourceDescriptor) MarkUnmanaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.RemoveFinalizer(obj, finalizerString) + k8sctrlutil.RemoveFinalizer(obj, FinalizerString) } // MarkAdopted places descriptors on the custom resource that indicate the diff --git a/pkg/resource/mount_target/resource.go b/pkg/resource/mount_target/resource.go index 470206b..5604f52 100644 --- a/pkg/resource/mount_target/resource.go +++ b/pkg/resource/mount_target/resource.go @@ -98,6 +98,22 @@ func (r *resource) SetIdentifiers(identifier *ackv1alpha1.AWSIdentifiers) error return nil } +// PopulateResourceFromAnnotation populates the fields passed from adoption annotation +func (r *resource) PopulateResourceFromAnnotation(fields map[string]string) error { + tmp, ok := fields["mountTargetID"] + if !ok { + return ackerrors.MissingNameIdentifier + } + r.ko.Status.MountTargetID = &tmp + + f1, f1ok := fields["fileSystemID"] + if f1ok { + r.ko.Spec.FileSystemID = &f1 + } + + return nil +} + // DeepCopy will return a copy of the resource func (r *resource) DeepCopy() acktypes.AWSResource { koCopy := r.ko.DeepCopy()