Skip to content

Commit c4bc4ed

Browse files
authored
Merge pull request #67 from oracle-quickstart/daemonset
Add DaemonSet deployment support
2 parents 95f21d4 + 0dfc950 commit c4bc4ed

File tree

13 files changed

+253
-13
lines changed

13 files changed

+253
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 2024-04-22
4+
### Added
5+
- Support for Management Agent Daemonset deployment
6+
37
## 2024-03-08
48
### Added
59
- Support for AWS EKS system and control plane logs collection.

charts/mgmt-agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 3.0.1
21+
version: 3.0.2
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to

charts/mgmt-agent/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,34 @@ A Helm chart for collecting Kubernetes Metrics using OCI Management Agent into O
2020
| kubernetesCluster.compartmentId | string | `nil` | OCI Compartment Id to push Kubernetes Monitoring metrics. If not specified default is same as Agent compartment |
2121
| kubernetesCluster.name | string | `nil` | Kubernetes cluster name |
2222
| kubernetesCluster.namespace | string | `"*"` | Kubernetes cluster namespace(s) to monitor. This can be a comma-separated list of namespaces or '*' to monitor all the namespaces |
23+
| kubernetesCluster.monitoringNamespace | string | `nil` | OCI namespace to push Kubernetes Monitoring metrics. The namespace should match the pattern '^[a-z][a-z0-9_]*[a-z0-9]$'. By default metrics will be pushed to 'mgmtagent_kubernetes_metrics' |
24+
| kubernetesCluster.overrideAllowMetricsAPIServer | string | `nil` | Provide the specific list of comma separated metric names for agent computed metrics to be collected. |
25+
| kubernetesCluster.overrideAllowMetricsCluster | string | `nil` | Provide the specific list of comma separated metric names for agent computed metrics to be collected |
26+
| kubernetesCluster.overrideAllowMetricsKubelet | string | `nil` | Provide the specific list of comma separated metric names for Kubelet (/api/v1/nodes/<node_name>/proxy/metrics) metrics to be collected |
27+
| kubernetesCluster.overrideAllowMetricsNode | string | `nil` | Provide the specific list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics to be collected |
2328
| mgmtagent.image.secret | string | `nil` | Image secrets to use for pulling container image (base64 encoded content of ~/.docker/config.json file) |
2429
| mgmtagent.image.url | string | `nil` | Replace this value with actual docker image URL for Management Agent |
2530
| mgmtagent.installKey | string | `"resources/input.rsp"` | Copy the downloaded Management Agent Install Key file under root helm directory as resources/input.rsp |
26-
| mgmtagent.installKeyFileContent | string | `nil` | Provide the base64 encoded content of the Management Agent Install Key file |
31+
| mgmtagent.installKeyFileContent | string | `nil` | Provide the base64 encoded content of the Management Agent Install Key file (e.g. `cat input.rsp \| base64 -w 0`) |
2732
| namespace | string | `"{{ .Values.global.namespace }}"` | Kubernetes namespace to create and install this helm chart in |
2833
| oci-onm-common.createNamespace | bool | `true` | If createNamespace is set to true, it tries to create the namespace defined in 'namespace' variable. |
2934
| oci-onm-common.createServiceAccount | bool | `true` | By default, a cluster role, cluster role binding and serviceaccount will be created for the monitoring pods to be able to (readonly) access various objects within the cluster, to support collection of various telemetry data. You may set this to false and provide your own serviceaccount (in the parent chart(s)) which has the necessary cluster role(s) binded to it. Refer, README for the cluster role definition and other details. |
3035
| oci-onm-common.namespace | string | `"{{ .Values.global.namespace }}"` | Kubernetes Namespace in which the serviceaccount to be created. |
3136
| oci-onm-common.resourceNamePrefix | string | `"{{ .Values.global.resourceNamePrefix }}"` | Prefix to be attached to resources created through this chart. Not all resources may have this prefix. |
3237
| oci-onm-common.serviceAccount | string | `"{{ .Values.global.resourceNamePrefix }}"` | Name of the Kubernetes ServiceAccount |
3338
| serviceAccount | string | `"{{ .Values.global.resourceNamePrefix }}"` | Name of the Kubernetes ServiceAccount |
39+
| deployment.security.runAsUser | integer | `1000` | Processes in the Container will use the specified user ID |
40+
| deployment.security.runAsGroup | integer | `2000` | Processes in the Container will use the specified group ID |
41+
| deployment.security.fsGroup | integer | `2000` | Files created in the Container will use the specified group ID |
42+
| deployment.cleanupEpochTime | integer | `nil` | Please provide the current epoch time in seconds (Eg: Executing the following command in a bash shell will provide the epoch time: "date +%s") to clean up the agent installation directory from previous deployment |
43+
| deployment.daemonSetDeployment | bool | `false` | Setting the daemonset deployment to true, will deploy the Management Agents as a daemonset in addition to deploying the Management Agent as a statefulset. This is done to to distribute the node metrics collection to agents running on the node |
44+
| deployment.daemonSet.hostPath | string | `nil` | The host path to store data, if Agent is deployed as DaemonSet. Management Agent Pod should have read-write access to it |
45+
| deployment.resource.request.cpuCore | string | `200m` | Minimum CPU cores(millicore) for each agent instance |
46+
| deployment.resource.request.memory | string | `500Mi` | Minimum memory(mebibytes) for each agent instance |
47+
| deployment.resource.request.storage | string | `2Gi` | Minimum storage(gibibyte) for StatefulSet's PVC |
48+
| deployment.resource.limit.cpuCore | string | `500m` | Maximum CPU cores(millicore) for each agent instance |
49+
| deployment.resource.limit.memory | string | `1Gi` | Maximum memory(gibibyte) for each agent instance |
50+
| deployment.storageClass | string | `nil` | The storage class for StatefulSet's PVC. If not provided then the Cluster's default storage class will be used |
3451

