Merge "[k8s] Add Dashboard UI v1.4 addon to K8s Cluster"

This commit is contained in:
Jenkins 2016-10-12 07:38:24 +00:00 committed by Gerrit Code Review
commit 7c09cfc263
7 changed files with 175 additions and 0 deletions

View File

@ -55,6 +55,10 @@ Properties:
Contract: $.bool().notNull() Contract: $.bool().notNull()
Default: true Default: true
enableDashboard:
Contract: $.bool().notNull()
Default: true
dockerRegistry: dockerRegistry:
Contract: $.string() Contract: $.string()
@ -152,11 +156,22 @@ Methods:
Then: Then:
$._deployDns() $._deployDns()
- If: $.enableDashboard
Then:
- $._deployDashboard()
- If: $.gatewayCount > 0
Then:
- $msg: $.gatewayNodes.take($.gatewayCount).select('http://{0}:{1}'.format($.getIp(true), 9090)).join(', ')
- $._environment.reporter.report($this, 'Dashboard UI is available at {0}'.format($msg))
Else:
- $._environment.reporter.report($this, 'Dashboard UI is installed but is not accessible from outside')
- $._environment.stack.push() - $._environment.stack.push()
- $._updateServicePublicIps() - $._updateServicePublicIps()
- $.setAttr(lastNodeCount, $.nodeCount) - $.setAttr(lastNodeCount, $.nodeCount)
- $.setAttr(lastGatewayCount, $.gatewayCount) - $.setAttr(lastGatewayCount, $.gatewayCount)
- $._environment.reporter.report($this, 'Kubernetes cluster is up and running') - $._environment.reporter.report($this, 'Kubernetes cluster is up and running')
- $.setAttr(serviceEndpoints, $.serviceEndpoints) - $.setAttr(serviceEndpoints, $.serviceEndpoints)
@ -165,6 +180,23 @@ Methods:
Return: $.masterNode.getIp() Return: $.masterNode.getIp()
_deployDashboard:
Body:
- If: not $.getAttr(uiDeployed, false)
Then:
- $securityGroupIngress:
- ToPort: 9090
FromPort: 9090
IpProtocol: tcp
External: $.masterNode.instance.assignFloatingIp
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $resources: new(sys:Resources)
- $template: $resources.yaml('DeployDashboard.template').bind(dict(ip => $.getIp()))
- $.masterNode.instance.agent.call($template, $resources)
- $.setAttr(uiDeployed, true)
_deployDns: _deployDns:
Body: Body:
- If: not $.getAttr(dnsDeployed, false) - If: not $.getAttr(dnsDeployed, false)

View File

@ -0,0 +1,32 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
FormatVersion: 2.0.0
Version: 1.0.0
Name: Deploy Dashboard
Parameters:
ip: $ip
Body: |
return deploy('{0}'.format(args.ip)).stdout
Scripts:
deploy:
Type: Application
Version: 1.0.0
EntryPoint: deployDashboard.sh
Files:
- addons/kube-dashboard-addon.yaml
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,70 @@
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Configuration to deploy release version of the Dashboard UI.
#
# Example usage: kubectl create -f <this_file>
kind: Service
apiVersion: v1
metadata:
labels:
app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
type: ClusterIP
ports:
- port: 9090
targetPort: 9090
selector:
app: kubernetes-dashboard
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
labels:
app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: kubernetes-dashboard
template:
metadata:
labels:
app: kubernetes-dashboard
spec:
containers:
- name: kubernetes-dashboard
image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.4.0
imagePullPolicy: Always
ports:
- containerPort: 9090
protocol: TCP
args:
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
- --apiserver-host=http://%%MASTER_IP%%:8080
livenessProbe:
httpGet:
path: /
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30

View File

@ -0,0 +1,9 @@
#!/bin/bash
# $1 - IP
sed -i.bak "s/%%MASTER_IP%%/$1/g" addons/kube-dashboard-addon.yaml
cp -f addons/kube-dashboard-addon.yaml /etc/kubernetes/addons
/opt/bin/kubectl create -f /etc/kubernetes/addons/kube-dashboard-addon.yaml >> /tmp/murano-kube.log

View File

@ -5,6 +5,22 @@ defaults
contimeout 5000 contimeout 5000
clitimeout 50000 clitimeout 50000
srvtimeout 50000 srvtimeout 50000
#Template for kubernetes-dashboard addon
{{$svc := "/registry/services/endpoints/kube-system/kubernetes-dashboard"}}
{{if exists $svc}}
{{$uiEndpoint := get $svc}}
{{$uiSpec := get "/registry/services/specs/kube-system/kubernetes-dashboard"}}
{{$uiEndpointJson := json $uiEndpoint.Value}}{{$uiSpecJson := json $uiSpec.Value}}
{{range $port := $uiSpecJson.spec.ports}}
listen kubernetes-dashboard-{{$port.port}} 0.0.0.0:{{$port.port}}
mode tcp
balance leastconn
{{range $subset := $uiEndpointJson.subsets}}{{range $index, $endpoint := $subset.addresses}}
server srv{{$index}} {{$endpoint.ip}}:{{$port.targetPort}}
{{end}}{{end}}{{end}}{{end}}
#Template for the rest of services located in default namespace
{{range $svc := ls "/registry/services/endpoints/default"}} {{range $svc := ls "/registry/services/endpoints/default"}}
{{$se := printf "/registry/services/endpoints/default/%s" $svc }} {{$se := printf "/registry/services/endpoints/default/%s" $svc }}
{{$ss := printf "/registry/services/specs/default/%s" $svc }} {{$ss := printf "/registry/services/specs/default/%s" $svc }}

View File

@ -67,6 +67,7 @@ Application:
dockerMirror: $.kubeNetConfiguration.dockerMirror dockerMirror: $.kubeNetConfiguration.dockerMirror
gcloudKey: $.kubeNetConfiguration.gcloudKey gcloudKey: $.kubeNetConfiguration.gcloudKey
enableKubeDns: $.kubeNetConfiguration.enableKubeDns enableKubeDns: $.kubeNetConfiguration.enableKubeDns
enableDashboard: $.kubeNetConfiguration.enableDashboard
Forms: Forms:
- nodesConfiguration: - nodesConfiguration:
@ -180,6 +181,13 @@ Forms:
description: >- description: >-
Check, if you are going to use KubeDNS feature in your cluster Check, if you are going to use KubeDNS feature in your cluster
required: false required: false
- name: enableDashboard
type: boolean
initial: true
label: Enable Kubernetes Dashboard addon
description: >-
Check, if you are going to use Kubernetes Dashboard in your cluster
required: false
- name: dockerRegistry - name: dockerRegistry
type: string type: string
label: Custom Docker registry URL label: Custom Docker registry URL

View File

@ -0,0 +1,8 @@
---
features:
- Now Kubernetes Cluster murano application provides ability to install
Kubernetes Dashbord addon v1.4 during cluster deployment.
Dashboard (the web-based user interface of Kubernetes) allows user
to deploy containerized applications to a Kubernetes cluster, troubleshoot
them, and manage the cluster and its resources itself.
User can find dashbord endpoint in deployment logs.