Skip to content

Commit

Permalink
Create separate agent daemonsets on windows for container insights an…
Browse files Browse the repository at this point in the history
…d application signals (#90)
  • Loading branch information
lisguo authored Sep 4, 2024
1 parent d92e285 commit 802c0c4
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.agent.enabled }}
{{- $clusterName := .Values.clusterName | required ".Values.clusterName is required." -}}
{{- $region := .Values.region | required ".Values.region is required." -}}
{{- $config := `{"logs":{"metrics_collected":{"kubernetes":{"enhanced_container_insights":true}}}}` | fromJson -}}

apiVersion: cloudwatch.aws.amazon.com/v1alpha1
kind: AmazonCloudWatchAgent
metadata:
name: {{ template "cloudwatch-agent.name" . }}-windows-container-insights
namespace: {{ .Release.Namespace }}
spec:
podSecurityContext:
windowsOptions:
hostProcess: true
runAsUserName: "NT AUTHORITY\\System"
hostNetwork: true
image: {{ template "cloudwatch-agent.image" . }}
workingDir: "%CONTAINER_SANDBOX_MOUNT_POINT%\\Program Files\\Amazon\\AmazonCloudWatchAgent"
mode: daemonset
serviceAccount: {{ template "cloudwatch-agent.serviceAccountName" . }}
nodeSelector:
kubernetes.io/os: windows
config: {{ include "cloudwatch-agent.modify-config" (merge (dict "Config" $config) .) }}
{{- with .Values.agent.resources }}
resources: {{- toYaml . | nindent 4}}
{{- end }}
env:
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: HOST_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: RUN_IN_CONTAINER
value: "True"
- name: RUN_AS_HOST_PROCESS_CONTAINER
value: "True"
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- if .Values.agent.enabled }}
{{- $clusterName := .Values.clusterName | required ".Values.clusterName is required." -}}
{{- $region := .Values.region | required ".Values.region is required." -}}
{{- $config := `{"logs":{"metrics_collected":{"application_signals":{}}},"traces":{"traces_collected":{"application_signals":{}}}}` | fromJson -}}
apiVersion: cloudwatch.aws.amazon.com/v1alpha1
kind: AmazonCloudWatchAgent
metadata:
Expand All @@ -9,40 +10,33 @@ metadata:
spec:
podSecurityContext:
windowsOptions:
hostProcess: true
runAsUserName: "NT AUTHORITY\\System"
hostNetwork: true
image: {{ template "cloudwatch-agent.image" . }}
workingDir: "%CONTAINER_SANDBOX_MOUNT_POINT%\\Program Files\\Amazon\\AmazonCloudWatchAgent"
mode: daemonset
serviceAccount: {{ template "cloudwatch-agent.serviceAccountName" . }}
nodeSelector:
kubernetes.io/os: windows
config: {{ .Values.agent.windowsDefaultConfig | toJson | quote }}
config: {{ include "cloudwatch-agent.modify-config" (merge (dict "Config" $config) .) }}
{{- with .Values.agent.resources }}
resources: {{- toYaml . | nindent 4}}
{{- end }}
env:
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: HOST_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: RUN_IN_CONTAINER
value: "True"
- name: RUN_AS_HOST_PROCESS_CONTAINER
value: "True"
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: HOST_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
Expand Down
16 changes: 0 additions & 16 deletions charts/amazon-cloudwatch-observability/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -586,22 +586,6 @@ agent:
}
}
}
windowsDefaultConfig:
{
"logs": {
"metrics_collected": {
"kubernetes": {
"enhanced_container_insights": true
},
"application_signals": { }
}
},
"traces": {
"traces_collected": {
"application_signals": { }
}
}
}

dcgmExporter:
name:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,38 @@
package validator

const (
// Services count for CW agent on Linux and Windows
serviceCountLinux = 6
serviceCountWindows = 3
// Services count on Linux:
// - amazon-cloudwatch-observability-webhook-service
// - cloudwatch-agent
// - cloudwatch-agent-headless
// - cloudwatch-agent-monitoring
// - dcgm-exporter-service
// - neuron-monitor-service
serviceCountLinux = 6

// DaemonSet count for CW agent on Linux and Windows
daemonsetCountLinux = 4
daemonsetCountWindows = 2
// Services count on Windows:
// - cloudwatch-agent-windows
// - cloudwatch-agent-windows-headless
// - cloudwatch-agent-windows-monitoring
// - cloudwatch-agent-windows-container-insights
// - cloudwatch-agent-windows-container-insights-headless
// - cloudwatch-agent-windows-container-insights-monitoring
serviceCountWindows = 6

// Pods count for CW agent on Linux and Windows
// DaemonSet count on Linux:
// - cloudwatch-agent
// - dcgm-exporter
// - fluent-bit
// - neuron-monitor
daemonsetCountLinux = 4

// DaemonSet count on Windows:
// - cloudwatch-agent-windows
// - cloudwatch-agent-windows-container-insights
// - fluent-bit-windows
daemonsetCountWindows = 3

// Pods count on Linux and Windows
podCountLinux = 3
podCountWindows = 0
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,38 @@
package validator

const (
// Services count for CW agent on Linux and Windows
serviceCountLinux = 6
serviceCountWindows = 3
// Services count on Linux:
// - amazon-cloudwatch-observability-webhook-service
// - cloudwatch-agent
// - cloudwatch-agent-headless
// - cloudwatch-agent-monitoring
// - dcgm-exporter-service
// - neuron-monitor-service
serviceCountLinux = 6

// DaemonSet count for CW agent on Linux and Windows
daemonsetCountLinux = 4
daemonsetCountWindows = 2
// Services count on Windows:
// - cloudwatch-agent-windows
// - cloudwatch-agent-windows-headless
// - cloudwatch-agent-windows-monitoring
// - cloudwatch-agent-windows-container-insights
// - cloudwatch-agent-windows-container-insights-headless
// - cloudwatch-agent-windows-container-insights-monitoring
serviceCountWindows = 6

// Pods count for CW agent on Linux and Windows
// DaemonSet count on Linux:
// - cloudwatch-agent
// - dcgm-exporter
// - fluent-bit
// - neuron-monitor
daemonsetCountLinux = 4

// DaemonSet count on Windows:
// - cloudwatch-agent-windows
// - cloudwatch-agent-windows-container-insights
// - fluent-bit-windows
daemonsetCountWindows = 3

// Pods count on Linux and Windows
podCountLinux = 3
podCountWindows = 2
podCountWindows = 3
)

0 comments on commit 802c0c4

Please sign in to comment.