change kubernetes.io/ label from name to instance (#973)

* Fix #972 change label from name to instance

* Fix tests

* more references

* fix check

* Fix example config
This commit is contained in:
Andrew Suderman
2023-07-13 11:33:15 -06:00
committed by GitHub
parent d55cd4bdf8
commit e7eb079921
9 changed files with 14 additions and 11 deletions
@@ -1,5 +1,5 @@
successMessage: Label app.kubernetes.io/name matches metadata.name
failureMessage: Label app.kubernetes.io/name must match metadata.name
successMessage: Label app.kubernetes.io/instance matches metadata.name
failureMessage: Label app.kubernetes.io/instance must match metadata.name
category: Reliability
target: Controller
schema:
@@ -12,7 +12,7 @@ schema:
properties:
labels:
type: object
required: ["app.kubernetes.io/name"]
required: ["app.kubernetes.io/instance"]
properties:
app.kubernetes.io/name:
app.kubernetes.io/instance:
const: "{{ .metadata.name }}"
+3
View File
@@ -6,6 +6,9 @@ meta:
---
## Unreleased
* Change `metadataAndNameMismatched` to `metadataAndInstanceMismatched`
## 8.1.1
* Add category for `metadataAndNameMismatched`.
* Fix category for `priorityClassNotSet`.
+2 -2
View File
@@ -17,7 +17,7 @@ key | default | description
`priorityClassNotSet` | `warning` | Fails when a priorityClassName is not set for a pod.
`deploymentMissingReplicas` | `warning` | Fails when there is only one replica for a deployment.
`missingPodDisruptionBudget` | `warning` | Fails when PDB is missing.
`metadataAndNameMismatched` | `warning` | Fails when label `app.kubernetes.io/name` and `metadata.name` mismatch
`metadataAndInstanceMismatched` | `warning` | Fails when label `app.kubernetes.io/instance` and `metadata.name` mismatch
`topologySpreadConstraint` | `warning` | Fails when there is no topology spread constraint on the pod
## Background
@@ -70,4 +70,4 @@ spec:
- [Kubernetes Docs: Configure Liveness and Readiness Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/)
- [Utilizing Kubernetes Liveness and Readiness Probes to Automatically Recover From Failure](https://medium.com/spire-labs/utilizing-kubernetes-liveness-and-readiness-probes-to-automatically-recover-from-failure-2fe0314f2b2e)
- [Kubernetes Liveness and Readiness Probes: How to Avoid Shooting Yourself in the Foot](https://blog.colinbreck.com/kubernetes-liveness-and-readiness-probes-how-to-avoid-shooting-yourself-in-the-foot/)
- [Topology Spread Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/)
- [Topology Spread Constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/)
+1 -1
View File
@@ -9,7 +9,7 @@ checks:
topologySpreadConstraint: warning
pdbDisruptionsIsZero: warning
missingPodDisruptionBudget: warning
metadataAndNameMismatched: warning
metadataAndInstanceMismatched: warning
# efficiency
cpuRequestsMissing: warning
+1 -1
View File
@@ -6,7 +6,7 @@ checks:
pullPolicyNotAlways: warning
readinessProbeMissing: warning
livenessProbeMissing: warning
metadataAndNameMismatched: warning
metadataAndInstanceMismatched: warning
pdbDisruptionsIsZero: warning
missingPodDisruptionBudget: warning
topologySpreadConstraint: warning
+1 -1
View File
@@ -55,7 +55,7 @@ var (
// Other checks
"tlsSettingsMissing",
"pdbDisruptionsIsZero",
"metadataAndNameMismatched",
"metadataAndInstanceMismatched",
"missingPodDisruptionBudget",
"missingNetworkPolicy",
"sensitiveConfigmapContent",
@@ -3,7 +3,7 @@ kind: Pod
metadata:
name: nginx
labels:
app.kubernetes.io/name: not-nginx
app.kubernetes.io/instance: not-nginx
spec:
containers:
- name: nginx
@@ -3,7 +3,7 @@ kind: Pod
metadata:
name: nginx
labels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: nginx
spec:
containers:
- name: nginx