Skip to content

Commit 59fb286

Browse files
author
Ali Erdem Cerrah
committed
feat: Add configuration to enable/disable master taint compliance check.
1 parent 8f133f2 commit 59fb286

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

k8sHealth/k8s.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,15 @@ func CollectMasterTaintCompliance(client kubernetes.Interface) []ComplianceItem
20692069
return results
20702070
}
20712071

2072+
// Check if taint compliance check is disabled via config
2073+
if K8sHealthConfig.K8s.Taint != nil && !*K8sHealthConfig.K8s.Taint {
2074+
log.Debug().
2075+
Str("component", "k8sHealth").
2076+
Str("operation", "collect_master_taint_compliance").
2077+
Msg("Master taint compliance check disabled by config")
2078+
return results
2079+
}
2080+
20722081
nodes, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
20732082
if err != nil {
20742083
log.Error().Err(err).Msg("Error listing nodes for taint compliance")

k8sHealth/kubernetes/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
data:
66
k8s.yml: |
77
k8s:
8+
taint: true
89
namespaces:
910
- YOUR_NAMESPACE_1
1011
floating_ips:

k8sHealth/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type Config struct {
7171
Ingress_floating_ips []string
7272
Enable_cert_manager *bool // nil = auto-detect, true/false = force
7373
Enable_kube_vip *bool // nil = auto-detect, true/false = force
74+
Taint *bool // nil = true (default), false = skip check
7475
Check_namespaces []string `mapstructure:"namespaces"`
7576
}
7677

0 commit comments

Comments
 (0)