-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helm): add lifecycle hooks to alloy container (#1774)
* feat: add lifecycle hooks to alloy container * feat: add terminationGracePeriodSeconds to helm chart
- Loading branch information
Showing
18 changed files
with
600 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
controller: | ||
type: deployment | ||
|
||
alloy: | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: ["/bin/sh", "-c", "sleep 1"] |
3 changes: 3 additions & 0 deletions
3
operations/helm/charts/alloy/ci/termination-grace-period-values.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,3 @@ | ||
controller: | ||
type: deployment | ||
terminationGracePeriodSeconds: 20 |
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
43 changes: 43 additions & 0 deletions
43
operations/helm/tests/lifecycle-hooks/alloy/templates/configmap.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,43 @@ | ||
--- | ||
# Source: alloy/templates/configmap.yaml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: alloy | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: config | ||
data: | ||
config.alloy: |- | ||
logging { | ||
level = "info" | ||
format = "logfmt" | ||
} | ||
discovery.kubernetes "pods" { | ||
role = "pod" | ||
} | ||
discovery.kubernetes "nodes" { | ||
role = "node" | ||
} | ||
discovery.kubernetes "services" { | ||
role = "service" | ||
} | ||
discovery.kubernetes "endpoints" { | ||
role = "endpoints" | ||
} | ||
discovery.kubernetes "endpointslices" { | ||
role = "endpointslice" | ||
} | ||
discovery.kubernetes "ingresses" { | ||
role = "ingress" | ||
} |
83 changes: 83 additions & 0 deletions
83
operations/helm/tests/lifecycle-hooks/alloy/templates/controllers/deployment.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,83 @@ | ||
--- | ||
# Source: alloy/templates/controllers/deployment.yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: alloy | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
spec: | ||
replicas: 1 | ||
minReadySeconds: 10 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
template: | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/default-container: alloy | ||
labels: | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
spec: | ||
serviceAccountName: alloy | ||
containers: | ||
- name: alloy | ||
image: docker.io/grafana/alloy:v1.4.1 | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- run | ||
- /etc/alloy/config.alloy | ||
- --storage.path=/tmp/alloy | ||
- --server.http.listen-addr=0.0.0.0:12345 | ||
- --server.http.ui-path-prefix=/ | ||
- --stability.level=generally-available | ||
env: | ||
- name: ALLOY_DEPLOY_MODE | ||
value: "helm" | ||
- name: HOSTNAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
ports: | ||
- containerPort: 12345 | ||
name: http-metrics | ||
readinessProbe: | ||
httpGet: | ||
path: /-/ready | ||
port: 12345 | ||
scheme: HTTP | ||
initialDelaySeconds: 10 | ||
timeoutSeconds: 1 | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: | ||
- /bin/sh | ||
- -c | ||
- sleep 1 | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/alloy | ||
- name: config-reloader | ||
image: ghcr.io/jimmidyson/configmap-reload:v0.12.0 | ||
args: | ||
- --volume-dir=/etc/alloy | ||
- --webhook-url=http://localhost:12345/-/reload | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/alloy | ||
resources: | ||
requests: | ||
cpu: 1m | ||
memory: 5Mi | ||
dnsPolicy: ClusterFirst | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: alloy |
119 changes: 119 additions & 0 deletions
119
operations/helm/tests/lifecycle-hooks/alloy/templates/rbac.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,119 @@ | ||
--- | ||
# Source: alloy/templates/rbac.yaml | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: alloy | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: rbac | ||
rules: | ||
# Rules which allow discovery.kubernetes to function. | ||
- apiGroups: | ||
- "" | ||
- "discovery.k8s.io" | ||
- "networking.k8s.io" | ||
resources: | ||
- endpoints | ||
- endpointslices | ||
- ingresses | ||
- nodes | ||
- nodes/proxy | ||
- nodes/metrics | ||
- pods | ||
- services | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
# Rules which allow loki.source.kubernetes and loki.source.podlogs to work. | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
- pods/log | ||
- namespaces | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "monitoring.grafana.com" | ||
resources: | ||
- podlogs | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
# Rules which allow mimir.rules.kubernetes to work. | ||
- apiGroups: ["monitoring.coreos.com"] | ||
resources: | ||
- prometheusrules | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- nonResourceURLs: | ||
- /metrics | ||
verbs: | ||
- get | ||
# Rules for prometheus.kubernetes.* | ||
- apiGroups: ["monitoring.coreos.com"] | ||
resources: | ||
- podmonitors | ||
- servicemonitors | ||
- probes | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
# Rules which allow eventhandler to work. | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
# needed for remote.kubernetes.* | ||
- apiGroups: [""] | ||
resources: | ||
- "configmaps" | ||
- "secrets" | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
# needed for otelcol.processor.k8sattributes | ||
- apiGroups: ["apps"] | ||
resources: ["replicasets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["extensions"] | ||
resources: ["replicasets"] | ||
verbs: ["get", "list", "watch"] | ||
--- | ||
# Source: alloy/templates/rbac.yaml | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: alloy | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: rbac | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: alloy | ||
subjects: | ||
- kind: ServiceAccount | ||
name: alloy | ||
namespace: default |
24 changes: 24 additions & 0 deletions
24
operations/helm/tests/lifecycle-hooks/alloy/templates/service.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,24 @@ | ||
--- | ||
# Source: alloy/templates/service.yaml | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: alloy | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: networking | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
internalTrafficPolicy: Cluster | ||
ports: | ||
- name: http-metrics | ||
port: 12345 | ||
targetPort: 12345 | ||
protocol: "TCP" |
14 changes: 14 additions & 0 deletions
14
operations/helm/tests/lifecycle-hooks/alloy/templates/serviceaccount.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,14 @@ | ||
--- | ||
# Source: alloy/templates/serviceaccount.yaml | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: alloy | ||
namespace: default | ||
labels: | ||
helm.sh/chart: alloy | ||
app.kubernetes.io/name: alloy | ||
app.kubernetes.io/instance: alloy | ||
app.kubernetes.io/version: "vX.Y.Z" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: rbac |
Oops, something went wrong.