Merge "[k8s_coreos] Add kubernetes dashboard"
This commit is contained in:
commit
457d0f273a
|
@ -0,0 +1,97 @@
|
|||
#cloud-config
|
||||
write_files:
|
||||
- path: /etc/systemd/system/enable-kube-dashboard.service
|
||||
owner: "root:root"
|
||||
permissions: "0644"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Configure Kubernetes Dashboard
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
EnvironmentFile=/etc/sysconfig/heat-params
|
||||
ExecStart=/etc/sysconfig/enable-kube-dashboard.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- path: /etc/sysconfig/enable-kube-dashboard.sh
|
||||
owner: "root:root"
|
||||
permissions: "0755"
|
||||
content: |
|
||||
#!/bin/sh
|
||||
|
||||
TEMPLATE=/etc/kubernetes/addons/kubedash-svc.yaml
|
||||
mkdir -p $(dirname ${TEMPLATE})
|
||||
cat > $TEMPLATE <<EOF
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: kubernetes-dashboard
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: kubernetes-dashboard
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
selector:
|
||||
app: kubernetes-dashboard
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 9090
|
||||
EOF
|
||||
|
||||
TEMPLATE=/etc/kubernetes/addons/kubedash-rc.yaml
|
||||
mkdir -p $(dirname ${TEMPLATE})
|
||||
cat > $TEMPLATE <<EOF
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kubernetes-dashboard
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: kubernetes-dashboard
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
app: kubernetes-dashboard
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: kubernetes-dashboard
|
||||
kubernetes.io/cluster-service: "true"
|
||||
annotations:
|
||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||||
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
|
||||
spec:
|
||||
containers:
|
||||
- name: kubernetes-dashboard
|
||||
image: gcr.io/google_containers/kubernetes-dashboard-amd64:${KUBE_DASHBOARD_VERSION}
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 9090
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 30
|
||||
EOF
|
||||
|
||||
echo "Waiting for Kubernetes API..."
|
||||
until curl --silent "http://127.0.0.1:8080/version"
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
if [ "$(echo $KUBE_DASHBOARD_ENABLED | tr '[:upper:]' '[:lower:]')" == "true" ]; then
|
||||
echo "Setup K8S Dasboard"
|
||||
curl --silent -H "Content-Type: application/yaml" -XPOST -d"$(cat /etc/kubernetes/addons/kubedash-svc.yaml)" "http://127.0.0.1:8080/api/v1/namespaces/kube-system/services" > /dev/null
|
||||
curl --silent -H "Content-Type: application/yaml" -XPOST -d"$(cat /etc/kubernetes/addons/kubedash-rc.yaml)" "http://127.0.0.1:8080/api/v1/namespaces/kube-system/replicationcontrollers" > /dev/null
|
||||
fi
|
|
@ -44,3 +44,5 @@ write_files:
|
|||
HYPERKUBE_IMAGE_REPO="$HYPERKUBE_IMAGE_REPO"
|
||||
CONTAINER_RUNTIME="$CONTAINER_RUNTIME"
|
||||
ETCD_LB_VIP="$ETCD_LB_VIP"
|
||||
KUBE_DASHBOARD_ENABLED="$KUBE_DASHBOARD_ENABLED"
|
||||
KUBE_DASHBOARD_VERSION="$KUBE_DASHBOARD_VERSION"
|
||||
|
|
|
@ -150,6 +150,11 @@ parameters:
|
|||
description: whether or not to disable TLS
|
||||
default: False
|
||||
|
||||
kube_dashboard_enabled:
|
||||
type: boolean
|
||||
description: whether or not to disable kubernetes dashboard
|
||||
default: True
|
||||
|
||||
loadbalancing_protocol:
|
||||
type: string
|
||||
description: >
|
||||
|
@ -225,6 +230,11 @@ parameters:
|
|||
description: version of kubernetes used for kubernetes cluster
|
||||
default: v1.5.2_coreos.1
|
||||
|
||||
kube_dashboard_version:
|
||||
type: string
|
||||
description: version of kubernetes dashboard used for kubernetes cluster
|
||||
default: v1.5.1
|
||||
|
||||
hyperkube_image:
|
||||
type: string
|
||||
description: >
|
||||
|
@ -404,11 +414,13 @@ resources:
|
|||
network_driver: {get_param: network_driver}
|
||||
kubernetes_port: {get_param: kubernetes_port}
|
||||
tls_disabled: {get_param: tls_disabled}
|
||||
kube_dashboard_enabled: {get_param: kube_dashboard_enabled}
|
||||
secgroup_kube_master_id: {get_resource: secgroup_master}
|
||||
http_proxy: {get_param: http_proxy}
|
||||
https_proxy: {get_param: https_proxy}
|
||||
no_proxy: {get_param: no_proxy}
|
||||
kube_version: {get_param: kube_version}
|
||||
kube_dashboard_version: {get_param: kube_dashboard_version}
|
||||
wait_condition_timeout: {get_param: wait_condition_timeout}
|
||||
cluster_uuid: {get_param: cluster_uuid}
|
||||
api_pool_id: {get_attr: [api_lb, pool_id]}
|
||||
|
|
|
@ -107,6 +107,10 @@ parameters:
|
|||
type: boolean
|
||||
description: whether or not to enable TLS
|
||||
|
||||
kube_dashboard_enabled:
|
||||
type: boolean
|
||||
description: whether or not to disable kubernetes dashboard
|
||||
|
||||
kubernetes_port:
|
||||
type: number
|
||||
description: >
|
||||
|
@ -118,6 +122,10 @@ parameters:
|
|||
type: string
|
||||
description: version of kubernetes used for kubernetes cluster
|
||||
|
||||
kube_dashboard_version:
|
||||
type: string
|
||||
description: version of kubernetes dashboard used for kubernetes cluster
|
||||
|
||||
hyperkube_image:
|
||||
type: string
|
||||
description: >
|
||||
|
@ -258,7 +266,9 @@ resources:
|
|||
"$NETWORK_DRIVER": {get_param: network_driver}
|
||||
"$KUBE_API_PORT": {get_param: kubernetes_port}
|
||||
"$TLS_DISABLED": {get_param: tls_disabled}
|
||||
"$KUBE_DASHBOARD_ENABLED": {get_param: kube_dashboard_enabled}
|
||||
"$KUBE_VERSION": {get_param: kube_version}
|
||||
"$KUBE_DASHBOARD_VERSION": {get_param: kube_dashboard_version}
|
||||
"$CLUSTER_UUID": {get_param: cluster_uuid}
|
||||
"$MAGNUM_URL": {get_param: magnum_url}
|
||||
"$HTTP_PROXY": {get_param: http_proxy}
|
||||
|
@ -340,6 +350,12 @@ resources:
|
|||
group: ungrouped
|
||||
config: {get_file: fragments/enable-kube-scheduler.yaml}
|
||||
|
||||
enable_kube_dashboard:
|
||||
type: OS::Heat::SoftwareConfig
|
||||
properties:
|
||||
group: ungrouped
|
||||
config: {get_file: fragments/enable-kube-dashboard.yaml}
|
||||
|
||||
wc_notify:
|
||||
type: OS::Heat::SoftwareConfig
|
||||
properties:
|
||||
|
@ -378,6 +394,7 @@ resources:
|
|||
$enable_kube_proxy
|
||||
$enable_kube_controller_manager
|
||||
$enable_kube_scheduler
|
||||
$enable_kube_dashboard
|
||||
$wc_notify
|
||||
coreos:
|
||||
units:
|
||||
|
@ -405,6 +422,8 @@ resources:
|
|||
command: "start"
|
||||
- name: "enable-kube-scheduler.service"
|
||||
command: "start"
|
||||
- name: "enable-kube-dashboard.service"
|
||||
command: "start"
|
||||
- name: "wc-notify.service"
|
||||
command: "start"
|
||||
params:
|
||||
|
@ -421,6 +440,7 @@ resources:
|
|||
"$enable_kube_proxy": {get_attr: [enable_kube_proxy, config]}
|
||||
"$enable_kube_controller_manager": {get_attr: [enable_kube_controller_manager, config]}
|
||||
"$enable_kube_scheduler": {get_attr: [enable_kube_scheduler, config]}
|
||||
"$enable_kube_dashboard": {get_attr: [enable_kube_dashboard, config]}
|
||||
"$wc_notify": {get_attr: [wc_notify, config]}
|
||||
|
||||
######################################################################
|
||||
|
|
|
@ -20,6 +20,7 @@ class TestCoreosKubernetesAPIs(base.BaseK8sTest):
|
|||
"volume_driver": None,
|
||||
"labels": {
|
||||
"system_pods_initial_delay": 3600,
|
||||
"system_pods_timeout": 600
|
||||
"system_pods_timeout": 600,
|
||||
"kube_dashboard_enabled": False
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue