Skip to content

Commit a3f8e95

Browse files
authored
Merge pull request kubernetes#77607 from dekkagaijin/mip
when disabled, don't create the API server's insecure port mapping
2 parents 3e7fa61 + 2576713 commit a3f8e95

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

cluster/gce/gci/apiserver_manifest_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ readonly APISERVER_SERVER_KEY_PATH=/foo/bar
4949
readonly APISERVER_CLIENT_CERT_PATH=/foo/bar
5050
readonly CLOUD_CONFIG_MOUNT="{\"name\": \"cloudconfigmount\",\"mountPath\": \"/etc/gce.conf\", \"readOnly\": true},"
5151
readonly CLOUD_CONFIG_VOLUME="{\"name\": \"cloudconfigmount\",\"hostPath\": {\"path\": \"/etc/gce.conf\", \"type\": \"FileOrCreate\"}},"
52+
readonly INSECURE_PORT_MAPPING="{ \"name\": \"local\", \"containerPort\": 8080, \"hostPort\": 8080},"
5253
readonly DOCKER_REGISTRY="k8s.gcr.io"
5354
readonly ENABLE_LEGACY_ABAC=false
5455
readonly ETC_MANIFESTS=${KUBE_HOME}/etc/kubernetes/manifests

cluster/gce/gci/configure-helper.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ function start-etcd-servers {
14981498
# DOCKER_REGISTRY
14991499
# FLEXVOLUME_HOSTPATH_MOUNT
15001500
# FLEXVOLUME_HOSTPATH_VOLUME
1501+
# INSECURE_PORT_MAPPING
15011502
function compute-master-manifest-variables {
15021503
CLOUD_CONFIG_OPT=""
15031504
CLOUD_CONFIG_VOLUME=""
@@ -1518,6 +1519,11 @@ function compute-master-manifest-variables {
15181519
FLEXVOLUME_HOSTPATH_MOUNT="{ \"name\": \"flexvolumedir\", \"mountPath\": \"${VOLUME_PLUGIN_DIR}\", \"readOnly\": true},"
15191520
FLEXVOLUME_HOSTPATH_VOLUME="{ \"name\": \"flexvolumedir\", \"hostPath\": {\"path\": \"${VOLUME_PLUGIN_DIR}\"}},"
15201521
fi
1522+
1523+
INSECURE_PORT_MAPPING=""
1524+
if [[ "${ENABLE_APISERVER_INSECURE_PORT:-false}" == "true" ]]; then
1525+
INSECURE_PORT_MAPPING="{ \"name\": \"local\", \"containerPort\": 8080, \"hostPort\": 8080},"
1526+
fi
15211527
}
15221528

15231529
# A helper function that bind mounts kubelet dirs for running mount in a chroot
@@ -1542,6 +1548,7 @@ function prepare-mounter-rootfs {
15421548
# CLOUD_CONFIG_VOLUME
15431549
# CLOUD_CONFIG_MOUNT
15441550
# DOCKER_REGISTRY
1551+
# INSECURE_PORT_MAPPING
15451552
function start-kube-apiserver {
15461553
echo "Start kubernetes api-server"
15471554
prepare-log-file "${KUBE_API_SERVER_LOG_PATH:-/var/log/kube-apiserver.log}"
@@ -1858,6 +1865,7 @@ function start-kube-apiserver {
18581865
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
18591866
sed -i -e "s@{{liveness_probe_initial_delay}}@${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${src_file}"
18601867
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
1868+
sed -i -e "s@{{insecure_port_mapping}}@${INSECURE_PORT_MAPPING}@g" "${src_file}"
18611869
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
18621870
sed -i -e "s@{{additional_cloud_config_volume}}@@g" "${src_file}"
18631871
sed -i -e "s@{{webhook_authn_config_mount}}@${webhook_authn_config_mount}@g" "${src_file}"

cluster/gce/manifests/kube-apiserver.manifest

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@
5353
"timeoutSeconds": 15
5454
},
5555
"ports":[
56+
{{insecure_port_mapping}}
5657
{ "name": "https",
57-
"containerPort": {{secure_port}},
58-
"hostPort": {{secure_port}}},{
59-
"name": "local",
60-
"containerPort": 8080,
61-
"hostPort": 8080}
62-
],
58+
"containerPort": {{secure_port}},
59+
"hostPort": {{secure_port}}}
60+
],
6361
"volumeMounts": [
6462
{{kms_socket_mount}}
6563
{{encryption_provider_mount}}

0 commit comments

Comments
 (0)