Skip to content

Commit

Permalink
Use KubeletPort from API object, salt changes, take 2
Browse files Browse the repository at this point in the history
This reverts commit a7425bf, reversing
changes made to 4a9b0fc.
  • Loading branch information
gmarek committed Dec 7, 2015
1 parent d6134e5 commit 4060eba
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cluster/gce/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ manifest_url_header: '$(echo "$MANIFEST_URL_HEADER" | sed -e "s/'/''/g")'
num_nodes: $(echo "${NUM_NODES}")
e2e_storage_test_environment: '$(echo "$E2E_STORAGE_TEST_ENVIRONMENT" | sed -e "s/'/''/g")'
EOF

if [ -n "${KUBELET_PORT:-}" ]; then
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
kubelet_port: '$(echo "$KUBELET_PORT" | sed -e "s/'/''/g")'
EOF
fi
if [ -n "${APISERVER_TEST_ARGS:-}" ]; then
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
apiserver_test_args: '$(echo "$APISERVER_TEST_ARGS" | sed -e "s/'/''/g")'
Expand Down
3 changes: 2 additions & 1 deletion cluster/gce/trusty/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ script
echo "Docker daemon failed!"
pkill docker
fi
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:10250/healthz > /dev/null; then
. /etc/kube-env
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:${KUBELET_PORT:-10250}/healthz > /dev/null; then
echo "Kubelet is unhealthy!"
pkill kubelet
fi
Expand Down
5 changes: 5 additions & 0 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,11 @@ OPENCONTRAIL_KUBERNETES_TAG: $(yaml-quote ${OPENCONTRAIL_KUBERNETES_TAG:-})
OPENCONTRAIL_PUBLIC_SUBNET: $(yaml-quote ${OPENCONTRAIL_PUBLIC_SUBNET:-})
E2E_STORAGE_TEST_ENVIRONMENT: $(yaml-quote ${E2E_STORAGE_TEST_ENVIRONMENT:-})
EOF
if [ -n "${KUBELET_PORT:-}" ]; then
cat >>$file <<EOF
KUBELET_PORT: $(yaml-quote ${KUBELET_PORT})
EOF
fi
if [ -n "${KUBE_APISERVER_REQUEST_TIMEOUT:-}" ]; then
cat >>$file <<EOF
KUBE_APISERVER_REQUEST_TIMEOUT: $(yaml-quote ${KUBE_APISERVER_REQUEST_TIMEOUT})
Expand Down
7 changes: 6 additions & 1 deletion cluster/saltbase/salt/kubelet/default
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,10 @@
{% set network_plugin = "--network-plugin=opencontrail" %}
{% endif -%}

{% set kubelet_port = "" -%}
{% if pillar['kubelet_port'] is defined -%}
{% set kubelet_port="--port=" + pillar['kubelet_port'] %}
{% endif -%}

# test_args has to be kept at the end, so they'll overwrite any prior configuration
DAEMON_ARGS="{{daemon_args}} {{api_servers_with_port}} {{debugging_handlers}} {{hostname_override}} {{cloud_provider}} {{config}} {{manifest_url}} --allow-privileged={{pillar['allow_privileged']}} {{pillar['log_level']}} {{cluster_dns}} {{cluster_domain}} {{docker_root}} {{kubelet_root}} {{configure_cbr0}} {{cgroup_root}} {{system_container}} {{pod_cidr}} {{ master_kubelet_args }} {{cpu_cfs_quota}} {{network_plugin}} {{experimental_flannel_overlay}} {{test_args}}"
DAEMON_ARGS="{{daemon_args}} {{api_servers_with_port}} {{debugging_handlers}} {{hostname_override}} {{cloud_provider}} {{config}} {{manifest_url}} --allow-privileged={{pillar['allow_privileged']}} {{pillar['log_level']}} {{cluster_dns}} {{cluster_domain}} {{docker_root}} {{kubelet_root}} {{configure_cbr0}} {{cgroup_root}} {{system_container}} {{pod_cidr}} {{ master_kubelet_args }} {{cpu_cfs_quota}} {{network_plugin}} {{kubelet_port}} {{experimental_flannel_overlay}} {{test_args}}"
1 change: 1 addition & 0 deletions cluster/saltbase/salt/supervisor/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ monit:
file:
- managed
- source: salt://supervisor/kubelet-checker.sh
- template: jinja
- user: root
- group: root
- mode: 755
Expand Down
7 changes: 6 additions & 1 deletion cluster/saltbase/salt/supervisor/kubelet-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
# it detects a failure. It then exits, and supervisord restarts it
# which in turn restarts the kubelet.

{% set kubelet_port = "10250" -%}
{% if pillar['kubelet_port'] is defined -%}
{% set kubelet_port = pillar['kubelet_port'] -%}
{% endif -%}

/etc/init.d/kubelet stop
/etc/init.d/kubelet start

Expand All @@ -27,7 +32,7 @@ sleep 60
max_seconds=10

while true; do
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:10250/healthz > /dev/null; then
if ! curl --insecure -m ${max_seconds} -f -s https://127.0.0.1:{{kubelet_port}}/healthz > /dev/null; then
echo "kubelet failed!"
exit 2
fi
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.ManifestURLHeader, "manifest-url-header", s.ManifestURLHeader, "HTTP header to use when accessing the manifest URL, with the key separated from the value with a ':', as in 'key:value'")
fs.BoolVar(&s.EnableServer, "enable-server", s.EnableServer, "Enable the Kubelet's server")
fs.IPVar(&s.Address, "address", s.Address, "The IP address for the Kubelet to serve on (set to 0.0.0.0 for all interfaces)")
fs.UintVar(&s.Port, "port", s.Port, "The port for the Kubelet to serve on. Note that \"kubectl logs\" will not work if you set this flag.") // see #9325
fs.UintVar(&s.Port, "port", s.Port, "The port for the Kubelet to serve on.")
fs.UintVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, "The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)")
fs.StringVar(&s.TLSCertFile, "tls-cert-file", s.TLSCertFile, ""+
"File containing x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). "+
Expand Down
4 changes: 2 additions & 2 deletions docs/admin/kubelet.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ kubelet
--oom-score-adj=-999: The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]
--pod-cidr="": The CIDR to use for pod IP addresses, only used in standalone mode. In cluster mode, this is obtained from the master.
--pod-infra-container-image="gcr.io/google_containers/pause:2.0": The image whose network/ipc namespaces containers in each pod will use.
--port=10250: The port for the Kubelet to serve on. Note that "kubectl logs" will not work if you set this flag.
--port=10250: The port for the Kubelet to serve on.
--read-only-port=10255: The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)
--really-crash-for-testing[=false]: If true, when panics occur crash. Intended for testing.
--reconcile-cidr[=true]: Reconcile node CIDR with the CIDR specified by the API server. No-op if register-node or configure-cbr0 is false. [default=true]
Expand All @@ -140,7 +140,7 @@ kubelet
--tls-private-key-file="": File containing x509 private key matching --tls-cert-file.
```

###### Auto generated by spf13/cobra on 24-Nov-2015
###### Auto generated by spf13/cobra on 4-Dec-2015


<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
Expand Down

0 comments on commit 4060eba

Please sign in to comment.