Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default args to conform with cis #493

Closed
wants to merge 10 commits into from
Closed
23 changes: 13 additions & 10 deletions src/k8s/pkg/k8sd/setup/kube_apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func TestKubeAPIServer(t *testing.T) {
{key: "--kubelet-client-certificate", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver-kubelet-client.crt")},
{key: "--kubelet-client-key", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver-kubelet-client.key")},
{key: "--kubelet-preferred-address-types", expectedVal: "InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP"},
{key: "--profiling", expectedVal: "false"},
{key: "--requests-timeout", expectedVal: "300s"},
{key: "--secure-port", expectedVal: "6443"},
{key: "--service-account-issuer", expectedVal: "https://kubernetes.default.svc"},
Expand All @@ -121,7 +122,6 @@ func TestKubeAPIServer(t *testing.T) {
{key: "--tls-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver.crt")},
{key: "--tls-cipher-suites", expectedVal: apiserverTLSCipherSuites},
{key: "--tls-private-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver.key")},
{key: "--profiling", expectedVal: "false"},
}
for _, tc := range tests {
t.Run(tc.key, func(t *testing.T) {
Expand Down Expand Up @@ -157,14 +157,26 @@ func TestKubeAPIServer(t *testing.T) {
key string
expectedVal string
}{
{key: "--anonymous-auth", expectedVal: "false"},
{key: "--authentication-token-webhook-config-file", expectedVal: path.Join(s.Mock.ServiceExtraConfigDir, "auth-token-webhook.conf")},
{key: "--authorization-mode", expectedVal: "Node,RBAC"},
{key: "--client-ca-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--enable-admission-plugins", expectedVal: "NodeRestriction"},
{key: "--etcd-servers", expectedVal: fmt.Sprintf("unix://%s", path.Join(s.Mock.K8sDqliteStateDir, "k8s-dqlite.sock"))},
{key: "--kubelet-certificate-authority", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "ca.crt")},
{key: "--kubelet-client-certificate", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver-kubelet-client.crt")},
{key: "--kubelet-client-key", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver-kubelet-client.key")},
{key: "--kubelet-preferred-address-types", expectedVal: "InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP"},
{key: "--my-extra-arg", expectedVal: "my-extra-val"},
{key: "--profiling", expectedVal: "false"},
{key: "--proxy-client-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-client.crt")},
{key: "--proxy-client-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-client.key")},
{key: "--requestheader-allowed-names", expectedVal: "front-proxy-client"},
{key: "--requestheader-client-ca-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-ca.crt")},
{key: "--requestheader-extra-headers-prefix", expectedVal: "X-Remote-Extra-"},
{key: "--requestheader-group-headers", expectedVal: "X-Remote-Group"},
{key: "--requestheader-username-headers", expectedVal: "X-Remote-User"},
{key: "--requests-timeout", expectedVal: "300s"},
{key: "--secure-port", expectedVal: "1337"},
{key: "--service-account-issuer", expectedVal: "https://kubernetes.default.svc"},
{key: "--service-account-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "serviceaccount.key")},
Expand All @@ -173,15 +185,6 @@ func TestKubeAPIServer(t *testing.T) {
{key: "--tls-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver.crt")},
{key: "--tls-cipher-suites", expectedVal: apiserverTLSCipherSuites},
{key: "--tls-private-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "apiserver.key")},
{key: "--etcd-servers", expectedVal: fmt.Sprintf("unix://%s", path.Join(s.Mock.K8sDqliteStateDir, "k8s-dqlite.sock"))},
{key: "--requestheader-client-ca-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-ca.crt")},
{key: "--requestheader-allowed-names", expectedVal: "front-proxy-client"},
{key: "--requestheader-extra-headers-prefix", expectedVal: "X-Remote-Extra-"},
{key: "--requestheader-group-headers", expectedVal: "X-Remote-Group"},
{key: "--requestheader-username-headers", expectedVal: "X-Remote-User"},
{key: "--proxy-client-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-client.crt")},
{key: "--proxy-client-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "front-proxy-client.key")},
{key: "--my-extra-arg", expectedVal: "my-extra-val"},
}
for _, tc := range tests {
t.Run(tc.key, func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions src/k8s/pkg/k8sd/setup/kube_controller_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func TestKubeControllerManager(t *testing.T) {
{key: "--cluster-signing-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "ca.crt")},
{key: "--cluster-signing-key-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "ca.key")},
{key: "--my-extra-arg", expectedVal: "my-extra-val"},
{key: "--terminated-pod-gc-threshold", expectedVal: "12500"},
}
for _, tc := range tests {
t.Run(tc.key, func(t *testing.T) {
Expand Down
22 changes: 12 additions & 10 deletions src/k8s/pkg/k8sd/setup/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,28 @@ func TestKubelet(t *testing.T) {
key string
expectedVal string
}{
// Overwritten by extraArgs
eaudetcobello marked this conversation as resolved.
Show resolved Hide resolved
{key: "--anonymous-auth", expectedVal: "false"},
{key: "--authentication-token-webhook", expectedVal: "true"},
{key: "--cert-dir", expectedVal: s.Mock.KubernetesPKIDir},
{key: "--client-ca-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--cluster-dns", expectedVal: "10.152.1.1"},
{key: "--cluster-domain", expectedVal: "override.local"},
{key: "--container-runtime-endpoint", expectedVal: path.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: path.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
{key: "--kubeconfig", expectedVal: path.Join(s.Mock.KubernetesConfigDir, "kubelet.conf")},
{key: "--my-extra-arg", expectedVal: "my-extra-val"},
{key: "--node-ip", expectedVal: "192.168.0.1"},
{key: "--node-labels", expectedVal: expectedControlPlaneLabels},
{key: "--read-only-port", expectedVal: "0"},
{key: "--register-with-taints", expectedVal: ""},
{key: "--root-dir", expectedVal: s.Mock.KubeletRootDir},
{key: "--serialize-image-pulls", expectedVal: "false"},
{key: "--tls-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "kubelet.crt")},
{key: "--tls-cipher-suites", expectedVal: kubeletTLSCipherSuites},
{key: "--cluster-dns", expectedVal: "10.152.1.1"},
// Overwritten by extraArgs
{key: "--cluster-domain", expectedVal: "override.local"},
{key: "--node-ip", expectedVal: "192.168.0.1"},
{key: "--my-extra-arg", expectedVal: "my-extra-val"},
{key: "--tls-private-key", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "kubelet.key")},
}
for _, tc := range tests {
t.Run(tc.key, func(t *testing.T) {
Expand Down Expand Up @@ -269,23 +270,24 @@ func TestKubelet(t *testing.T) {
}{
{key: "--anonymous-auth", expectedVal: "false"},
{key: "--authentication-token-webhook", expectedVal: "true"},
{key: "--cert-dir", expectedVal: s.Mock.KubernetesPKIDir},
{key: "--client-ca-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "client-ca.crt")},
{key: "--cluster-dns", expectedVal: "10.152.1.1"},
{key: "--cluster-domain", expectedVal: "override.local"},
{key: "--container-runtime-endpoint", expectedVal: path.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--containerd", expectedVal: path.Join(s.Mock.ContainerdSocketDir, "containerd.sock")},
{key: "--eviction-hard", expectedVal: "'memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi'"},
{key: "--fail-swap-on", expectedVal: "false"},
{key: "--hostname-override", expectedVal: "dev"},
{key: "--kubeconfig", expectedVal: path.Join(s.Mock.KubernetesConfigDir, "kubelet.conf")},
{key: "--node-ip", expectedVal: "192.168.0.1"},
{key: "--node-labels", expectedVal: expectedWorkerLabels},
{key: "--read-only-port", expectedVal: "0"},
{key: "--register-with-taints", expectedVal: ""},
{key: "--root-dir", expectedVal: s.Mock.KubeletRootDir},
{key: "--serialize-image-pulls", expectedVal: "false"},
{key: "--tls-cert-file", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "kubelet.crt")},
{key: "--tls-cipher-suites", expectedVal: kubeletTLSCipherSuites},
{key: "--cluster-dns", expectedVal: "10.152.1.1"},
{key: "--cluster-domain", expectedVal: "override.local"},
{key: "--node-ip", expectedVal: "192.168.0.1"},
{key: "--tls-private-key", expectedVal: path.Join(s.Mock.KubernetesPKIDir, "kubelet.key")},
}
for _, tc := range tests {
t.Run(tc.key, func(t *testing.T) {
Expand Down
Loading