-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCP/EKS: Add unit tests for
kubelet_enable_cert_rotation
Signed-off-by: Juan Antonio Osorio Robles <jaosorior@redhat.com>
- Loading branch information
Showing
3 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
...tions/openshift/kubelet/kubelet_enable_cert_rotation/tests/cert_rotation_disabled.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
# remediation = none | ||
|
||
set -x | ||
|
||
kubeconfig=$(cat << EOF | ||
{ | ||
"kind": "KubeletConfiguration", | ||
"apiVersion": "kubelet.config.k8s.io/v1beta1", | ||
"address": "0.0.0.0", | ||
"authentication": { | ||
"anonymous": { | ||
"enabled": false | ||
}, | ||
"webhook": { | ||
"cacheTTL": "2m0s", | ||
"enabled": true | ||
}, | ||
"x509": { | ||
"clientCAFile": "/etc/kubernetes/pki/ca.crt" | ||
} | ||
}, | ||
"authorization": { | ||
"mode": "Webhook", | ||
"webhook": { | ||
"cacheAuthorizedTTL": "5m0s", | ||
"cacheUnauthorizedTTL": "30s" | ||
} | ||
}, | ||
"clusterDomain": "cluster.local", | ||
"hairpinMode": "hairpin-veth", | ||
"readOnlyPort": 0, | ||
"cgroupDriver": "cgroupfs", | ||
"cgroupRoot": "/", | ||
"featureGates": { | ||
"RotateKubeletServerCertificate": true | ||
}, | ||
"rotateCertificates": false, | ||
"protectKernelDefaults": true, | ||
"serializeImagePulls": false, | ||
"serverTLSBootstrap": true, | ||
"tlsCipherSuites": [ | ||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_128_GCM_SHA256" | ||
], | ||
"clusterDNS": [ | ||
"10.100.0.10" | ||
], | ||
"evictionHard": { | ||
"memory.available": "100Mi", | ||
"nodefs.available": "10%", | ||
"nodefs.inodesFree": "5%" | ||
}, | ||
"kubeReserved": { | ||
"cpu": "70m", | ||
"ephemeral-storage": "1Gi", | ||
"memory": "574Mi" | ||
}, | ||
"maxPods": 29 | ||
} | ||
EOF | ||
) | ||
|
||
# This is applicable to both OpenShift and EKS | ||
for path in "/etc/kubernetes/kubelet/kubelet-config.json" "/etc/kubernetes/kubelet.conf" | ||
do | ||
mkdir -p $(dirname $path) | ||
echo $kubeconfig > $path | ||
done |
75 changes: 75 additions & 0 deletions
75
...ations/openshift/kubelet/kubelet_enable_cert_rotation/tests/cert_rotation_enabled.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
# remediation = none | ||
|
||
set -x | ||
|
||
kubeconfig=$(cat << EOF | ||
{ | ||
"kind": "KubeletConfiguration", | ||
"apiVersion": "kubelet.config.k8s.io/v1beta1", | ||
"address": "0.0.0.0", | ||
"authentication": { | ||
"anonymous": { | ||
"enabled": false | ||
}, | ||
"webhook": { | ||
"cacheTTL": "2m0s", | ||
"enabled": true | ||
}, | ||
"x509": { | ||
"clientCAFile": "/etc/kubernetes/pki/ca.crt" | ||
} | ||
}, | ||
"authorization": { | ||
"mode": "Webhook", | ||
"webhook": { | ||
"cacheAuthorizedTTL": "5m0s", | ||
"cacheUnauthorizedTTL": "30s" | ||
} | ||
}, | ||
"clusterDomain": "cluster.local", | ||
"hairpinMode": "hairpin-veth", | ||
"readOnlyPort": 0, | ||
"cgroupDriver": "cgroupfs", | ||
"cgroupRoot": "/", | ||
"featureGates": { | ||
"RotateKubeletServerCertificate": true | ||
}, | ||
"protectKernelDefaults": true, | ||
"serializeImagePulls": false, | ||
"serverTLSBootstrap": true, | ||
"rotateCertificates": true, | ||
"tlsCipherSuites": [ | ||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_128_GCM_SHA256" | ||
], | ||
"clusterDNS": [ | ||
"10.100.0.10" | ||
], | ||
"evictionHard": { | ||
"memory.available": "100Mi", | ||
"nodefs.available": "10%", | ||
"nodefs.inodesFree": "5%" | ||
}, | ||
"kubeReserved": { | ||
"cpu": "70m", | ||
"ephemeral-storage": "1Gi", | ||
"memory": "574Mi" | ||
}, | ||
"maxPods": 29 | ||
} | ||
EOF | ||
) | ||
|
||
# This is applicable to both OpenShift and EKS | ||
for path in "/etc/kubernetes/kubelet/kubelet-config.json" "/etc/kubernetes/kubelet.conf" | ||
do | ||
mkdir -p $(dirname $path) | ||
echo $kubeconfig > $path | ||
done |
74 changes: 74 additions & 0 deletions
74
...ations/openshift/kubelet/kubelet_enable_cert_rotation/tests/cert_rotation_missing.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
# remediation = none | ||
|
||
set -x | ||
|
||
kubeconfig=$(cat << EOF | ||
{ | ||
"kind": "KubeletConfiguration", | ||
"apiVersion": "kubelet.config.k8s.io/v1beta1", | ||
"address": "0.0.0.0", | ||
"authentication": { | ||
"anonymous": { | ||
"enabled": false | ||
}, | ||
"webhook": { | ||
"cacheTTL": "2m0s", | ||
"enabled": true | ||
}, | ||
"x509": { | ||
"clientCAFile": "/etc/kubernetes/pki/ca.crt" | ||
} | ||
}, | ||
"authorization": { | ||
"mode": "Webhook", | ||
"webhook": { | ||
"cacheAuthorizedTTL": "5m0s", | ||
"cacheUnauthorizedTTL": "30s" | ||
} | ||
}, | ||
"clusterDomain": "cluster.local", | ||
"hairpinMode": "hairpin-veth", | ||
"readOnlyPort": 0, | ||
"cgroupDriver": "cgroupfs", | ||
"cgroupRoot": "/", | ||
"featureGates": { | ||
"RotateKubeletServerCertificate": true | ||
}, | ||
"protectKernelDefaults": true, | ||
"serializeImagePulls": false, | ||
"serverTLSBootstrap": true, | ||
"tlsCipherSuites": [ | ||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", | ||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", | ||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_256_GCM_SHA384", | ||
"TLS_RSA_WITH_AES_128_GCM_SHA256" | ||
], | ||
"clusterDNS": [ | ||
"10.100.0.10" | ||
], | ||
"evictionHard": { | ||
"memory.available": "100Mi", | ||
"nodefs.available": "10%", | ||
"nodefs.inodesFree": "5%" | ||
}, | ||
"kubeReserved": { | ||
"cpu": "70m", | ||
"ephemeral-storage": "1Gi", | ||
"memory": "574Mi" | ||
}, | ||
"maxPods": 29 | ||
} | ||
EOF | ||
) | ||
|
||
# This is applicable to both OpenShift and EKS | ||
for path in "/etc/kubernetes/kubelet/kubelet-config.json" "/etc/kubernetes/kubelet.conf" | ||
do | ||
mkdir -p $(dirname $path) | ||
echo $kubeconfig > $path | ||
done |