Skip to content

Commit

Permalink
update ci values, helm examples, fix serviceaccount pod and config va…
Browse files Browse the repository at this point in the history
…lue issues
  • Loading branch information
AlexMapley committed Nov 22, 2023
1 parent bbf09b3 commit c06784a
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 36 deletions.
1 change: 1 addition & 0 deletions charts/posit-chronicle/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
lint:
helm lint --strict --set service.name=example --set service.version=0.0.1 -f ./ci/empty-values.yaml .
helm lint --strict --set service.name=example --set service.version=0.0.1 -f ./ci/simple-values.yaml .
helm lint --strict --set service.name=example --set service.version=0.0.1 -f ./ci/no-local-storage-values.yaml .
helm lint --strict --set service.name=example --set service.version=0.0.1 -f ./ci/complex-values.yaml .

template:
Expand Down
7 changes: 2 additions & 5 deletions charts/posit-chronicle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Here are some example Helm values to run the agent sidecar in Workbench:

```yaml
pod:
...
sidecar:
- name: chronicle-agent
image: posit-chronicle:latest
Expand All @@ -58,15 +57,13 @@ pod:
env:
- name: CHRONICLE_SERVER_ADDRESS
value: "http://chronicle-server.default.svc.cluster.local"
...
```
And here are some example Helm values for Connect, where we also pass a Connect
API key from a Kubernetes Secret to unlock more detailed metrics:
```yaml
pod:
...
sidecar:
- name: chronicle-agent
image: posit-chronicle:latest
Expand All @@ -93,7 +90,7 @@ S3, or both.
The default configuration uses a local volume, which is suitable if you'd like to
access and analyze the data within your cluster:
``` yaml
```yaml
config:
localStorage:
enabled: true
Expand Down Expand Up @@ -126,7 +123,7 @@ you can use this role as an annotation on the existing Service Account:

``` yaml
serviceaccount:
enabled: false
create: false
# -- Additional annotations to add to the chronicle-server serviceaccount
annotations: {
eks.amazonaws.com/role-arn: arn:aws:iam::123456789000:role/iam-role-name-here
Expand Down
20 changes: 6 additions & 14 deletions charts/posit-chronicle/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Here are some example Helm values to run the agent sidecar in Workbench:

```yaml
pod:
...
sidecar:
- name: chronicle-agent
image: posit-chronicle:latest
Expand All @@ -32,15 +31,13 @@ pod:
env:
- name: CHRONICLE_SERVER_ADDRESS
value: "http://chronicle-server.default.svc.cluster.local"
...
```

And here are some example Helm values for Connect, where we also pass a Connect
API key from a Kubernetes Secret to unlock more detailed metrics:

```yaml
pod:
...
sidecar:
- name: chronicle-agent
image: posit-chronicle:latest
Expand All @@ -67,7 +64,7 @@ S3, or both.
The default configuration uses a local volume, which is suitable if you'd like to
access and analyze the data within your cluster:

``` yaml
```yaml
config:
localStorage:
enabled: true
Expand All @@ -83,7 +80,7 @@ supported.)
You can also persist data to AWS S3 instead of (or in addition to) local
storage:

``` yaml
```yaml
config:
s3Storage:
enabled: true
Expand All @@ -98,22 +95,18 @@ to manage the credentials needed to access S3. In this scenario, once you have
role](https://docs.aws.amazon.com/eks/latest/userguide/create-service-account-iam-policy-and-role.html),
you can use this role as an annotation on the existing Service Account:

``` yaml
```yaml
serviceaccount:
enabled: false
# -- Additional annotations to add to the chronicle-server serviceaccount
annotations: {
create: true
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::123456789000:role/iam-role-name-here
}
# -- Additional labels to add to the chronicle-server serviceaccount
labels: {}
```

If you are unable to use IAM Roles for Service Accounts, there are any number of
alternatives for injecting AWS credentials into a container. As a fallback,
the S3 storage config allows specifying a profile:

``` yaml
```yaml
config:
s3Storage:
enabled: true
Expand All @@ -122,7 +115,6 @@ config:
region: "us-east-2"
```


{{ template "chart.valuesSection" . }}

{{ template "helm-docs.versionFooter" . }}
10 changes: 4 additions & 6 deletions charts/posit-chronicle/ci/complex-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image:
imagePullPolicy: "IfNotPresent"

serviceaccount:
enabled: false
create: true
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::123123123123123:role/chronicle-serviceaccount-role

Expand All @@ -22,7 +22,7 @@ service:
pod:
replicas: 4
command: "/bash"
args: ["echo", "hello word"]
args: ["echo", "hello world"]
# -- Optional environment variables
env:
- name: "TEST_ENV_VAR"
Expand All @@ -44,17 +44,15 @@ config:
# If https.enabled=true, we will ignore any http
# values and enable https in our config instead
enabled: true
key: ""
certificate: ""
key: /path/to/key
certificate: /path/to/cert
localStorage:
enabled: true
location: "./chronicle-data"
retentionPeriod: "5m"
s3Storage:
enabled: true
bucket: "posit-chronicle"
prefix: ""
profile: ""
region: "us-east-2"
metrics:
enabled: true
Expand Down
1 change: 1 addition & 0 deletions charts/posit-chronicle/ci/no-local-storage-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ config:
s3Storage:
enabled: true
bucket: "posit-chronicle-dev"
region: "ap-northeast-2"
6 changes: 2 additions & 4 deletions charts/posit-chronicle/ci/simple-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ image:
tag: "latest"

serviceaccount:
create: true
annotations: {
eks.amazonaws.com/role-arn: arn:aws:iam::123123123123123:role/chronicle-serviceaccount-role
}
create: false

storage:
persistentVolumeSize: 10Gi
Expand All @@ -23,3 +20,4 @@ config:
s3Storage:
enabled: true
bucket: "posit-chronicle-dev"
region: "us-east-1"
7 changes: 6 additions & 1 deletion charts/posit-chronicle/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Generate annotations for various resources
{{ end }}
{{- if .Values.config.metrics.enabled }}
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.service.targetPort }}"
{{- if .Values.config.https.enabled }}
prometheus.io/port: "443"
{{- else}}
prometheus.io/port: "5252"
{{- end }}

{{- end }}
{{- end -}}

Expand Down
4 changes: 2 additions & 2 deletions charts/posit-chronicle/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ data:
# switch between http and https
{{- if .Values.config.https.enabled }}
[HTTPS]
Listen = 443
Listen = :443
Key = {{ .Values.config.https.key }}
Certificate = {{ .Values.config.https.certificate }}
{{- else}}
[HTTP]
Listen = 5252
Listen = :5252
{{- end }}
[Logging]
Expand Down
5 changes: 2 additions & 3 deletions charts/posit-chronicle/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
{{- if .Values.serviceaccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: chronicle-sa
labels:
{{ include "posit-chronicle.serviceaccount.labels" . | indent 4 }}
{{ include "posit-chronicle.serviceaccount.labels" . | nindent 4 }}
annotations:
{{ include "posit-chronicle.serviceaccount.annotations" . | indent 4 }}
{{ include "posit-chronicle.serviceaccount.annotations" . | nindent 4 }}
{{- end -}}
3 changes: 2 additions & 1 deletion charts/posit-chronicle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ config:
bucket: "posit-chronicle"
prefix: ""
profile: ""
region: ""
# An AWS region must be set if S3 Storage is enabled
region: "us-east-2"
metrics:
enabled: true
profiling:
Expand Down

0 comments on commit c06784a

Please sign in to comment.