3552
----------------------------------------------
3653
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2024, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-agent
8+
namespace: {{ include "mgmt-agent.namespace" . }}
9+
data:
10+
emd.properties: |
11+
# provide the key=value pair below to override
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2024, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-env
8+
namespace: {{ include "mgmt-agent.namespace" . }}
9+
data:
10+
# Unmodifiable properties
11+
# Please do not remove/modify the below properties
12+
DAEMONSET_DEPLOYMENT: "{{ .Values.deployment.daemonSetDeployment }}"
13+
HELM_DEPLOYMENT: "true"
14+
INSTALL_NAMESPACE: "{{ include "mgmt-agent.namespace" . }}"
15+
{{- if .Values.deployment.cleanupEpochTime }}
16+
POD_CLEANUP_ID: "{{ .Values.deployment.cleanupEpochTime }}"
17+
{{- end }}
18+
19+
# Modifiable properties
20+
# Add new or change the below existing properties as required

charts/mgmt-agent/templates/metrics-configmap.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,23 @@ data:
1414
clusterName={{ include "mgmt-agent.kubernetesClusterName" . }}
1515
# Kubernetes Namespace to monitor
1616
kubernetesNamespace={{ .Values.kubernetesCluster.namespace }}
17+
{{- if .Values.kubernetesCluster.monitoringNamespace }}
18+
# namespace to push monitoring metrics
19+
monitoringNamespace={{ .Values.kubernetesCluster.monitoringNamespace }}
20+
{{- end }}
21+
{{- if .Values.kubernetesCluster.overrideAllowMetricsAPIServer }}
22+
# list of comma separated metric names for API server (/metrics) metrics
23+
overrideAllowMetricsAPIServer={{ .Values.kubernetesCluster.overrideAllowMetricsAPIServer }}
24+
{{- end }}
25+
{{- if .Values.kubernetesCluster.overrideAllowMetricsCluster }}
26+
# list of comma separated metric names for agent computed metrics
27+
overrideAllowMetricsCluster={{ .Values.kubernetesCluster.overrideAllowMetricsCluster }}
28+
{{- end }}
29+
{{- if .Values.kubernetesCluster.overrideAllowMetricsKubelet }}
30+
# list of comma separated metric names for Kubelet (/api/v1/nodes/<node_name>/proxy/metrics) metrics
31+
overrideAllowMetricsKubelet={{ .Values.kubernetesCluster.overrideAllowMetricsKubelet }}
32+
{{- end }}
33+
{{- if .Values.kubernetesCluster.overrideAllowMetricsNode }}
34+
# list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics
35+
overrideAllowMetricsNode={{ .Values.kubernetesCluster.overrideAllowMetricsNode }}
36+
{{- end }}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright (c) 2024, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
{{- if .Values.deployment.daemonSetDeployment }}
5+
apiVersion: apps/v1
6+
kind: DaemonSet
7+
metadata:
8+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
9+
namespace: {{ include "mgmt-agent.namespace" . }}
10+
labels:
11+
app: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
12+
spec:
13+
selector:
14+
matchLabels:
15+
app: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
16+
template:
17+
metadata:
18+
annotations:
19+
checksum/metrics-configmap: {{ include (print $.Template.BasePath "/metrics-configmap.yaml") . | sha256sum }}
20+
checksum/agent-configmap: {{ include (print $.Template.BasePath "/agent-configmap.yaml") . | sha256sum }}
21+
checksum/env-configmap: {{ include (print $.Template.BasePath "/env-configmap.yaml") . | sha256sum }}
22+
labels:
23+
app: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
24+
spec:
25+
securityContext:
26+
runAsUser: {{ default 0 .Values.deployment.security.runAsUser }}
27+
runAsGroup: {{ default 0 .Values.deployment.security.runAsGroup }}
28+
fsGroup: {{ default 0 .Values.deployment.security.fsGroup }}
29+
serviceAccountName: {{ include "mgmt-agent.serviceAccount" . }}
30+
{{- if .Values.mgmtagent.image.secret }}
31+
imagePullSecrets:
32+
- name: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent-container-registry-key
33+
{{- end }}
34+
restartPolicy: Always
35+
containers:
36+
- name: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
37+
image: {{ .Values.mgmtagent.image.url }}
38+
envFrom:
39+
- configMapRef:
40+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-env
41+
resources:
42+
requests:
43+
cpu: {{ .Values.deployment.resource.request.cpuCore }}
44+
memory: {{ .Values.deployment.resource.request.memory }}
45+
limits:
46+
cpu: {{ .Values.deployment.resource.limit.cpuCore }}
47+
memory: {{ .Values.deployment.resource.limit.memory }}
48+
volumeMounts:
49+
- name: mgmtagent-secret
50+
mountPath: /opt/oracle/mgmtagent_secret
51+
readOnly: true
52+
- name: mgmtagent-hostpath
53+
mountPath: /opt/oracle
54+
- name: mgmtagent-config
55+
mountPath: /opt/oracle/mgmtagent_config
56+
- name: mgmtagent-env
57+
mountPath: /opt/oracle/mgmtagent_env
58+
- name: mgmtagent-agent-config
59+
mountPath: /opt/oracle/mgmtagent_agent_config
60+
- mountPath: /tmp
61+
name: tmp
62+
securityContext:
63+
allowPrivilegeEscalation: false
64+
readOnlyRootFilesystem: true
65+
volumes:
66+
- name: mgmtagent-secret
67+
secret:
68+
secretName: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent-rsp
69+
- name: mgmtagent-config
70+
configMap:
71+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-metrics
72+
- name: mgmtagent-env
73+
configMap:
74+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-env
75+
- name: mgmtagent-agent-config
76+
configMap:
77+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-agent
78+
- name: mgmtagent-hostpath
79+
hostPath:
80+
path: {{ required "deployment.daemonSet.hostPath is required" .Values.deployment.daemonSet.hostPath }}
81+
- emptyDir: {}
82+
name: tmp
83+
{{- end }}

