-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add eks/fargate StatefulSet distribution
- Loading branch information
Ryan Fitzpatrick
committed
Jan 20, 2022
1 parent
8058aa2
commit f30c258
Showing
33 changed files
with
1,201 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
helm-charts/splunk-otel-collector/scripts/eks-fargate-otelcol-with-env.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set -ex | ||
if [ -f /splunk-messages/environ ]; then | ||
. /splunk-messages/environ | ||
fi | ||
/otelcol $@ |
47 changes: 47 additions & 0 deletions
47
helm-charts/splunk-otel-collector/scripts/lookup-eks-fargate-receiver-node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#! /usr/bin/bash | ||
set -ex | ||
|
||
# If we are the first pod (cluster receiver), set the kubelet stats node filter to only follow labelled nodes. | ||
if [[ "${K8S_POD_NAME}" == *-0 ]]; then | ||
echo "will configure kubelet stats receiver to follow node ${FIRST_CR_REPLICA_NODE_NAME}, as well as use cluster receiver." | ||
echo "export CR_KUBELET_STATS_NODE_FILTER='&& labels[\"splunk-otel-is-eks-fargate-cluster-receiver-node\"] == \"true\"'" >/splunk-messages/environ | ||
cat /splunk-messages/environ | ||
|
||
# copy config to meet container command args | ||
cp /conf/relay.yaml /splunk-messages/config.yaml | ||
exit 0 | ||
fi | ||
|
||
# Else we are the second pod (wide kubelet stats) label our node to be monitored by the first pod and disable the k8s_cluster receiver. | ||
# Update our config to not monitor ourselves | ||
echo "Labelling our fargate node to denote it hosts the cluster receiver" | ||
|
||
# download kubectl (verifying checksum) | ||
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.15/2020-11-02/bin/linux/amd64/kubectl | ||
curl -o kubectl.sha256 https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.15/2020-11-02/bin/linux/amd64/kubectl.sha256 | ||
ACTUAL=$(sha256sum kubectl | awk '{print $1}') | ||
EXPECTED=$(cat kubectl.sha256 | awk '{print $1}') | ||
if [ "${ACTUAL}" != "${EXPECTED}" ]; then | ||
echo "will not attempt to use kubectl with unexpected sha256 (${ACTUAL} != ${EXPECTED})" | ||
exit 1 | ||
fi | ||
chmod a+x kubectl | ||
# label node | ||
./kubectl label nodes $K8S_NODE_NAME splunk-otel-is-eks-fargate-cluster-receiver-node=true | ||
|
||
echo "Disabling k8s_cluster receiver for this instance" | ||
# download yq to strip k8s_cluster receiver | ||
curl -L -o yq https://github.com/mikefarah/yq/releases/download/v4.16.2/yq_linux_amd64 | ||
ACTUAL=$(sha256sum yq | awk '{print $1}') | ||
if [ "${ACTUAL}" != "5c911c4da418ae64af5527b7ee36e77effb85de20c2ce732ed14c7f72743084d" ]; then | ||
echo "will not attempt to use yq with unexpected sha256 (${ACTUAL} != 5c911c4da418ae64af5527b7ee36e77effb85de20c2ce732ed14c7f72743084d)" | ||
exit 1 | ||
fi | ||
chmod a+x yq | ||
# strip k8s_cluster | ||
./yq e 'del(.service.pipelines.metrics.receivers[0])' /conf/relay.yaml >/splunk-messages/config.yaml | ||
./yq e -i 'del(.receivers.k8s_cluster)' /splunk-messages/config.yaml | ||
|
||
# set kubelet stats to not monitor ourselves (all other kubelets) | ||
echo "EKS kubelet stats receiver node lookup not applicable for $K8S_POD_NAME. Ensuring it won't monitor itself to avoid Fargate network limitation." | ||
echo "export CR_KUBELET_STATS_NODE_FILTER='&& not ( name contains \"${K8S_NODE_NAME}\" )'" >/splunk-messages/environ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
helm-charts/splunk-otel-collector/templates/configmap-agent.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ts/splunk-otel-collector/templates/configmap-cluster-receiver-node-discoverer-script.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ $clusterReceiver := fromYaml (include "splunk-otel-collector.clusterReceiver" .) }} | ||
{{ if and $clusterReceiver.enabled (eq (include "splunk-otel-collector.metricsEnabled" .) "true") (eq (include "splunk-otel-collector.distribution" .) "eks/fargate") }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "splunk-otel-collector.clusterReceiverNodeDiscovererScript" . }} | ||
labels: | ||
{{- include "splunk-otel-collector.commonLabels" . | nindent 4 }} | ||
app: {{ template "splunk-otel-collector.name" . }} | ||
chart: {{ template "splunk-otel-collector.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
script: | | ||
{{- (.Files.Get "scripts/lookup-eks-fargate-receiver-node.sh") | nindent 4 }} | ||
{{- end }} |
16 changes: 16 additions & 0 deletions
16
helm-charts/splunk-otel-collector/templates/configmap-eks-fargate-cluster-receiver.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ $clusterReceiver := fromYaml (include "splunk-otel-collector.clusterReceiver" .) }} | ||
{{ if and $clusterReceiver.enabled (eq (include "splunk-otel-collector.metricsEnabled" .) "true") (eq (include "splunk-otel-collector.distribution" .) "eks/fargate") }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "splunk-otel-collector.eksFargateClusterReceiverScript" . }} | ||
labels: | ||
{{- include "splunk-otel-collector.commonLabels" . | nindent 4 }} | ||
app: {{ template "splunk-otel-collector.name" . }} | ||
chart: {{ template "splunk-otel-collector.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
script: | | ||
{{- (.Files.Get "scripts/eks-fargate-otelcol-with-env.sh") | nindent 4 }} | ||
{{- end }} |
2 changes: 1 addition & 1 deletion
2
helm-charts/splunk-otel-collector/templates/configmap-gateway.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.