Skip to content

Commit

Permalink
fix #61369 kubeadm init & join
Browse files Browse the repository at this point in the history
  • Loading branch information
daro1337 committed Sep 25, 2022
1 parent 245991a commit 3a2187b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
21 changes: 19 additions & 2 deletions salt/modules/kubeadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,11 @@ def init(
apiserver_cert_extra_sans=None,
cert_dir=None,
certificate_key=None,
control_plane_endpoint=None,
config=None,
cri_socket=None,
experimental_upload_certs=False,
upload_certs=False,
feature_gates=None,
ignore_preflight_errors=None,
image_repository=None,
Expand Down Expand Up @@ -1025,11 +1027,17 @@ def init(
config
Path to a kubeadm configuration file
control_plane_endpoint
Specify a stable IP address or DNS name for the control plane
cri_socket
Path to the CRI socket to connect
experimental_upload_certs
Upload control-plane certificate to the kubeadm-certs Secret
Upload control-plane certificate to the kubeadm-certs Secret. ( kubeadm version =< 1.16 )
upload_certs
Upload control-plane certificate to the kubeadm-certs Secret. ( kubeadm version > 1.16 )
feature_gates
A set of key=value pairs that describe feature gates for
Expand Down Expand Up @@ -1093,6 +1101,8 @@ def init(

if experimental_upload_certs:
cmd.append("--experimental-upload-certs")
if upload_certs:
cmd.append("--upload-certs")
if skip_certificate_key_print:
cmd.append("--skip-certificate-key-print")
if skip_token_print:
Expand All @@ -1105,6 +1115,7 @@ def init(
("cert-dir", cert_dir),
("certificate-key", certificate_key),
("config", config),
("control-plane-endpoint", control_plane_endpoint),
("cri-socket", cri_socket),
("feature-gates", feature_gates),
("ignore-preflight-errors", ignore_preflight_errors),
Expand Down Expand Up @@ -1174,6 +1185,7 @@ def join(
discovery_token_ca_cert_hash=None,
discovery_token_unsafe_skip_ca_verification=False,
experimental_control_plane=False,
control_plane=False,
ignore_preflight_errors=None,
node_name=None,
skip_phases=None,
Expand Down Expand Up @@ -1224,7 +1236,10 @@ def join(
'discovery-token-ca-cert-hash' pinning
experimental_control_plane
Create a new control plane instance on this node
Create a new control plane instance on this node (kubeadm version =< 1.16)
control_plane
Create a new control plane instance on this node (kubeadm version > 1.16)
ignore_preflight_errors
A list of checks whose errors will be shown as warnings
Expand Down Expand Up @@ -1261,6 +1276,8 @@ def join(
cmd.append("--discovery-token-unsafe-skip-ca-verification")
if experimental_control_plane:
cmd.append("--experimental-control-plane")
if control_plane:
cmd.append("--control-plane")

parameters = [
("apiserver-advertise-address", apiserver_advertise_address),
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/modules/test_kubeadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ def test_init_params(self):
certificate_key="secret",
config="/config.cfg",
cri_socket="socket",
experimental_upload_certs=True,
upload_certs=True,
feature_gates="k=v",
ignore_preflight_errors="all",
image_repository="example.org",
Expand All @@ -1163,7 +1163,7 @@ def test_init_params(self):
[
"kubeadm",
"init",
"--experimental-upload-certs",
"--upload-certs",
"--skip-certificate-key-print",
"--skip-token-print",
"--apiserver-advertise-address",
Expand Down Expand Up @@ -1252,7 +1252,7 @@ def test_join_params(self):
discovery_token="token",
discovery_token_ca_cert_hash="type:value",
discovery_token_unsafe_skip_ca_verification=True,
experimental_control_plane=True,
control_plane=True,
ignore_preflight_errors="all",
node_name="node-1",
skip_phases="all",
Expand All @@ -1268,7 +1268,7 @@ def test_join_params(self):
"join",
"10.160.65.165:6443",
"--discovery-token-unsafe-skip-ca-verification",
"--experimental-control-plane",
"--control-plane",
"--apiserver-advertise-address",
"127.0.0.1",
"--apiserver-bind-port",
Expand Down

0 comments on commit 3a2187b

Please sign in to comment.