diff --git a/buildchain/buildchain/salt_tree.py b/buildchain/buildchain/salt_tree.py index 79acb4d56c..7ba62a369f 100644 --- a/buildchain/buildchain/salt_tree.py +++ b/buildchain/buildchain/salt_tree.py @@ -338,7 +338,6 @@ def _get_parts(self) -> Iterator[str]: Path('salt/metalk8s/addons/logging/loki/deployed/', 'service-configuration.sls'), Path('salt/metalk8s/addons/logging/loki/deployed/services.sls'), - Path('salt/metalk8s/addons/logging/loki/deployed/storageclass.sls'), Path('salt/metalk8s/addons/prometheus-adapter/deployed/chart.sls'), Path('salt/metalk8s/addons/prometheus-adapter/deployed/init.sls'), diff --git a/charts/loki.yaml b/charts/loki.yaml index 29a3926d0b..749fcf73e9 100644 --- a/charts/loki.yaml +++ b/charts/loki.yaml @@ -123,7 +123,10 @@ persistence: - ReadWriteOnce size: 10Gi annotations: {} - storageClassName: metalk8s-loki + storageClassName: metalk8s + selector: + matchLabels: + app.kubernetes.io/name: loki # subPath: "" # existingClaim: diff --git a/charts/loki/templates/statefulset.yaml b/charts/loki/templates/statefulset.yaml index 0b22337125..5511a380e9 100644 --- a/charts/loki/templates/statefulset.yaml +++ b/charts/loki/templates/statefulset.yaml @@ -124,5 +124,9 @@ spec: requests: storage: {{ .Values.persistence.size | quote }} storageClassName: {{ .Values.persistence.storageClassName }} + {{- if .Values.persistence.selector }} + selector: + {{- toYaml .Values.persistence.selector | nindent 8 }} + {{- end }} {{- end }} diff --git a/docs/installation/post-install.rst b/docs/installation/post-install.rst index 744621b319..6da99b69e1 100644 --- a/docs/installation/post-install.rst +++ b/docs/installation/post-install.rst @@ -58,7 +58,7 @@ path for the partitions to use: name: -loki spec: nodeName: - storageClassName: metalk8s-loki + storageClassName: metalk8s rawBlockDevice: # Choose a device with at least 10GiB capacity devicePath: template: diff --git a/examples/loki-sparse.yaml b/examples/loki-sparse.yaml index 3482184bb5..8c939299d8 100644 --- a/examples/loki-sparse.yaml +++ b/examples/loki-sparse.yaml @@ -8,6 +8,10 @@ metadata: name: NODE_NAME-loki spec: nodeName: NODE_NAME - storageClassName: metalk8s-loki + storageClassName: metalk8s sparseLoopDevice: size: 10Gi + template: + metadata: + labels: + app.kubernetes.io/name: loki diff --git a/salt/metalk8s/addons/logging/loki/deployed/chart.sls b/salt/metalk8s/addons/logging/loki/deployed/chart.sls index 76ad471c52..b164280309 100644 --- a/salt/metalk8s/addons/logging/loki/deployed/chart.sls +++ b/salt/metalk8s/addons/logging/loki/deployed/chart.sls @@ -252,10 +252,13 @@ spec: spec: accessModes: - ReadWriteOnce + selector: + matchLabels: + app.kubernetes.io/name: loki resources: requests: storage: 10Gi - storageClassName: metalk8s-loki + storageClassName: metalk8s --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor diff --git a/salt/metalk8s/addons/logging/loki/deployed/init.sls b/salt/metalk8s/addons/logging/loki/deployed/init.sls index 024eb05ccb..5d94f66788 100644 --- a/salt/metalk8s/addons/logging/loki/deployed/init.sls +++ b/salt/metalk8s/addons/logging/loki/deployed/init.sls @@ -1,8 +1,8 @@ include: + - ....storageclass.deployed - .service-configuration - .loki-configuration-secret - .chart - .services - - .storageclass - .datasource - .dashboard diff --git a/salt/metalk8s/addons/logging/loki/deployed/storageclass.sls b/salt/metalk8s/addons/logging/loki/deployed/storageclass.sls deleted file mode 100644 index ba5aa5e96f..0000000000 --- a/salt/metalk8s/addons/logging/loki/deployed/storageclass.sls +++ /dev/null @@ -1,18 +0,0 @@ -#! metalk8s_kubernetes - -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: metalk8s-loki - labels: - app.kubernetes.io/managed-by: salt - app.kubernetes.io/part-of: metalk8s -provisioner: kubernetes.io/no-provisioner -reclaimPolicy: Retain -volumeBindingMode: WaitForFirstConsumer -mountOptions: - - rw - - discard -parameters: - fsType: ext4 - mkfsOptions: '["-m", "0"]' diff --git a/tests/post/steps/test_logging.py b/tests/post/steps/test_logging.py index 5bd84db3aa..4343915a79 100644 --- a/tests/post/steps/test_logging.py +++ b/tests/post/steps/test_logging.py @@ -192,7 +192,7 @@ def _check_log_line_exists(): utils.retry( _check_log_line_exists, - times=20, + times=40, wait=3, name="check that a log exists for 'logger' pod" )