[k8s] Add heapster_enabled label

Story: 2004816
Task: 37654

Change-Id: Icd7f380d87672c00257e34df385d81e1c3e36ddf
Signed-off-by: Diogo Guerra <dy090.guerra@gmail.com>
This commit is contained in:
Bharat Kunwar 2019-12-11 10:56:44 +00:00
parent ef061ce86f
commit 1ad4a9d0a0
11 changed files with 60 additions and 18 deletions

View File

@ -306,6 +306,9 @@ the table are linked to more details elsewhere in the user guide.
+---------------------------------------+--------------------+---------------+
| `mesos_slave_executor_env_variables`_ | (file name) | "" |
+---------------------------------------+--------------------+---------------+
| `heapster_enabled`_ | - true | true |
| | - false | |
+---------------------------------------+--------------------+---------------+
| `monitoring_enabled`_ | - true | false |
| | - false | |
+---------------------------------------+--------------------+---------------+
@ -1190,6 +1193,11 @@ _`kube_tag`
If unset, the current Magnum version's default Kubernetes release is
installed.
_`heapster_enabled`
heapster_enabled is used to enable disable the installation of heapster.
Ussuri default: true
Train default: true
_`cloud_provider_tag`
This label allows users to select `a specific release for the openstack
cloud provider

View File

@ -5,6 +5,12 @@ printf "Starting to run ${step}\n"
. /etc/sysconfig/heat-params
echo "Waiting for Kubernetes API..."
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done
if [ "$(echo $KUBE_DASHBOARD_ENABLED | tr '[:upper:]' '[:lower:]')" == "true" ]; then
KUBE_DASH_IMAGE="${CONTAINER_INFRA_PREFIX:-gcr.io/google_containers/}kubernetes-dashboard-amd64:${KUBE_DASHBOARD_VERSION}"
HEAPSTER_IMAGE="${CONTAINER_INFRA_PREFIX:-gcr.io/google_containers/}heapster-amd64:v1.4.2"
@ -335,23 +341,19 @@ spec:
EOF
}
echo "Waiting for Kubernetes API..."
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done
kubectl apply --validate=false -f $INFLUX_DEPLOY
kubectl apply --validate=false -f $GRAFANA_DEPLOY
fi
# Deploy Heapster
HEAPSTER_DEPLOY=/srv/magnum/kubernetes/heapster-controller.yaml
if [ "$(echo ${HEAPSTER_ENABLED} | tr '[:upper:]' '[:lower:]')" = "true" ]; then
[ -f ${HEAPSTER_DEPLOY} ] || {
echo "Writing File: $HEAPSTER_DEPLOY"
mkdir -p $(dirname ${HEAPSTER_DEPLOY})
cat << EOF > ${HEAPSTER_DEPLOY}
HEAPSTER_DEPLOY=/srv/magnum/kubernetes/heapster-controller.yaml
[ -f ${HEAPSTER_DEPLOY} ] || {
echo "Writing File: $HEAPSTER_DEPLOY"
mkdir -p $(dirname ${HEAPSTER_DEPLOY})
cat << EOF > ${HEAPSTER_DEPLOY}
apiVersion: v1
kind: ServiceAccount
metadata:
@ -450,16 +452,12 @@ subjects:
name: heapster
namespace: kube-system
EOF
}
}
echo "Waiting for Kubernetes API..."
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done
kubectl apply --validate=false -f $HEAPSTER_DEPLOY
fi
kubectl apply --validate=false -f $KUBE_DASH_DEPLOY
kubectl apply --validate=false -f $HEAPSTER_DEPLOY
fi
printf "Finished running ${step}\n"

View File

@ -8,6 +8,7 @@ HEAT_PARAMS=/etc/sysconfig/heat-params
mkdir -p "$(dirname ${HEAT_PARAMS})"
cat > ${HEAT_PARAMS} <<EOF
INSTANCE_NAME="$INSTANCE_NAME"
HEAPSTER_ENABLED="$HEAPSTER_ENABLED"
PROMETHEUS_MONITORING="$PROMETHEUS_MONITORING"
KUBE_API_PUBLIC_ADDRESS="$KUBE_API_PUBLIC_ADDRESS"
KUBE_API_PRIVATE_ADDRESS="$KUBE_API_PRIVATE_ADDRESS"

View File

@ -8,6 +8,7 @@ HEAT_PARAMS=/etc/sysconfig/heat-params
mkdir -p "$(dirname ${HEAT_PARAMS})"
cat > ${HEAT_PARAMS} <<EOF
INSTANCE_NAME="$INSTANCE_NAME"
HEAPSTER_ENABLED="$HEAPSTER_ENABLED"
PROMETHEUS_MONITORING="$PROMETHEUS_MONITORING"
KUBE_ALLOW_PRIV="$KUBE_ALLOW_PRIV"
KUBE_MASTER_IP="$KUBE_MASTER_IP"

View File

@ -85,6 +85,7 @@ class K8sFedoraTemplateDefinition(k8s_template_def.K8sTemplateDefinition):
'prometheus_tag', 'grafana_tag',
'heat_container_agent_tag',
'keystone_auth_enabled', 'k8s_keystone_auth_tag',
'heapster_enabled',
'monitoring_enabled',
'prometheus_operator_chart_tag',
'tiller_enabled',

View File

@ -117,6 +117,11 @@ parameters:
default: ""
description: the name of the nodegroup where the node belongs
heapster_enabled:
type: boolean
description: enable/disable the use of heapster
default: true
minion_flavor:
type: string
default: m1.small
@ -984,6 +989,7 @@ resources:
- [{ get_param: 'OS::stack_name' }, 'master', '%index%']
nodegroup_role: {get_param: master_role}
nodegroup_name: {get_param: master_nodegroup_name}
heapster_enabled: {get_param: heapster_enabled}
prometheus_monitoring: {get_param: prometheus_monitoring}
grafana_admin_passwd: {get_param: grafana_admin_passwd}
api_public_address: {get_attr: [api_lb, floating_address]}

View File

@ -27,6 +27,10 @@ parameters:
type: string
description: the name of the nodegroup where the node belongs
heapster_enabled:
type: boolean
description: enable/disable the use of heapster
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
@ -610,6 +614,7 @@ resources:
template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.sh}
params:
"$INSTANCE_NAME": {get_param: name}
"$HEAPSTER_ENABLED": {get_param: heapster_enabled}
"$PROMETHEUS_MONITORING": {get_param: prometheus_monitoring}
"$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]}
"$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]}

View File

@ -117,6 +117,11 @@ parameters:
default: ""
description: the name of the nodegroup where the node belongs
heapster_enabled:
type: boolean
description: enable/disable the use of heapster
default: true
minion_flavor:
type: string
default: m1.small
@ -986,6 +991,7 @@ resources:
- [{ get_param: 'OS::stack_name' }, 'master', '%index%']
nodegroup_role: {get_param: master_role}
nodegroup_name: {get_param: master_nodegroup_name}
heapster_enabled: {get_param: heapster_enabled}
prometheus_monitoring: {get_param: prometheus_monitoring}
grafana_admin_passwd: {get_param: grafana_admin_passwd}
api_public_address: {get_attr: [api_lb, floating_address]}

View File

@ -27,6 +27,10 @@ parameters:
type: string
description: the name of the nodegroup where the node belongs
heapster_enabled:
type: boolean
description: enable/disable the use of heapster
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
@ -616,6 +620,7 @@ resources:
template: {get_file: ../../common/templates/kubernetes/fragments/write-heat-params-master.sh}
params:
"$INSTANCE_NAME": {get_param: name}
"$HEAPSTER_ENABLED": {get_param: heapster_enabled}
"$PROMETHEUS_MONITORING": {get_param: prometheus_monitoring}
"$KUBE_API_PUBLIC_ADDRESS": {get_attr: [api_address_switch, public_ip]}
"$KUBE_API_PRIVATE_ADDRESS": {get_attr: [api_address_switch, private_ip]}

View File

@ -464,6 +464,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
flannel_subnet = mock_cluster.labels.get(
'flannel_network_subnetlen')
flannel_backend = mock_cluster.labels.get('flannel_backend')
heapster_enabled = mock_cluster.labels.get(
'heapster_enabled')
system_pods_initial_delay = mock_cluster.labels.get(
'system_pods_initial_delay')
system_pods_timeout = mock_cluster.labels.get(
@ -585,6 +587,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'flannel_network_cidr': flannel_cidr,
'flannel_network_subnetlen': flannel_subnet,
'flannel_backend': flannel_backend,
'heapster_enabled': heapster_enabled,
'system_pods_initial_delay': system_pods_initial_delay,
'system_pods_timeout': system_pods_timeout,
'admission_control_list': admission_control_list,
@ -910,6 +913,8 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
flannel_subnet = mock_cluster.labels.get(
'flannel_network_subnetlen')
flannel_backend = mock_cluster.labels.get('flannel_backend')
heapster_enabled = mock_cluster.labels.get(
'heapster_enabled')
system_pods_initial_delay = mock_cluster.labels.get(
'system_pods_initial_delay')
system_pods_timeout = mock_cluster.labels.get(
@ -1031,6 +1036,7 @@ class AtomicK8sTemplateDefinitionTestCase(BaseK8sTemplateDefinitionTestCase):
'flannel_network_cidr': flannel_cidr,
'flannel_network_subnetlen': flannel_subnet,
'flannel_backend': flannel_backend,
'heapster_enabled': heapster_enabled,
'system_pods_initial_delay': system_pods_initial_delay,
'system_pods_timeout': system_pods_timeout,
'fixed_network_name': fixed_network_name,

View File

@ -0,0 +1,5 @@
---
features:
- |
Added label heapster_enabled to control heapster installation in the
cluster.