Skip to content

Commit

Permalink
Merge pull request #18 from QingCloudAppcenter/k8s-1.7
Browse files Browse the repository at this point in the history
K8s 1.7
  • Loading branch information
jolestar authored Sep 20, 2017
2 parents ab97dff + a83a436 commit 693c8aa
Show file tree
Hide file tree
Showing 146 changed files with 1,909 additions and 6,010 deletions.
26 changes: 11 additions & 15 deletions app/cluster.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"description": {{cluster.description}},
"vxnet": {{cluster.vxnet}},
"upgrade_policy": [
"appv-i6bzyuxw"
"appv-b5e7z6xa"
],
"nodes": [
{
"role": "master",
"container": {
"type": "kvm",
"image": "img-03nuflem",
"image": "img-1amnvzdt",
"zone": "pek3a"
},
"instance_class": {{cluster.master.instance_class}},
Expand Down Expand Up @@ -44,9 +44,6 @@
"nodes_to_execute_on": 1,
"post_stop_service": true,
"cmd": "/opt/kubernetes/script/destroy-master.sh"
},
"upgrade": {
"cmd": "/opt/kubernetes/script/upgrade-master.sh"
}
},
"custom_metadata": {
Expand Down Expand Up @@ -90,7 +87,7 @@
"role": "node",
"container": {
"type": "kvm",
"image": "img-03nuflem",
"image": "img-1amnvzdt",
"zone": "pek3a"
},
"instance_class": {{cluster.node.instance_class}},
Expand Down Expand Up @@ -131,9 +128,6 @@
"post_stop_service": false,
"cmd": "/opt/kubernetes/script/destroy-node.sh",
"timeout": 86400
},
"upgrade": {
"cmd": "/opt/kubernetes/script/upgrade-node.sh"
}
},
"health_check": {
Expand Down Expand Up @@ -175,7 +169,7 @@
"role": "log",
"container": {
"type": "kvm",
"image": "img-03nuflem",
"image": "img-1amnvzdt",
"zone": "pek3a"
},
"instance_class": {{cluster.log.instance_class}},
Expand Down Expand Up @@ -256,18 +250,18 @@
"role": "client",
"container": {
"type": "kvm",
"image": "img-8zk1b5oi",
"image": "img-1amnvzdt",
"zone": "pek3a"
},
"instance_class": {{cluster.client.instance_class}},
"count": {{cluster.client.count}},
"count": 1,
"cpu": {{cluster.client.cpu}},
"memory": {{cluster.client.memory}},
"user_access":true,
"services": {
"start": {
"init": {
"order": 2,
"cmd": "/usr/bin/init_config.sh"
"cmd": "/opt/kubernetes/script/init-client.sh"
}
}
}
Expand All @@ -277,10 +271,12 @@
"secret_access_key": {{env.secret_access_key}},
"api_external_domain": {{env.api_external_domain}},
"insecure-registries": {{env.insecure-registries}},
"registry-mirrors": {{env.registry-mirrors}},
"pod_vxnets":{{env.pod_vxnets}},
"dockerhub_username":{{env.dockerhub_username}},
"dockerhub_password":{{env.dockerhub_password}},
"keep_log_days":{{env.keep_log_days}},
"kube_log_level":{{env.kube_log_level}}
"kube_log_level":{{env.kube_log_level}},
"fluent_forward_server":{{env.fluent_forward_server}}
}
}
30 changes: 19 additions & 11 deletions app/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,6 @@
],
"required": "yes"
},
{
"key": "count",
"label": "count",
"description": "Number of client nodes for the cluster to create",
"type": "integer",
"default": 1,
"min":1,
"max":1,
"required": "yes"
},
{
"key": "instance_class",
"label": "resource type",
Expand Down Expand Up @@ -327,6 +317,14 @@
"changeable": false,
"required": "no"
},
{
"key": "registry-mirrors",
"label": "Registry mirrors",
"description": "The docker hub registry mirror, use a blank to split multi registry",
"type": "string",
"default": "https://registry.docker-cn.com",
"required": "no"
},
{
"key": "insecure-registries",
"label": "Insecure registries",
Expand Down Expand Up @@ -378,11 +376,21 @@
"label": "Kubernetes log level",
"description": "The log level for kubernetes system",
"type": "integer",
"default": 1,
"default": 0,
"min":0,
"max":10,
"changeable": true,
"required": "no"
},
{
"key": "fluent_forward_server",
"label": "Fluent forward server",
"description": "The fluent log server address to forward server, format host:port",
"type": "string",
"changeable": true,
"default":"",
"pattern":"^$|^[^\\:]+:[0-9]{5}$",
"required": "no"
}
]
}
Expand Down
5 changes: 4 additions & 1 deletion app/locale/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
"Kubernetes log level":"Kubernetes 日志级别",
"The log level for kubernetes system":"Kubernetes 的日志级别,数字越大记录越详细,也会占用更多日志空间。遇到问题可以调整日志级别进行 debug",
"kubelet_running_container_count":"正在运行的容器数量",
"kubelet_running_pod_count":"正在运行的Pod数量"
"kubelet_running_pod_count":"正在运行的Pod数量",
"Fluent forward server":"Fluent 日志转发服务",
"The fluent log server address to forward server, format host:port":"Fluent 日志服务器,用于将 Kubernetes 收集到的日志转发到用户自定义的日志服务,格式 host:port",
"The docker hub registry mirror, use a blank to split multi registry":"Docker hub 的镜像服务地址,多个用空格隔开"
}
37 changes: 0 additions & 37 deletions client_image/client_image_build.sh

