diff --git a/flux2/apps/monitoring/kustomization.yaml b/flux2/apps/monitoring/kustomization.yaml index d3c8daccb628557825f849a4f4852a5407673dfb..3d0a9c08622f7457b54a2be86e33715df9c39949 100644 --- a/flux2/apps/monitoring/kustomization.yaml +++ b/flux2/apps/monitoring/kustomization.yaml @@ -9,6 +9,10 @@ resources: - kube-prometheus-stack-values-configmap.yaml - loki-configmap.yaml - loki-release.yaml + - loki-restart-cronjob.yaml + - loki-restart-role.yaml + - loki-restart-rolebinding.yaml + - loki-restart-serviceaccount.yaml - loki-values-configmap.yaml - promtail-release.yaml - promtail-values-configmap.yaml diff --git a/flux2/apps/monitoring/loki-restart-cronjob.yaml b/flux2/apps/monitoring/loki-restart-cronjob.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6302df656a0c8f347323e52e5fdff62f03150d72 --- /dev/null +++ b/flux2/apps/monitoring/loki-restart-cronjob.yaml @@ -0,0 +1,25 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: loki-restart + namespace: stackspin +spec: + concurrencyPolicy: Forbid + schedule: '0 4 * * *' + jobTemplate: + spec: + backoffLimit: 2 + activeDeadlineSeconds: 600 + template: + spec: + serviceAccountName: loki-restart + restartPolicy: Never + containers: + - name: kubectl + # https://hub.docker.com/r/bitnami/kubectl + image: bitnami/kubectl:1.21.8 + command: + - 'kubectl' + - 'rollout' + - 'restart' + - 'statefulset/loki' diff --git a/flux2/apps/monitoring/loki-restart-role.yaml b/flux2/apps/monitoring/loki-restart-role.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4299a61c52dfafe63c8faff0f72eae8d783af2d3 --- /dev/null +++ b/flux2/apps/monitoring/loki-restart-role.yaml @@ -0,0 +1,10 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: loki-restart + namespace: stackspin +rules: + - apiGroups: ["apps", "extensions"] + resources: ["statefulsets"] + resourceNames: ["loki"] + verbs: ["get", "patch"] diff --git a/flux2/apps/monitoring/loki-restart-rolebinding.yaml b/flux2/apps/monitoring/loki-restart-rolebinding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6c35b703a96f149494bf5b453849b0d3d4d7acfe --- /dev/null +++ b/flux2/apps/monitoring/loki-restart-rolebinding.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: loki-restart + namespace: stackspin +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: loki-restart +subjects: + - kind: ServiceAccount + name: loki-restart + namespace: stackspin diff --git a/flux2/apps/monitoring/loki-restart-serviceaccount.yaml b/flux2/apps/monitoring/loki-restart-serviceaccount.yaml new file mode 100644 index 0000000000000000000000000000000000000000..71245bba952a467be372a1ab6b91d429b547016a --- /dev/null +++ b/flux2/apps/monitoring/loki-restart-serviceaccount.yaml @@ -0,0 +1,5 @@ +kind: ServiceAccount +apiVersion: v1 +metadata: + name: loki-restart + namespace: stackspin diff --git a/flux2/apps/monitoring/loki-values-configmap.yaml b/flux2/apps/monitoring/loki-values-configmap.yaml index ca408a8ea2b0d927944d8457a13f35cfc33bf19b..c8ba88c9ebb94a1ad659ca0b05bd0770d557c598 100644 --- a/flux2/apps/monitoring/loki-values-configmap.yaml +++ b/flux2/apps/monitoring/loki-values-configmap.yaml @@ -7,11 +7,6 @@ metadata: data: values.yaml: | # https://github.com/grafana/helm-charts/blob/main/charts/loki/values.yaml - image: - repository: grafana/loki - # Downgrade loki because of mem leak - # (https://open.greenhost.net/stackspin/stackspin/-/issues/1077) - tag: 2.4.0 resources: limits: cpu: 800m