fix kubelinter

This commit is contained in:
Eugenio Marzo
2023-01-28 14:22:46 +01:00
parent fba16dba05
commit 044a637522
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ RUN luarocks install lunajson
RUN luarocks install lyaml
# Install kube-linter
RUN curl -L -O https://github.com/stackrox/kube-linter/releases/download/0.5.1/kube-linter-linux.tar.gz
RUN curl -L -O https://github.com/stackrox/kube-linter/releases/download/0.6.0/kube-linter-linux.tar.gz
RUN tar -xvf kube-linter-linux.tar.gz && rm -f kube-linter-linux.tar.gz
RUN cp kube-linter /usr/local/bin/ && chmod 775 /usr/local/bin/kube-linter
RUN mkdir /tmp/kube-linter-pods && chmod 777 /tmp/kube-linter-pods

View File

@@ -18,5 +18,5 @@ done
#date_now=$(date)
#echo "${date_now} | Namespace: ${i} | Token: ${K8S_TOKEN} | KUBERNETES_SERVICE_HOST: ${KUBERNETES_SERVICE_HOST} | KUBERNETES_SERVICE_PORT_HTTPS: ${KUBERNETES_SERVICE_PORT_HTTPS}" >> /tmp/linter.log
return_json=$(kube-linter lint /tmp/kube-linter-pods/* --format json | jq '[.Reports[] | {message: .Diagnostic.Message, remediation: .Remediation, k8s_object: .Object.K8sObject.Name, namespace: .Object.K8sObject.Namespace, kind: .Object.K8sObject.GroupVersionKind.Kind}]')
echo "<div class='row log-row'>${return_json}</div>"
return_json=$(kube-linter lint /tmp/kube-linter-pods/* --format json | jq '[.Reports[] | {message: .Diagnostic.Message, remediation: .Remediation, k8s_object: .Object.K8sObject.Name, namespace: .Object.K8sObject.Namespace, kind: .Object.K8sObject.GroupVersionKind.Kind}]' | sed "s/{/<div class='row log-row' style='margin-top: 2%;'>/g" | sed "s/}/<\/div>/g" | sed "s/<\/div>,/<\/div><hr style='margin-top: 2%;'>/g" | sed "s/\[//g" | sed "s/\]//g")
echo "<p>START KUBELINTER</p><div class='row log-row' style='margin-top: 2%;'>${return_json}</div><p style='margin-top: 2%;'>END KUBELINTER</p>"