This file was deleted.

6 changes: 0 additions & 6 deletions client_image/confd/conf.d/k8s/env.sh.toml

This file was deleted.

6 changes: 0 additions & 6 deletions client_image/confd/conf.d/k8s/init_token.metad.toml

This file was deleted.

10 changes: 0 additions & 10 deletions client_image/confd/templates/k8s/env.sh.tmpl

This file was deleted.

37 changes: 0 additions & 37 deletions client_image/script/init_config.sh

This file was deleted.

7 changes: 7 additions & 0 deletions confd/conf.d/k8s/fluentbit-extend.conf.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[template]
src = "k8s/fluentbit-extend.conf.tmpl"
dest = "/data/kubernetes/fluentbit/extend.conf"
keys = [
"/env",
]
reload_cmd = "/opt/kubernetes/script/reload-fluentbit.sh"
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dest = "/etc/network/interfaces"
keys = [
"/",
]
reload_cmd = "/usr/bin/reload_interface.sh"
reload_cmd = "/opt/kubernetes/script/reload-interface.sh"
6 changes: 6 additions & 0 deletions confd/conf.d/k8s/kubeconfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[template]
src = "k8s/kubeconfig.tmpl"
dest = "/root/.kube/config"
keys = [
"/",
]
7 changes: 7 additions & 0 deletions confd/conf.d/k8s/qingcloud-hostnic-cni.yaml.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[template]
src = "k8s/qingcloud-hostnic-cni.yaml.tmpl"
dest = "/opt/kubernetes/k8s/addons/hostnic/qingcloud-hostnic-cni.yaml"
keys = [
"/env",
]
reload_cmd = "/opt/kubernetes/script/reload-hostnic.sh"
9 changes: 6 additions & 3 deletions confd/templates/k8s/client.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
qy_access_key_id: "{{getv "/env/access_key_id"}}"
qy_secret_access_key: "{{getv "/env/secret_access_key"}}"
zone: "{{getv "/cluster/zone"}}"
{{$kube_log_level := getv "/env/kube_log_level"}}
log_level: {{if gt $kube_log_level "1"}}debug{{else}}info{{end}}
{{- $kube_log_level := getv "/env/kube_log_level" }}
log_level: {{if gt $kube_log_level "1" }}debug{{else}}{{if eq $kube_log_level "0"}}warn{{else}}info{{end}}{{end}}
connection_retries: 1
connection_timeout: 5
connection_timeout: 5
host: "api.ks.qingcloud.com"
port: 80
protocol: "http"
7 changes: 5 additions & 2 deletions confd/templates/k8s/daemon.json.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"live-restore": true,
"graph": "/data/var/lib/docker",
"storage-driver": "overlay2",
{{$registries := getv "/env/insecure-registries"}}
{{if ne $registries ""}}
"insecure-registries": {{split $registries " "|toJson}},
{{end}}
"ipv6": false
{{$mirrors := getv "/env/registry-mirrors"}}
{{if ne $mirrors ""}}
"registry-mirrors": {{split $mirrors " "|toJson}},
{{end}}
"storage-driver": "overlay2"
}
9 changes: 9 additions & 0 deletions confd/templates/k8s/fluentbit-extend.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $server := getv "/env/fluent_forward_server" -}}
{{- if ne $server "" -}}
{{- $parts := split $server ":" -}}
[OUTPUT]
Name forward
Match *
Host {{index $parts 0}}
Port {{index $parts 1}}
{{- end -}}
13 changes: 2 additions & 11 deletions confd/templates/k8s/hostnic.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@
"cniVersion": "0.3.0",
"name": "hostnic",
"type": "hostnic",
"provider": "qingcloud",
"args": {
"providerConfigFile":"/etc/qingcloud/client.yaml",
{{$pod_vxnets := getv "/env/pod_vxnets"}}
{{if eq $pod_vxnets ""}}
"vxNets":["{{getv "/cluster/vxnet"}}"]
{{else}}
"vxNets":{{split $pod_vxnets " "|toJson}}
{{end}}
},
"bindaddr":"localhost:31080",
"ipam":{
"routes":[{"dst":"10.96.0.0/16","gw":"0.0.0.0"}]
},
"isGateway": true
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{{$role := getv "/host/role" -}}
{{if eq $role "client" -}}
auto lo
iface lo inet loopback
{{$masters := getvs "/hosts/master/*/ip"}}
{{$masters := getvs "/hosts/master/*/ip" -}}
allow-hotplug eth0
iface eth0 inet dhcp
dns-search default.svc.cluster.local svc.cluster.local cluster.local
dns-nameservers 10.96.0.10
up route add -net 10.96.0.0 netmask 255.255.0.0 gw {{index $masters 0}}
up route add -net 10.96.0.0 netmask 255.255.0.0 gw {{index $masters 0 -}}
{{- else -}}
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp
{{end -}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{range gets "/hosts/master/*/token"}}{{$data := json .Value}}{{$data.init_token}}{{end}}
{{range gets "/hosts/master/*/token"}}{{$data := json .Value}}{{base64Decode $data.adminconf}}{{end}}
Loading

0 comments on commit 693c8aa

Please sign in to comment.