charts/mgmt-agent/templates/mgmt-agent-statefulset.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ spec:
1616
app: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
1717
template:
1818
metadata:
19+
annotations:
20+
checksum/metrics-configmap: {{ include (print $.Template.BasePath "/metrics-configmap.yaml") . | sha256sum }}
21+
checksum/agent-configmap: {{ include (print $.Template.BasePath "/agent-configmap.yaml") . | sha256sum }}
22+
checksum/env-configmap: {{ include (print $.Template.BasePath "/env-configmap.yaml") . | sha256sum }}
1923
labels:
2024
app: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
2125
spec:
@@ -24,12 +28,17 @@ spec:
2428
runAsGroup: {{ default 0 .Values.deployment.security.runAsGroup }}
2529
fsGroup: {{ default 0 .Values.deployment.security.fsGroup }}
2630
serviceAccountName: {{ include "mgmt-agent.serviceAccount" . }}
31+
{{- if .Values.mgmtagent.image.secret }}
2732
imagePullSecrets:
2833
- name: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent-container-registry-key
34+
{{- end }}
2935
restartPolicy: Always
3036
containers:
3137
- name: {{ include "mgmt-agent.resourceNamePrefix" . }}-mgmt-agent
3238
image: {{ .Values.mgmtagent.image.url }}
39+
envFrom:
40+
- configMapRef:
41+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-env
3342
resources:
3443
requests:
3544
cpu: {{ .Values.deployment.resource.request.cpuCore }}
@@ -45,6 +54,10 @@ spec:
4554
mountPath: /opt/oracle
4655
- name: mgmtagent-config
4756
mountPath: /opt/oracle/mgmtagent_config
57+
- name: mgmtagent-env
58+
mountPath: /opt/oracle/mgmtagent_env
59+
- name: mgmtagent-agent-config
60+
mountPath: /opt/oracle/mgmtagent_agent_config
4861
- mountPath: /tmp
4962
name: tmp
5063
securityContext:
@@ -57,6 +70,12 @@ spec:
5770
- name: mgmtagent-config
5871
configMap:
5972
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-metrics
73+
- name: mgmtagent-env
74+
configMap:
75+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-env
76+
- name: mgmtagent-agent-config
77+
configMap:
78+
name: {{ include "mgmt-agent.resourceNamePrefix" . }}-agent
6079
- emptyDir: {}
6180
name: tmp
6281
volumeClaimTemplates:

