Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2025-07-22T22:08:29Z"
build_hash: b2dc0f44e0b08f041de14c3944a5cc005ba97c8f
build_date: "2025-08-08T05:01:52Z"
build_hash: b4fbf4e427daaef74ed873aac01e4a9ca68fb479
go_version: go1.24.5
version: v0.50.0
version: v0.50.0-3-gb4fbf4e
api_directory_checksum: fdaeeb99359feab7411a0ea7a1546597978675dd
api_version: v1alpha1
aws_sdk_go_version: 1.32.6
aws_sdk_go_version: v1.32.6
generator_config_info:
file_checksum: 2440ba630b0f66b3e92fd740afcafbd79da6b0c4
file_checksum: 1b796ebebbf9c9705a7cfb778e9a894f2c62d4ad
original_file_name: generator.yaml
last_modification:
reason: API generation
31 changes: 31 additions & 0 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,34 @@ resources:
template_path: hooks/metricalarm/sdk_read_many_post_build_request.go.tpl
sdk_delete_post_build_request:
template_path: hooks/metricalarm/sdk_delete_post_build_request.go.tpl
RepositoryCreationTemplate:
fields:
templateName:
is_primary_key: true
is_required: true
is_immutable: true
templateArn:
is_read_only: true
createdTime:
is_read_only: true
lastModifiedTime:
is_read_only: true
sourceConfiguration.sourceRepositoryArn:
references:
resource: Repository
path: Status.ACKResourceMetadata.ARN
exceptions:
errors:
404:
code: ResourceNotFoundException
terminal_codes:
- ResourceAlreadyExistsException
- ValidationException
- AccessDeniedException
hooks:
sdk_create_post_set_output:
template_path: hooks/repository_creation_template/sdk_create_post_set_output.go.tpl
sdk_update_pre_build_request:
template_path: hooks/repository_creation_template/sdk_update_pre_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/repository_creation_template/sdk_read_one_post_set_output.go.tpl
2 changes: 1 addition & 1 deletion config/controller/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kind: Kustomization
images:
- name: controller
newName: public.ecr.aws/aws-controllers-k8s/cloudwatch-controller
newTag: 1.0.13
newTag: 0.0.0-non-release-version
31 changes: 31 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,34 @@ resources:
template_path: hooks/metricalarm/sdk_read_many_post_build_request.go.tpl
sdk_delete_post_build_request:
template_path: hooks/metricalarm/sdk_delete_post_build_request.go.tpl
RepositoryCreationTemplate:
fields:
templateName:
is_primary_key: true
is_required: true
is_immutable: true
templateArn:
is_read_only: true
createdTime:
is_read_only: true
lastModifiedTime:
is_read_only: true
sourceConfiguration.sourceRepositoryArn:
references:
resource: Repository
path: Status.ACKResourceMetadata.ARN
exceptions:
errors:
404:
code: ResourceNotFoundException
terminal_codes:
- ResourceAlreadyExistsException
- ValidationException
- AccessDeniedException
hooks:
sdk_create_post_set_output:
template_path: hooks/repository_creation_template/sdk_create_post_set_output.go.tpl
sdk_update_pre_build_request:
template_path: hooks/repository_creation_template/sdk_update_pre_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/repository_creation_template/sdk_read_one_post_set_output.go.tpl
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/aws/smithy-go v1.22.2
github.com/go-logr/logr v1.4.2
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
k8s.io/api v0.32.1
k8s.io/apimachinery v0.32.1
k8s.io/client-go v0.32.1
Expand Down Expand Up @@ -52,18 +53,21 @@ require (
github.com/itchyny/gojq v0.12.6 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect
github.com/jaypipes/envutil v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/samber/lo v1.37.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ github.com/jaypipes/envutil v1.0.0 h1:u6Vwy9HwruFihoZrL0bxDLCa/YNadGVwKyPElNmZWo
github.com/jaypipes/envutil v1.0.0/go.mod h1:vgIRDly+xgBq0eeZRcflOHMMobMwgC6MkMbxo/Nw65M=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down Expand Up @@ -216,6 +218,9 @@ gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSP
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
name: cloudwatch-chart
description: A Helm chart for the ACK service controller for Amazon CloudWatch (CloudWatch)
version: 1.0.13
appVersion: 1.0.13
version: 0.0.0-non-release-version
appVersion: 0.0.0-non-release-version
home: https://github.com/aws-controllers-k8s/cloudwatch-controller
icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png
sources:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ .Chart.Name }} has been installed.
This chart deploys "public.ecr.aws/aws-controllers-k8s/cloudwatch-controller:1.0.13".
This chart deploys "public.ecr.aws/aws-controllers-k8s/cloudwatch-controller:0.0.0-non-release-version".

Check its status by running:
kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/instance={{ .Release.Name }}"
Expand Down
4 changes: 2 additions & 2 deletions helm/templates/caches-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "ack-cloudwatch-controller.app.fullname" . }}-namespace-caches
name: {{ include "ack-cloudwatch-controller.app.fullname" . }}-namespaces-cache
labels:
app.kubernetes.io/name: {{ include "ack-cloudwatch-controller.app.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Expand All @@ -12,7 +12,7 @@ metadata:
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: {{ include "ack-cloudwatch-controller.app.fullname" . }}-namespace-caches
name: {{ include "ack-cloudwatch-controller.app.fullname" . }}-namespaces-cache
subjects:
- kind: ServiceAccount
name: {{ include "ack-cloudwatch-controller.service-account.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ spec:
secretName: {{ .Values.aws.credentials.secretName }}
{{- end }}
{{- if .Values.deployment.extraVolumes }}
{{ toYaml .Values.deployment.extraVolumes | indent 8 }}
{{- toYaml .Values.deployment.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.deployment.strategy }}
Expand Down
2 changes: 1 addition & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

image:
repository: public.ecr.aws/aws-controllers-k8s/cloudwatch-controller
tag: 1.0.13
tag: 0.0.0-non-release-version
pullPolicy: IfNotPresent
pullSecrets: []

Expand Down
Binary file added main
Binary file not shown.
63 changes: 63 additions & 0 deletions pkg/repository_creation_template/hooks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

package repository_creation_template

import (
"context"

"github.com/aws-controllers-k8s/cloudwatch-controller/pkg/tags"
)

// getTags retrieves the tags for a given RepositoryCreationTemplate
func (rm *resourceManager) getTags(
ctx context.Context,
resourceARN string,
) map[string]*string {
tagsManager := tags.NewTagsManager(rm.sdkapi)
tags, err := tagsManager.GetTags(ctx, resourceARN)
if err != nil {
return nil
}
return tags
}

// syncTags synchronizes the tags for a RepositoryCreationTemplate
func (rm *resourceManager) syncTags(
ctx context.Context,
latest *resource,
desired *resource,
) error {
if latest.ko.Status.TemplateARN == nil {
return nil
}

resourceARN := *latest.ko.Status.TemplateARN
latestTags := map[string]*string{}
if latest.ko.Spec.Tags != nil {
latestTags = latest.ko.Spec.Tags
}

desiredTags := map[string]*string{}
if desired.ko.Spec.Tags != nil {
desiredTags = desired.ko.Spec.Tags
}

tagsManager := tags.NewTagsManager(rm.sdkapi)
return tagsManager.SyncTags(
ctx,
resourceARN,
desiredTags,
latestTags,
)
}
Loading