From 40641a5e6a8edd2f108d63b40f58ad772ef7fb6b 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:51:45 -0800 Subject: [PATCH] Update to ACK runtime `v0.40.0`, code-generator `v0.40.0` (#13) ### 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.0` to `v1.0.1` Once this PR is merged, release `v1.0.1` will be automatically created for `athena-controller` **Please close this PR, if you do not want the new patch release for `athena-controller`** ---------- #### stdout for `make build-controller`: ``` building ack-generate ... ok. ==== building athena-controller ==== Copying common custom resource definitions into athena Building Kubernetes API objects for athena Generating deepcopy code for athena Generating custom resource definitions for athena Building service controller for athena Generating RBAC manifests for athena Running gofmt against generated code for athena Updating additional GitHub repository maintenance files ==== building athena-controller release artifacts ==== Building release artifacts for athena-v1.0.1 Generating common custom resource definitions Generating custom resource definitions for athena Generating RBAC manifests for athena ``` ---------- 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 | 6 +++--- go.sum | 4 ++-- helm/Chart.yaml | 4 ++-- helm/templates/NOTES.txt | 2 +- helm/values.yaml | 6 ++++-- pkg/resource/prepared_statement/descriptor.go | 10 +++++----- pkg/resource/prepared_statement/resource.go | 16 ++++++++++++++++ pkg/resource/work_group/descriptor.go | 10 +++++----- pkg/resource/work_group/resource.go | 11 +++++++++++ 12 files changed, 58 insertions(+), 25 deletions(-) diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index f17513a..b481bfe 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,9 +1,9 @@ ack_generate_info: - build_date: "2024-11-21T16:07:43Z" - build_hash: 36c2d234498c2bc4f60773ab8df632af4067f43b + build_date: "2024-12-09T17:25:01Z" + build_hash: 631aeb190e332addb8379672df6367a0875dce88 go_version: go1.23.3 - version: v0.39.1 -api_directory_checksum: ad45c12f2449e608433458a82064efb493f2e10d + version: v0.40.0 +api_directory_checksum: fba8f2df2f037c855b2aebd81297560cce781ce9 api_version: v1alpha1 aws_sdk_go_version: v1.55.5 generator_config_info: diff --git a/config/controller/deployment.yaml b/config/controller/deployment.yaml index 2de4f71..d8eb8a7 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 d3609b0..4c2e36a 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/athena-controller - newTag: 1.0.0 + newTag: 1.0.1 diff --git a/go.mod b/go.mod index 23faac2..1410ed3 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,11 @@ go 1.22.0 toolchain go1.22.3 require ( - 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.55.5 + github.com/go-logr/logr v1.4.2 github.com/spf13/pflag v1.0.5 + k8s.io/api v0.31.0 k8s.io/apimachinery v0.31.0 k8s.io/client-go v0.31.0 sigs.k8s.io/controller-runtime v0.19.0 @@ -22,7 +24,6 @@ require ( github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -66,7 +67,6 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.31.0 // indirect k8s.io/apiextensions-apiserver v0.31.0 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect diff --git a/go.sum b/go.sum index 5fcf3d5..458b019 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -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.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/helm/Chart.yaml b/helm/Chart.yaml index c493dda..ebabb77 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 name: athena-chart description: A Helm chart for the ACK service controller for Amazon Athena (Athena) -version: 1.0.0 -appVersion: 1.0.0 +version: 1.0.1 +appVersion: 1.0.1 home: https://github.com/aws-controllers-k8s/athena-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 caa9f09..3d78682 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/athena-controller:1.0.0". +This chart deploys "public.ecr.aws/aws-controllers-k8s/athena-controller:1.0.1". 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 0bcdd5b..57b66a2 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ image: repository: public.ecr.aws/aws-controllers-k8s/athena-controller - tag: 1.0.0 + tag: 1.0.1 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/prepared_statement/descriptor.go b/pkg/resource/prepared_statement/descriptor.go index c2c2331..f2dbba1 100644 --- a/pkg/resource/prepared_statement/descriptor.go +++ b/pkg/resource/prepared_statement/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.athena.services.k8s.aws/PreparedStatement" + FinalizerString = "finalizers.athena.services.k8s.aws/PreparedStatement" ) 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/prepared_statement/resource.go b/pkg/resource/prepared_statement/resource.go index 8450c6c..555e2ba 100644 --- a/pkg/resource/prepared_statement/resource.go +++ b/pkg/resource/prepared_statement/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["name"] + if !ok { + return ackerrors.MissingNameIdentifier + } + r.ko.Spec.Name = &tmp + + f1, f1ok := fields["workGroup"] + if f1ok { + r.ko.Spec.WorkGroup = &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/work_group/descriptor.go b/pkg/resource/work_group/descriptor.go index 5cc1f9a..f38a6dc 100644 --- a/pkg/resource/work_group/descriptor.go +++ b/pkg/resource/work_group/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.athena.services.k8s.aws/WorkGroup" + FinalizerString = "finalizers.athena.services.k8s.aws/WorkGroup" ) 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/work_group/resource.go b/pkg/resource/work_group/resource.go index 1c26d8d..45f5e65 100644 --- a/pkg/resource/work_group/resource.go +++ b/pkg/resource/work_group/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["name"] + if !ok { + return ackerrors.MissingNameIdentifier + } + r.ko.Spec.Name = &tmp + + return nil +} + // DeepCopy will return a copy of the resource func (r *resource) DeepCopy() acktypes.AWSResource { koCopy := r.ko.DeepCopy()