charts/mgmt-agent/values.schema.json

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,32 @@
109109
{
110110
"name":
111111
{
112-
"type": "string"
112+
"type":
113+
[
114+
"string",
115+
"null"
116+
]
113117
},
114118
"namespace":
115119
{
116120
"type": "string"
121+
},
122+
"monitoringNamespace":
123+
{
124+
"anyOf":
125+
[
126+
{
127+
"type": "string",
128+
"pattern": "^[a-z][a-z0-9_]*[a-z0-9]$"
129+
},
130+
{
131+
"type": "null"
132+
}
133+
]
117134
}
118135
},
119136
"required":
120137
[
121-
"name",
122138
"namespace"
123139
]
124140
},
@@ -156,6 +172,32 @@
156172
}
157173
}
158174
},
175+
"cleanupEpochTime":
176+
{
177+
"type":
178+
[
179+
"integer",
180+
"null"
181+
]
182+
},
183+
"daemonSetDeployment":
184+
{
185+
"type": "boolean"
186+
},
187+
"daemonSet":
188+
{
189+
"properties":
190+
{
191+
"hostPath":
192+
{
193+
"type":
194+
[
195+
"string",
196+
"null"
197+
]
198+
}
199+
}
200+
},
159201
"resource":
160202
{
161203
"properties":
@@ -205,7 +247,11 @@
205247
}
206248
}
207249
}
208-
}
250+
},
251+
"required":
252+
[
253+
"daemonSetDeployment"
254+
]
209255
}
210256
},
211257
"required":

charts/mgmt-agent/values.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ oci-onm-common:
2222
mgmtagent:
2323
# Provide either installKeyFileContent or installKey as an install key. If both provided then installKeyFileContent will take higher precedence.
2424

25-
# -- Provide the base64 encoded content of the Management Agent Install Key file
25+
# -- Provide the base64 encoded content of the Management Agent Install Key file (e.g. cat input.rsp | base64 -w 0)
2626
installKeyFileContent:
2727
# -- Copy the downloaded Management Agent Install Key file under root helm directory as resources/input.rsp
2828
installKey: resources/input.rsp
@@ -50,6 +50,16 @@ kubernetesCluster:
5050
name:
5151
# -- Kubernetes cluster namespace(s) to monitor. This can be a comma-separated list of namespaces or '*' to monitor all the namespaces
5252
namespace: '*'
53+
# -- OCI namespace to push Kubernetes Monitoring metrics. The namespace should match the pattern '^[a-z][a-z0-9_]*[a-z0-9]$'. By default metrics will be pushed to 'mgmtagent_kubernetes_metrics'
54+
monitoringNamespace:
55+
# -- Provide the specific list of comma separated metric names for API server (/metrics) metrics to be collected.
56+
overrideAllowMetricsAPIServer:
57+
# -- Provide the specific list of comma separated metric names for agent computed metrics to be collected.
58+
overrideAllowMetricsCluster:
59+
# -- Provide the specific list of comma separated metric names for Kubelet (/api/v1/nodes/<node_name>/proxy/metrics) metrics to be collected.
60+
overrideAllowMetricsKubelet:
61+
# -- Provide the specific list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics to be collected.
62+
overrideAllowMetricsNode:
5363

5464
deployment:
5565
security:
@@ -60,6 +70,16 @@ deployment:
6070
# Files created in the Container will use group ID 2000, replace it with a different value if desired
6171
fsGroup: 2000
6272

73+
# Please provide the current epoch time in seconds (Eg: Executing the following command in a bash shell will provide the epoch time: "date +%s") to clean up the agent installation directory from previous deployment
74+
cleanupEpochTime:
75+
76+
# Setting the daemonset deployment to true, will deploy the Management Agents as a daemonset in addition to deploying the Management Agent as a statefulset. This is done to to distribute the node metrics collection to agents running on the node
77+
daemonSetDeployment: false
78+
79+
daemonSet:
80+
# Provide the host path if Agent is deployed as DaemonSet. Management Agent Pod should have read-write access to it.
81+
hostPath:
82+
6383
# Provide the agent resources as per Kubernetes resource quantity
6484
resource:
6585
# Provide the minimum required resources

0 commit comments

Comments
 (0)