Skip to content

Commit 5ecca83

Browse files
authored
Merge pull request #4 from scalyr/cherrypick_changes
Cherry pick missing changes
2 parents 747d2cc + 8d7dc4c commit 5ecca83

File tree

11 files changed

+115
-8
lines changed

11 files changed

+115
-8
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ jobs:
4646
with:
4747
charts_dir: charts
4848

49+
- name: Write latest stable version to info.json file
50+
run: |
51+
# We write latest stable version info to JSON file which we can query for displaying
52+
# badge in the readme
53+
CHART_VERSION=$(cat charts/scalyr-agent/Chart.yaml | grep "version: " | sed "s/version: //g" | tr -d "\n")
54+
echo '{"scalyrAgent": "v'${CHART_VERSION}'"}' > info.json
55+
git add info.json
56+
git push origin gh-pages
57+
4958
- name: Notify Slack on Failure
5059
# NOTE: github.ref is set to pr ref (and not branch name, e.g. refs/pull/28/merge) for pull
5160
# requests and that's why we need this special conditional and check for github.head_ref in

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
For actual scalyr agent changelog, please see https://github.com/scalyr/scalyr-agent-2/blob/master/CHANGELOG.md.
44

5+
## 0.2.5
6+
7+
- Update NOTES file to print information on how to retrieve agent pod logs after helm chart
8+
installation.
9+
- Add agent liveness probe which utilizes ``scalyr-agent status -H`` command.
10+
- Kubelet CA verification has been enabled by default. If you want to disable it, you can set
11+
``k8s.verifyKubeletQueries`` config option to ``false``.
12+
- Chart installation will now fail early if ``scalyr.config`` entry value contains a string value
13+
which is not correctly base64 encoded.
14+
515
## 0.2.4
616

717
- Scalyr agent has been updated to v2.1.24.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,38 @@ If you'd like to create a different Scalyr agent, you can set `controllerType` t
9595
| volumeMounts | object | `{}` | Additional volume mounts to set up |
9696
| volumes | object | `{}` | Additional volumes to mount |
9797

98+
## Setting Custom Scalyr Agent Config Options
99+
100+
If you want to configure additional Scalyr Agent configuration options which are not exposed
101+
directly via dedicated values file options, you can utilize ``scalyr.config`` values file option.
102+
103+
This config option allows you to define additional scalyr agent JSON config file fragments which
104+
are read and parsed by the agent.
105+
106+
Since Helm is not able to correctly pass JSON strings as YAML key values, you should base64 JSON
107+
config fragment value as shown below.
108+
109+
For example, let's say your custom config fragment lives in ``ci/examples/agent.d/my-config.json``.
110+
111+
1. Obtain base64 encoded version of the JSON file content
112+
113+
```bash
114+
cat ci/examples/agent.d/my-config.json| sed -e 's/^ *//' | tr -d '\n' | base64
115+
```
116+
117+
To avoid any YAML formatting issues, we also utilize ``sed`` and ``tr`` command to fold multi line
118+
JSON into a single line
119+
120+
2. After you updated the base64 encoded value, update your values file
121+
122+
```yaml
123+
scalyr:
124+
apiKey: "REPLACE_ME"
125+
base64Config: true
126+
config:
127+
my-config.json: eyJtYXhfbG9nX29mZnNldF9zaXplIjogNTI0Mjg4MCwiZGVidWdfbGV2ZWwiOiA1fQ==
128+
```
129+
98130
## Development, CI/CD
99131
100132
On each push to master and other branches Github Actions workflow runs which performs basic helm

charts/scalyr-agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: scalyr-agent
33
description: A Helm chart for deploying the Scalyr agent
44
type: application
5-
version: 0.2.4
5+
version: 0.2.5
66
appVersion: 2.1.24
77
keywords:
88
- scalyr
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
Thank you for installing {{ .Chart.Name }}.
22

