Skip to content
Closed
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
8 changes: 4 additions & 4 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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
build_date: "2023-12-14T22:37:33Z"
build_hash: 1f16813c807af6889060b4ce7ded2a69dc027d8c
go_version: go1.21.4
version: v0.27.1-9-g1f16813
api_directory_checksum: e21bfad36ac581912d611c9c390ab4bd2c2fb46d
api_version: v1alpha1
aws_sdk_go_version: v1.44.303
Expand Down
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
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
23 changes: 15 additions & 8 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
k8s-app: {{ include "app.name" . }}
helm.sh/chart: {{ include "chart.name-version" . }}
spec:
replicas: 1
replicas: {{ .Values.deployment.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "app.name" . }}
Expand Down Expand Up @@ -48,8 +48,9 @@ spec:
- "$(AWS_REGION)"
- --aws-endpoint-url
- "$(AWS_ENDPOINT_URL)"
{{- if .Values.log.enable_development_logging }}
- --enable-development-logging
- "$(ACK_ENABLE_DEVELOPMENT_LOGGING)"
{{- end }}
- --log-level
- "$(ACK_LOG_LEVEL)"
- --resource-tags
Expand All @@ -58,6 +59,11 @@ spec:
- "$(ACK_WATCH_NAMESPACE)"
- --deletion-policy
- "$(DELETION_POLICY)"
{{- if .Values.leaderElection.enabled }}
- --enable-leader-election
- --leader-election-namespace
- "$(LEADER_ELECTION_NAMESPACE)"
{{- end }}
{{- if gt .Values.reconcile.defaultResyncPeriod 0.0 }}
- --reconcile-default-resync-seconds
- "$(RECONCILE_DEFAULT_RESYNC_SECONDS)"
Expand Down Expand Up @@ -87,8 +93,8 @@ spec:
value: {{ include "watch-namespace" . }}
- name: DELETION_POLICY
value: {{ .Values.deletionPolicy }}
- name: ACK_ENABLE_DEVELOPMENT_LOGGING
value: {{ .Values.log.enable_development_logging | quote }}
- name: LEADER_ELECTION_NAMESPACE
value: {{ .Values.leaderElection.namespace | quote }}
- name: ACK_LOG_LEVEL
value: {{ .Values.log.level | quote }}
- name: ACK_RESOURCE_TAGS
Expand Down Expand Up @@ -117,7 +123,7 @@ spec:
readOnly: true
{{- end }}
{{- if .Values.deployment.extraVolumeMounts -}}
{{ toYaml .Values.deployment.extraVolumeMounts | nindent 12 }}
{{ toYaml .Values.deployment.extraVolumeMounts | nindent 10 }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
Expand All @@ -141,14 +147,15 @@ spec:
priorityClassName: {{ .Values.deployment.priorityClassName }}
{{ end -}}
hostIPC: false
hostNetwork: false
hostPID: false
hostNetwork: {{ .Values.deployment.hostNetwork }}
dnsPolicy: {{ .Values.deployment.dnsPolicy }}
volumes:
{{- if .Values.aws.credentials.secretName -}}
{{- if .Values.aws.credentials.secretName }}
- name: {{ .Values.aws.credentials.secretName }}
secret:
secretName: {{ .Values.aws.credentials.secretName }}
{{ end -}}
{{- end }}
{{- if .Values.deployment.extraVolumes }}
{{ toYaml .Values.deployment.extraVolumes | indent 8}}
{{- end }}
18 changes: 18 additions & 0 deletions helm/templates/leader-election-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{ if .Values.leaderElection.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cloudwatch-leader-election-rolebinding
{{ if .Values.leaderElection.namespace }}
namespace: {{ .Values.leaderElection.namespace }}
{{ else }}
namespace: {{ .Release.Namespace }}
{{ end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: cloudwatch-leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "service-account.name" . }}
namespace: {{ .Release.Namespace }}{{- end }}
30 changes: 30 additions & 0 deletions helm/templates/leader-election-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ if .Values.leaderElection.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cloudwatch-leader-election-role
{{ if .Values.leaderElection.namespace }}
namespace: {{ .Values.leaderElection.namespace }}
{{ else }}
namespace: {{ .Release.Namespace }}
{{ end }}
rules:
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch{{- end }}
15 changes: 15 additions & 0 deletions helm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"minimum": 1,
"maximum": 65535
},
"replicas": {
"type": "integer"
},
"nodeSelector": {
"type": "object"
},
Expand Down Expand Up @@ -231,6 +234,18 @@
},
"type": "object"
},
"leaderElection": {
"description": "Parameter to configure the controller's leader election system.",
"properties": {
"enabled": {
"type": "boolean"
},
"namespace": {
"type": "string"
}
},
"type": "object"
},
"serviceAccount": {
"description": "ServiceAccount settings",
"properties": {
Expand Down
29 changes: 27 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ deployment:
annotations: {}
labels: {}
containerPort: 8080
# Number of Deployment replicas
# This determines how many instances of the controller will be running. It's recommended
# to enable leader election if you need to increase the number of replicas > 1
replicas: 1
# Which nodeSelector to set?
# See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector
nodeSelector:
Expand All @@ -28,6 +32,15 @@ deployment:
# Which priorityClassName to set?
# See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority
priorityClassName: ""
# Specifies the hostname of the Pod.
# If not specified, the pod's hostname will be set to a system-defined value.
hostNetwork: false
# Set DNS policy for the pod.
# Defaults to "ClusterFirst".
# Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'.
# To have DNS options set along with hostNetwork, you have to specify DNS policy
# explicitly to 'ClusterFirstWithHostNet'.
dnsPolicy: ClusterFirst
extraVolumes: []
extraVolumeMounts: []

Expand All @@ -52,7 +65,7 @@ deployment:
# If "installScope: cluster" then these labels will be applied to ClusterRole
role:
labels: {}

metrics:
service:
# Set to true to automatically create a Kubernetes Service resource for the
Expand Down Expand Up @@ -80,7 +93,7 @@ aws:
# Secret stringData key that contains the credentials
secretKey: "credentials"
# Profile used for AWS credentials
profile: "default"
profile: "default"

# log level for the controller
log:
Expand Down Expand Up @@ -121,3 +134,15 @@ serviceAccount:
name: ack-cloudwatch-controller
annotations: {}
# eks.amazonaws.com/role-arn: arn:aws:iam::AWS_ACCOUNT_ID:role/IAM_ROLE_NAME

# Configuration of the leader election. Required for running multiple instances of the
# controller within the same cluster.
# See https://kubernetes.io/docs/concepts/architecture/leases/#leader-election
leaderElection:
# Enable Controller Leader Election. Set this to true to enable leader election
# for this controller.
enabled: false
# Leader election can be scoped to a specific namespace. By default, the controller
# will attempt to use the namespace of the service account mounted to the Controller
# pod.
namespace: ""
Loading