Skip to content
Merged
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
12 changes: 6 additions & 6 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ack_generate_info:
build_date: "2023-08-04T16:51:02Z"
build_hash: e9b68590da73ce9143ba1e4361cebdc1d876c81e
go_version: go1.20.7
version: v0.26.1-7-ge9b6859-dirty
api_directory_checksum: e21bfad36ac581912d611c9c390ab4bd2c2fb46d
build_date: "2023-12-14T21:33:50Z"
build_hash: 1f16813c807af6889060b4ce7ded2a69dc027d8c
go_version: go1.21.5
version: v0.28.0
api_directory_checksum: 5a8c4d91df5604e5364afdecbc88814f06a8ab26
api_version: v1alpha1
aws_sdk_go_version: v1.44.303
aws_sdk_go_version: v1.49.0
generator_config_info:
file_checksum: 2440ba630b0f66b3e92fd740afcafbd79da6b0c4
original_file_name: generator.yaml
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha1/enums.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 40 additions & 11 deletions apis/v1alpha1/metric_alarm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions cmd/controller/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions config/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ spec:
- "$(AWS_REGION)"
- --aws-endpoint-url
- "$(AWS_ENDPOINT_URL)"
- --enable-development-logging
- "$(ACK_ENABLE_DEVELOPMENT_LOGGING)"
- --enable-development-logging=$(ACK_ENABLE_DEVELOPMENT_LOGGING)
- --log-level
- "$(ACK_LOG_LEVEL)"
- --resource-tags
- "$(ACK_RESOURCE_TAGS)"
- --watch-namespace
- "$(ACK_WATCH_NAMESPACE)"
- --enable-leader-election=$(ENABLE_LEADER_ELECTION)
- --leader-election-namespace
- "$(LEADER_ELECTION_NAMESPACE)"
image: controller:latest
name: controller
ports:
Expand Down Expand Up @@ -66,6 +68,10 @@ spec:
value: "info"
- name: ACK_RESOURCE_TAGS
value: "services.k8s.aws/controller-version=%CONTROLLER_SERVICE%-%CONTROLLER_VERSION%,services.k8s.aws/namespace=%K8S_NAMESPACE%"
- name: ENABLE_LEADER_ELECTION
value: "false"
- name: LEADER_ELECTION_NAMESPACE
value: "ack-system"
securityContext:
allowPrivilegeEscalation: false
privileged: false
Expand All @@ -79,5 +85,6 @@ spec:
terminationGracePeriodSeconds: 10
serviceAccountName: ack-cloudwatch-controller
hostIPC: false
hostNetwork: false
hostPID: false
hostNetwork: false
dnsPolicy: ClusterFirst
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: 0.0.2
newTag: 0.0.3
69 changes: 40 additions & 29 deletions config/crd/bases/cloudwatch.services.k8s.aws_metricalarms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,17 @@ spec:
format: int64
type: integer
extendedStatistic:
description: The percentile statistic for the metric specified in
MetricName. Specify a value between p0.0 and p100. When you call
PutMetricAlarm and specify a MetricName, you must specify either
Statistic or ExtendedStatistic, but not both.
description: "The extended statistic for the metric specified in MetricName.
When you call PutMetricAlarm and specify a MetricName, you must
specify either Statistic or ExtendedStatistic but not both. \n If
you specify ExtendedStatistic, the following are valid values: \n
* p90 \n * tm90 \n * tc90 \n * ts90 \n * wm90 \n * IQM \n * PR(n:m)
where n and m are values of the metric \n * TC(X%:X%) where X is
between 10 and 90 inclusive. \n * TM(X%:X%) where X is between 10
and 90 inclusive. \n * TS(X%:X%) where X is between 10 and 90 inclusive.
\n * WM(X%:X%) where X is between 10 and 90 inclusive. \n For more
information about these extended statistics, see CloudWatch statistics
definitions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html)."
type: string
insufficientDataActions:
description: "The actions to execute when this alarm transitions to
Expand All @@ -139,9 +146,9 @@ spec:
description: "The name for the metric associated with the alarm. For
each PutMetricAlarm operation, you must specify either MetricName
or a Metrics array. \n If you are creating an alarm based on a math
expression, you cannot specify this parameter, or any of the Dimensions,
Period, Namespace, Statistic, or ExtendedStatistic parameters. Instead,
you specify all this information in the Metrics array."
expression, you cannot specify this parameter, or any of the Namespace,
Dimensions, Period, Unit, Statistic, or ExtendedStatistic parameters.
Instead, you specify all this information in the Metrics array."
type: string
metrics:
description: "An array of MetricDataQuery structures that enable you
Expand All @@ -152,11 +159,11 @@ spec:
array is the expression that the alarm watches. You designate this
expression by setting ReturnData to true for this object in the
array. For more information, see MetricDataQuery (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html).
\n If you use the Metrics parameter, you cannot include the MetricName,
Dimensions, Period, Namespace, Statistic, or ExtendedStatistic parameters
of PutMetricAlarm in the same operation. Instead, you retrieve the
metrics you are using in your math expression as part of the Metrics
array."
\n If you use the Metrics parameter, you cannot include the Namespace,
MetricName, Dimensions, Period, Unit, Statistic, or ExtendedStatistic
parameters of PutMetricAlarm in the same operation. Instead, you
retrieve the metrics you are using in your math expression as part
of the Metrics array."
items:
description: "This structure is used in both GetMetricData and PutMetricAlarm.
The supported use of this structure is different for those two
Expand Down Expand Up @@ -290,13 +297,15 @@ spec:
type: string
tags:
description: "A list of key-value pairs to associate with the alarm.
You can associate as many as 50 tags with an alarm. \n Tags can
help you organize and categorize your resources. You can also use
them to scope user permissions by granting a user permission to
access or change only resources with certain tag values. \n If you
are using this operation to update an existing alarm, any tags you
specify in this parameter are ignored. To change the tags of an
existing alarm, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html)
You can associate as many as 50 tags with an alarm. To be able to
associate tags with the alarm when you create the alarm, you must
have the cloudwatch:TagResource permission. \n Tags can help you
organize and categorize your resources. You can also use them to
scope user permissions by granting a user permission to access or
change only resources with certain tag values. \n If you are using
this operation to update an existing alarm, any tags you specify
in this parameter are ignored. To change the tags of an existing
alarm, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html)
or UntagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html)."
items:
description: A key-value pair associated with a CloudWatch resource.
Expand Down Expand Up @@ -337,16 +346,18 @@ spec:
all network interfaces. You can also specify a unit when you create
a custom metric. Units help provide conceptual meaning to your data.
Metric data points that specify a unit of measure, such as Percent,
are aggregated separately. \n If you don't specify Unit, CloudWatch
retrieves all unit types that have been published for the metric
and attempts to evaluate the alarm. Usually, metrics are published
with only one unit, so the alarm works as intended. \n However,
if the metric is published with multiple types of units and you
don't specify a unit, the alarm's behavior is not defined and it
behaves unpredictably. \n We recommend omitting Unit so that you
don't inadvertently specify an incorrect unit that is not published
for this metric. Doing so causes the alarm to be stuck in the INSUFFICIENT
DATA state."
are aggregated separately. If you are creating an alarm based on
a metric math expression, you can specify the unit for each metric
(if needed) within the objects in the Metrics array. \n If you don't
specify Unit, CloudWatch retrieves all unit types that have been
published for the metric and attempts to evaluate the alarm. Usually,
metrics are published with only one unit, so the alarm works as
intended. \n However, if the metric is published with multiple types
of units and you don't specify a unit, the alarm's behavior is not
defined and it behaves unpredictably. \n We recommend omitting Unit
so that you don't inadvertently specify an incorrect unit that is
not published for this metric. Doing so causes the alarm to be stuck
in the INSUFFICIENT DATA state."
type: string
required:
- comparisonOperator
Expand Down
3 changes: 2 additions & 1 deletion config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ resources:
- role-reader.yaml
- role-writer.yaml
- service-account.yaml

- leader-election-role.yaml
- leader-election-role-binding.yaml
14 changes: 14 additions & 0 deletions config/rbac/leader-election-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: ack-system
name: cloudwatch-leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: cloudwatch-leader-election-role
subjects:
- kind: ServiceAccount
name: ack-cloudwatch-controller
namespace: ack-system
26 changes: 26 additions & 0 deletions config/rbac/leader-election-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cloudwatch-leader-election-role
namespace: ack-system
rules:
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/aws-controllers-k8s/cloudwatch-controller
go 1.19

require (
github.com/aws-controllers-k8s/runtime v0.26.0
github.com/aws/aws-sdk-go v1.44.303
github.com/aws-controllers-k8s/runtime v0.28.0
github.com/aws/aws-sdk-go v1.49.0
github.com/go-logr/logr v1.2.3
github.com/spf13/pflag v1.0.5
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
k8s.io/api v0.26.8
k8s.io/apimachinery v0.26.8
k8s.io/client-go v0.26.8
sigs.k8s.io/controller-runtime v0.14.5
)

Expand All @@ -31,7 +31,7 @@ require (
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/itchyny/gojq v0.12.6 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect
Expand All @@ -54,11 +54,11 @@ require (
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
Loading