3-
The Scalyr {{ .Values.controllerType }} was deployed successfully and is up and running. Given the specified
4-
Scalyr server and api key values were correct, head over to your Scalyr dashboard to see the first incoming
5-
log data.
3+
The Scalyr Agent {{ .Values.controllerType }} was deployed successfully and is up and running.
4+
5+
Given the specified Scalyr server and api key values were correct, head over to your Scalyr dashboard
6+
({{- if contains "eu." $.Values.scalyr.server }}https://app.eu.scalyr.com{{ else }}https://app.scalyr.com{{- end }}) to see the first incoming log data.
7+
8+
You can retrieve information about the agent pod(s) by running the following command:
9+
10+
kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "scalyr-helm.name" . }}" -l "app.kubernetes.io/instance={{ .Release.Name }}"
11+
12+
To view pod info and logs and verify that the pod has started without any errors, you can use the
13+
following commands:
14+
15+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "scalyr-helm.name" . }}" -l "app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
16+
kubectl describe pod "${POD_NAME}"
17+
kubectl logs -f "${POD_NAME}"
18+
19+
If you have any questions or need additional assistance, feel free to reach out to Scalyr Support
20+
(https://www.scalyr.com/support) which is happy to assist you.

charts/scalyr-agent/templates/configmap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,11 @@ data:
2626
{{- end }}
2727
{{- range $key, $value := .Values.scalyr.config }}
2828
"{{ $key }}": |
29+
{{- if $.Values.scalyr.base64Config }}
30+
{{- $b64decValue := $value | b64dec }}
31+
{{- if contains "illegal base64 data" $b64decValue }}
32+
{{- fail ".Values.scalyr.config entry doesn't contain a valid base64 encoded value" }}
33+
{{- end }}
34+
{{- end }}
2935
{{ if $.Values.scalyr.base64Config }}{{ $value | b64dec }}{{ else }}{{ $value }}{{ end }}
3036
{{- end }}

charts/scalyr-agent/templates/daemonset.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ spec:
5757
{{- toYaml .Values.securityContext | nindent 12 }}
5858
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
5959
imagePullPolicy: {{ .Values.image.pullPolicy }}
60+
{{- if .Values.livenessProbe }}
61+
livenessProbe:
62+
exec:
63+
command:
64+
- scalyr-agent-2
65+
- status
66+
- -H
67+
initialDelaySeconds: 60
68+
periodSeconds: 60
69+
{{- end }}
6070
env:
6171
- name: "SCALYR_SERVER"
6272
value: {{ .Values.scalyr.server }}
@@ -69,9 +79,11 @@ spec:
6979
- name: "SCALYR_K8S_CLUSTER_NAME"
7080
value: "{{ .Values.scalyr.k8s.clusterName }}"
7181
- name: "SCALYR_K8S_VERIFY_KUBELET_QUERIES"
72-
value: "{{ .Values.scalyr.k8s.verifyKubeletQueries }}"
82+
value: "{{- if .Values.scalyr.k8s.verifyKubeletQueries }}true{{ else }}false{{- end }}"
83+
{{- if (.Values.scalyr.k8s.caCert) }}
7384
- name: "SCALYR_K8S_KUBELET_CA_CERT"
7485
value: "{{ .Values.scalyr.k8s.caCert }}"
86+
{{- end }}
7587
- name: "SCALYR_K8S_NODE_NAME"
7688
valueFrom:
7789
fieldRef:

charts/scalyr-agent/templates/deployment.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ spec:
5858
{{- toYaml .Values.securityContext | nindent 12 }}
5959
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
6060
imagePullPolicy: {{ .Values.image.pullPolicy }}
61+
{{- if .Values.livenessProbe }}
62+
livenessProbe:
63+
exec:
64+
command:
65+
- scalyr-agent-2
66+
- status
67+
- -H
68+
initialDelaySeconds: 60
69+
periodSeconds: 60
70+
{{- end }}
6171
env:
6272
- name: "SCALYR_SERVER"
6373
value: {{ .Values.scalyr.server }}
@@ -71,8 +81,10 @@ spec:
7181
value: "{{ .Values.scalyr.k8s.clusterName }}"
7282
- name: "SCALYR_K8S_VERIFY_KUBELET_QUERIES"
7383
value: "{{ .Values.scalyr.k8s.verifyKubeletQueries }}"
84+
{{- if (.Values.scalyr.k8s.caCert) }}
7485
- name: "SCALYR_K8S_KUBELET_CA_CERT"
7586
value: "{{ .Values.scalyr.k8s.caCert }}"
87+
{{- end }}
7688
- name: "SCALYR_K8S_NODE_NAME"
7789
valueFrom:
7890
fieldRef:

charts/scalyr-agent/values.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ scalyr:
2222
k8s:
2323
# scalyr.k8s.clusterName -- The kubernetes cluster name (when using the kubernetes monitoring)
2424
clusterName: ""
25-
# scalyr.k8s.verifyKubeletQueries -- Set this to true and set up scalyr.k8s.caCert to activate TLS validation
26-
# of queries to the k8s kubelet
27-
verifyKubeletQueries: "false"
25+
# scalyr.k8s.verifyKubeletQueries -- Set this to false to disable TLS cert validation of queries to k8s kubelet.
26+
# By default cert validation is enabled and connection is verified using the CA configured via the service
27+
# account certificate (/run/secrets/kubernetes.io/serviceaccount/ca.crt file). If you want to use a custom CA
28+
# bundle, you can do that by setting scalyr.k8s.caCert config option to point to this file (this file needs to
29+
# be available inside the agent container). In some test environments such as minikube where self signed certs
30+
# are used you may want to set this to false.
31+
verifyKubeletQueries: true
2832
# scalyr.k8s.caCert -- The path to the CA certificate to use to verify TLS-connection to the kubelet
2933
caCert: ""
3034
# scalyr.k8s.enableLogs -- Enable fetching Pod/Container logs from Kubernetes
@@ -64,6 +68,9 @@ podSecurityContext: {}
6468
# securityContext -- optional security context entries
6569
securityContext: {}
6670

71+
# livenessProbe -- set to false to disable default liveness probe which utilizes scalyr-agent-2 status -H command
72+
livenessProbe: true
73+
6774
# resources -- Pod resources. Defaults to the values documented in the official
6875
# [Installation guide](https://app.scalyr.com/help/install-agent-kubernetes)
6976
resources:

ci/daemonset-agent-values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ podLabels:
44
test: "true"
55
scalyr:
66
apiKey: "REPLACE_ME"
7+
k8s:
8+
verifyKubeletQueries: false

0 commit comments

Comments
 (0)