[Kubernetes] Kubernetes was updated to v1.0.6 and v1 API

Implements-Blueprint: update-k8-to-v1-api
Change-Id: Ie34997dc2aef87226459fa67640e39c08cca0ddf
This commit is contained in:
Stan Lagun 2015-10-05 10:05:50 +03:00
parent aaa49d0a83
commit 026e28fc9d
15 changed files with 14 additions and 128 deletions

View File

@ -111,9 +111,9 @@ Methods:
Then:
- $._environment.reporter.report($this, 'Setting up Kubernetes cluster')
- Parallel:
- Do: $.masterNode.deployInstance()
- Do: $.minionNodes.take($.nodeCount).pselect($.deployInstance())
- Do: $.gatewayNodes.take($.gatewayCount).pselect($.deployInstance())
- $.masterNode.deployInstance()
- $.minionNodes.take($.nodeCount).pselect($.deployInstance())
- $.gatewayNodes.take($.gatewayCount).pselect($.deployInstance())
- $.masterNode.setupEtcd()
- $.minionNodes.take($.nodeCount).select($.setupEtcd())
@ -121,9 +121,9 @@ Methods:
- $.masterNode.setupNode()
- Parallel:
- Do: $.minionNodes.take($.nodeCount).pselect($.setupNode())
- Do: $.minionNodes.skip($.nodeCount).pselect($.removeFromCluster())
- Do: $.gatewayNodes.take($.gatewayCount).pselect($.setupNode())
- $.minionNodes.take($.nodeCount).pselect($.setupNode())
- $.minionNodes.skip($.nodeCount).pselect($.removeFromCluster())
- $.gatewayNodes.take($.gatewayCount).pselect($.setupNode())
- $._updateServicePublicIps()
- $.setAttr(lastNodeCount, $.nodeCount)
- $.setAttr(lastGatewayCount, $.gatewayCount)
@ -277,7 +277,7 @@ Methods:
Body:
- $serviceDefinition:
apiVersion: v1beta3
apiVersion: v1
kind: Service
metadata:
labels:

View File

@ -87,7 +87,6 @@ Methods:
dockerRegistry => $._cluster.dockerRegistry
))
- $.instance.agent.call($template, $resources)
- $._registerNode()
- $.setAttr(nodeConfigured, true)
- $msg: 'cAdvisor monitoring for Node {0} is now available at http://{1}:4194'
- $ip: $.getIp()
@ -97,30 +96,6 @@ Methods:
- $._environment.reporter.report($this, $msg.format($.instance.name, $ip))
_registerNode:
Body:
- $resources: new(sys:Resources)
- $template: $resources.yaml('GetNodeCapabilities.template')
- $capacity: $.instance.agent.call($template, $resources)
- $nodeDefinition:
kind: Node
apiVersion: v1beta3
metadata:
name: $.getIp()
labels:
name: $.instance.name
spec:
externalID: $.id()
status:
capacity: $capacity
- $template: $resources.yaml('KubeRegisterNode.template').bind(dict(
nodeDefinition => $nodeDefinition
))
- $._cluster.masterNode.instance.agent.call($template, $resources)
removeFromCluster:
Body:
- If: $.getAttr(nodeConfigured, false)

View File

@ -1,38 +0,0 @@
# 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: Get Node capabilities
Body: |
return {
'cpu': int(getCpuCoresCount().stdout) * 100,
'memory': int(getMemoryBytes().stdout)
}
Scripts:
getCpuCoresCount:
Type: Application
Version: 1.0.0
EntryPoint: getCpuCoresCount.sh
Options:
captureStdout: true
captureStderr: true
getMemoryBytes:
Type: Application
Version: 1.0.0
EntryPoint: getMemoryBytes.sh
Options:
captureStdout: true
captureStderr: true

View File

@ -1,38 +0,0 @@
# 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: Register Kubernetes Node
Parameters:
nodeDefinition: $nodeDefinition
Body: |
import json
import uuid
fileName = '/var/run/murano-kubernetes/' + str(uuid.uuid4()) + '.json'
with open(fileName, 'w') as f:
json.dump(args.nodeDefinition, f)
return register(fileName).stdout
Scripts:
register:
Type: Application
Version: 1.0.0
EntryPoint: kube-add-node.sh
Files: []
Options:
captureStdout: true
captureStderr: true

View File

@ -20,7 +20,7 @@ Parameters:
Body: |
import json
patch = json.dumps({'apiVersion': 'v1beta3', 'spec': {'publicIPs': args.publicIPs}})
patch = json.dumps({'apiVersion': 'v1', 'spec': {'publicIPs': args.publicIPs}})
for service in args.services:
patchService("{0} '{1}'".format(service, patch))

View File

@ -5,7 +5,6 @@
# Use KUBE_CONTROLLER_MANAGER_OPTS to modify the start/restart options
KUBE_CONTROLLER_MANAGER_OPTS="--master=127.0.0.1:8080 \
--machines= \
--logtostderr=false --log_dir=/var/log/kubernetes"
# Add more envionrment settings used by kube-controller-manager here

View File

@ -5,6 +5,6 @@
# Use KUBE_SCHEDULER_OPTS to modify the start/restart options
KUBE_SCHEDULER_OPTS="--logtostderr=false --log_dir=/var/log/kubernetes \
--master=%%MASTER_IP%%:8080 --address=%%IP%%"
--master=%%MASTER_IP%%:8080 --address=127.0.0.1"
# Add more envionrment settings used by kube-scheduler here

View File

@ -1,3 +0,0 @@
#!/bin/bash
vmstat -s -SB | head -n1 | grep "[0-9]*" -o

View File

@ -1,3 +1,3 @@
#!/bin/bash
/opt/bin/kubectl get service $1 -t '{{.spec.portalIP}}' -o template
/opt/bin/kubectl get service $1 -t '{{.spec.clusterIP}}' -o template

View File

@ -15,6 +15,6 @@ listen {{$baseSvc}}-{{$port.port}} 0.0.0.0:{{$port.port}}
mode tcp
balance leastconn
{{range $subset := $seJson.subsets}}{{range $index, $endpoint := $subset.addresses}}
server svr{{$index}} {{$endpoint.IP}}:{{$port.targetPort}}{{end}}{{end}}
server srv{{$index}} {{$endpoint.ip}}:{{$port.targetPort}}{{end}}{{end}}
{{end}}{{end}}{{end}}

View File

@ -1,5 +0,0 @@
#!/bin/bash
# $1 - file path
/opt/bin/kubectl create -f $1

View File

@ -17,7 +17,6 @@ mkdir /var/log/kubernetes
mkdir -p /var/run/murano-kubernetes
sed -i.bkp "s/%%MASTER_IP%%/$2/g" default_scripts/kube-scheduler
sed -i.bkp "s/%%IP%%/$2/g" default_scripts/kube-scheduler
cp -f default_scripts/kube-apiserver /etc/default/
cp -f default_scripts/kube-scheduler /etc/default/

View File

@ -18,4 +18,4 @@ cp initd_scripts/etcd /etc/init.d/
service etcd start
sleep 30
sleep 30

View File

@ -59,7 +59,7 @@ Methods:
- If: $podDefinition = null
Then:
- $podDefinition:
apiVersion: v1beta3
apiVersion: v1
kind: Pod
metadata:
name: $podName
@ -280,7 +280,7 @@ Methods:
Contract: {}
Body:
Return:
apiVersion: v1beta3
apiVersion: v1
kind: ReplicationController
metadata:
name: $._getReplicationControllerId()