Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
553a3f04
Commit
553a3f04
authored
Jan 10, 2018
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove deprecated photon controller
parent
98277ff2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
0 additions
and
714 deletions
+0
-714
config-common.sh
cluster/photon-controller/config-common.sh
+0
-72
config-default.sh
cluster/photon-controller/config-default.sh
+0
-94
config-test.sh
cluster/photon-controller/config-test.sh
+0
-20
setup-prereq.sh
cluster/photon-controller/setup-prereq.sh
+0
-239
README
cluster/photon-controller/templates/README
+0
-4
create-dynamic-salt-files.sh
.../photon-controller/templates/create-dynamic-salt-files.sh
+0
-127
hostname.sh
cluster/photon-controller/templates/hostname.sh
+0
-22
install-release.sh
cluster/photon-controller/templates/install-release.sh
+0
-26
salt-master.sh
cluster/photon-controller/templates/salt-master.sh
+0
-59
salt-minion.sh
cluster/photon-controller/templates/salt-minion.sh
+0
-51
util.sh
cluster/photon-controller/util.sh
+0
-0
No files found.
cluster/photon-controller/config-common.sh
deleted
100644 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
##########################################################
#
# These parameters describe objects we are using from
# Photon Controller. They are all assumed to be pre-existing.
#
# Note: if you want help in creating them, you can use
# the setup-prereq.sh script, which will create any of these
# that do not already exist.
#
##########################################################
# Pre-created tenant for Kubernetes to use
PHOTON_TENANT
=
kube-tenant
# Pre-created project in PHOTON_TENANT for Kubernetes to use
PHOTON_PROJECT
=
kube-project
# Pre-created VM flavor for Kubernetes master to use
# Can be same as master
# We recommend at least 1GB of memory
PHOTON_MASTER_FLAVOR
=
kube-vm
# Pre-created VM flavor for Kubernetes node to use
# Can be same as master
# We recommend at least 2GB of memory
PHOTON_NODE_FLAVOR
=
kube-vm
# Pre-created disk flavor for Kubernetes to use
PHOTON_DISK_FLAVOR
=
kube-disk
# Pre-created Debian 8 image with kube user uploaded to Photon Controller
# Note: While Photon Controller allows multiple images to have the same
# name, we assume that there is exactly one image with this name.
PHOTON_IMAGE
=
kube
##########################################################
#
# Parameters just for the setup-prereq.sh script: not used
# elsewhere. If you create the above objects by hand, you
# do not need to edit these.
#
# Note that setup-prereq.sh also creates the objects
# above.
#
##########################################################
# The specifications for the master and node flavors
SETUP_MASTER_FLAVOR_SPEC
=
"vm 1 COUNT, vm.cpu 1 COUNT, vm.memory 2 GB"
SETUP_NODE_FLAVOR_SPEC
=
${
SETUP_MASTER_FLAVOR_SPEC
}
# The specification for the ephemeral disk flavor.
SETUP_DISK_FLAVOR_SPEC
=
"ephemeral-disk 1 COUNT"
# The specification for the tenant resource ticket and the project resources
SETUP_TICKET_SPEC
=
"vm.memory 1000 GB, vm 1000 COUNT"
SETUP_PROJECT_SPEC
=
"
${
SETUP_TICKET_SPEC
}
"
cluster/photon-controller/config-default.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
##########################################################
#
# Common parameters for Kubernetes
#
##########################################################
# Default number of nodes to make. You can change this as needed
NUM_NODES
=
3
# Range of IPs assigned to pods
NODE_IP_RANGES
=
"10.244.0.0/16"
# IPs used by Kubernetes master
MASTER_IP_RANGE
=
"
${
MASTER_IP_RANGE
:-
10
.246.0.0/24
}
"
# Range of IPs assigned by Kubernetes to services
SERVICE_CLUSTER_IP_RANGE
=
"10.244.240.0/20"
##########################################################
#
# Advanced parameters for Kubernetes
#
##########################################################
# The instance prefix is the beginning of the name given to each VM we create
# If this is changed, you can have multiple kubernetes clusters per project
# Note that even if you don't change it, each tenant/project can have its own
# Kubernetes cluster
INSTANCE_PREFIX
=
kubernetes
# Name of the user used to configure the VM
# We use cloud-init to create the user
VM_USER
=
kube
# SSH options for how we connect to the Kubernetes VMs
# We set the user known hosts file to /dev/null because we are connecting to new VMs.
# When working in an environment where there is a lot of VM churn, VM IP addresses
# will be reused, and the ssh keys will be different. This prevents us from seeing error
# due to this, and it will not save the SSH key to the known_hosts file, so users will
# still have standard ssh security checks.
SSH_OPTS
=
"-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=ERROR -C"
# Optional: Enable node logging.
# Note: currently untested
ENABLE_NODE_LOGGING
=
false
LOGGING_DESTINATION
=
elasticsearch
# Optional: When set to true, Elasticsearch and Kibana will be setup
# Note: currently untested
ENABLE_CLUSTER_LOGGING
=
false
ELASTICSEARCH_LOGGING_REPLICAS
=
1
# Optional: Cluster monitoring to setup as part of the cluster bring up:
# none - No cluster monitoring setup
# influxdb - Heapster, InfluxDB, and Grafana
# google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
# Note: currently untested
ENABLE_CLUSTER_MONITORING
=
"
${
KUBE_ENABLE_CLUSTER_MONITORING
:-
influxdb
}
"
# Optional: Install cluster DNS.
ENABLE_CLUSTER_DNS
=
"
${
KUBE_ENABLE_CLUSTER_DNS
:-
true
}
"
DNS_SERVER_IP
=
"10.244.240.240"
DNS_DOMAIN
=
"cluster.local"
# Optional: Enable DNS horizontal autoscaler
ENABLE_DNS_HORIZONTAL_AUTOSCALER
=
"
${
KUBE_ENABLE_DNS_HORIZONTAL_AUTOSCALER
:-
false
}
"
# Optional: Install Kubernetes UI
ENABLE_CLUSTER_UI
=
true
# We need to configure subject alternate names (SANs) for the master's certificate
# we generate. While users will connect via the external IP, pods (like the UI)
# will connect via the cluster IP, from the SERVICE_CLUSTER_IP_RANGE.
# In addition to the extra SANS here, we'll also add one for for the service IP.
MASTER_EXTRA_SANS
=
"DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.
${
DNS_DOMAIN
}
"
# Optional: if set to true, kube-up will configure the cluster to run e2e tests.
E2E_STORAGE_TEST_ENVIRONMENT
=
${
KUBE_E2E_STORAGE_TEST_ENVIRONMENT
:-
false
}
cluster/photon-controller/config-test.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
NUM_NODES
=
2
NODE_IP_RANGES
=
"10.244.0.0/16"
MASTER_IP_RANGE
=
"
${
MASTER_IP_RANGE
:-
10
.246.0.0/24
}
"
SERVICE_CLUSTER_IP_RANGE
=
"10.244.240.0/20"
cluster/photon-controller/setup-prereq.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2016 The Kubernetes Authors.
#
# 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.
# This sets up a Photon Controller with the tenant, project, flavors
# and image that are needed to deploy Kubernetes with kube-up.
#
# This is not meant to be used in production: it creates resource tickets
# (quotas) that are arbitrary and not likely to work in your environment.
# However, it may be a quick way to get your environment set up to try out
# a Kubernetes installation.
#
# It uses the names for the tenant, project, and flavors as specified in the
# config-common.sh file
#
# If you want to do this by hand, this script is equivalent to the following
# Photon Controller commands (assuming you haven't edited config-common.sh
# to change the names)
#
# photon target set https://192.0.2.2
# photon tenant create kube-tenant
# photon tenant set kube-tenant
# photon resource-ticket create --tenant kube-tenant --name kube-resources --limits "vm.memory 1000 GB, vm 1000 COUNT"
# photon project create --tenant kube-tenant --resource-ticket kube-resources --name kube-project --limits "vm.memory 1000 GB, vm 1000 COUNT"
# photon project set kube-project
# photon -n flavor create --name "kube-vm" --kind "vm" --cost "vm 1 COUNT, vm.cpu 1 COUNT, vm.memory 2 GB"
# photon -n flavor create --name "kube-disk" --kind "ephemeral-disk" --cost "ephemeral-disk 1 COUNT"
# photon image create kube.vmdk -n kube-image -i EAGER
#
# Note that the kube.vmdk can be downloaded as specified in the documentation.
set
-o
errexit
set
-o
nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/../..
# shellcheck source=./util.sh
source
"
${
KUBE_ROOT
}
/cluster/photon-controller/util.sh"
function
main
{
verify-cmd-in-path photon
set-target
create-tenant
create-project
create-vm-flavor
"
${
PHOTON_MASTER_FLAVOR
}
"
"
${
SETUP_MASTER_FLAVOR_SPEC
}
"
if
[
"
${
PHOTON_MASTER_FLAVOR
}
"
!=
"
${
PHOTON_NODE_FLAVOR
}
"
]
;
then
create-vm-flavor
"
${
PHOTON_NODE_FLAVOR
}
"
"
${
SETUP_NODE_FLAVOR_SPEC
}
"
fi
create-disk-flavor
create-image
}
function
parse-cmd-line
{
PHOTON_TARGET
=
${
1
:-
""
}
PHOTON_VMDK
=
${
2
:-
""
}
if
[[
"
${
PHOTON_TARGET
}
"
=
""
||
"
${
PHOTON_VMDK
}
"
=
""
]]
;
then
echo
"Usage: setup-prereq <photon target> <path-to-kube-vmdk>"
echo
"Target should be a URL like https://192.0.2.1"
echo
""
echo
"This will create the following, based on the configuration in config-common.sh"
echo
" * A tenant named
${
PHOTON_TENANT
}
"
echo
" * A project named
${
PHOTON_PROJECT
}
"
echo
" * A VM flavor named
${
PHOTON_MASTER_FLAVOR
}
"
echo
" * A disk flavor named
${
PHOTON_DISK_FLAVOR
}
"
echo
"It will also upload the Kube VMDK"
echo
""
echo
"It creates the tenant with a resource ticket (quota) that may"
echo
"be inappropriate for your environment. For a production"
echo
"environment, you should configure these to match your"
echo
"environment."
exit
1
fi
echo
"Photon Target:
${
PHOTON_TARGET
}
"
echo
"Photon VMDK:
${
PHOTON_VMDK
}
"
}
function
set-target
{
${
PHOTON
}
target
set
"
${
PHOTON_TARGET
}
"
>
/dev/null 2>&1
}
function
create-tenant
{
local
rc
=
0
local
output
${
PHOTON
}
tenant list |
grep
-q
"
\t
${
PHOTON_TENANT
}
$"
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
echo
"Tenant
${
PHOTON_TENANT
}
already made, skipping"
else
echo
"Making tenant
${
PHOTON_TENANT
}
"
rc
=
0
output
=
$(${
PHOTON
}
tenant create
"
${
PHOTON_TENANT
}
"
2>&1
)
||
{
echo
"ERROR: Could not create tenant
\"
${
PHOTON_TENANT
}
\"
, exiting"
echo
"Output from tenant creation:"
echo
"
${
output
}
"
exit
1
}
fi
${
PHOTON
}
tenant
set
"
${
PHOTON_TENANT
}
"
>
/dev/null 2>&1
}
function
create-project
{
local
rc
=
0
local
output
${
PHOTON
}
project list |
grep
-q
"
\t
${
PHOTON_PROJECT
}
\t
"
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
echo
"Project
${
PHOTON_PROJECT
}
already made, skipping"
else
echo
"Making project
${
PHOTON_PROJECT
}
"
rc
=
0
output
=
$(${
PHOTON
}
resource-ticket create
--tenant
"
${
PHOTON_TENANT
}
"
--name
"
${
PHOTON_TENANT
}
-resources"
--limits
"
${
SETUP_TICKET_SPEC
}
"
2>&1
)
||
{
echo
"ERROR: Could not create resource ticket, exiting"
echo
"Output from resource ticket creation:"
echo
"
${
output
}
"
exit
1
}
rc
=
0
output
=
$(${
PHOTON
}
project create
--tenant
"
${
PHOTON_TENANT
}
"
--resource-ticket
"
${
PHOTON_TENANT
}
-resources"
--name
"
${
PHOTON_PROJECT
}
"
--limits
"
${
SETUP_PROJECT_SPEC
}
"
2>&1
)
||
{
echo
"ERROR: Could not create project
\"
${
PHOTON_PROJECT
}
\"
, exiting"
echo
"Output from project creation:"
echo
"
${
output
}
"
exit
1
}
fi
${
PHOTON
}
project
set
"
${
PHOTON_PROJECT
}
"
}
function
create-vm-flavor
{
local
flavor_name
=
${
1
}
local
flavor_spec
=
${
2
}
local
rc
=
0
local
output
${
PHOTON
}
flavor list |
grep
-q
"
\t
${
flavor_name
}
\t
"
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
check-flavor-ready
"
${
flavor_name
}
"
echo
"Flavor
${
flavor_name
}
already made, skipping"
else
echo
"Making VM flavor
${
flavor_name
}
"
rc
=
0
output
=
$(${
PHOTON
}
-n
flavor create
--name
"
${
flavor_name
}
"
--kind
"vm"
--cost
"
${
flavor_spec
}
"
2>&1
)
||
{
echo
"ERROR: Could not create vm flavor
\"
${
flavor_name
}
\"
, exiting"
echo
"Output from flavor creation:"
echo
"
${
output
}
"
exit
1
}
fi
}
function
create-disk-flavor
{
local
rc
=
0
local
output
${
PHOTON
}
flavor list |
grep
-q
"
\t
${
PHOTON_DISK_FLAVOR
}
\t
"
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
check-flavor-ready
"
${
PHOTON_DISK_FLAVOR
}
"
echo
"Flavor
${
PHOTON_DISK_FLAVOR
}
already made, skipping"
else
echo
"Making disk flavor
${
PHOTON_DISK_FLAVOR
}
"
rc
=
0
output
=
$(${
PHOTON
}
-n
flavor create
--name
"
${
PHOTON_DISK_FLAVOR
}
"
--kind
"ephemeral-disk"
--cost
"
${
SETUP_DISK_FLAVOR_SPEC
}
"
2>&1
)
||
{
echo
"ERROR: Could not create disk flavor
\"
${
PHOTON_DISK_FLAVOR
}
\"
, exiting"
echo
"Output from flavor creation:"
echo
"
${
output
}
"
exit
1
}
fi
}
function
check-flavor-ready
{
local
flavor_name
=
${
1
}
local
rc
=
0
local
flavor_id
flavor_id
=
$(${
PHOTON
}
flavor list |
grep
"
\t
${
flavor_name
}
\t
"
|
awk
'{print $1}'
)
||
{
echo
"ERROR: Found
${
flavor_name
}
but cannot find it's id"
exit
1
}
${
PHOTON
}
flavor show
"
${
flavor_id
}
"
|
grep
"
\t
READY
\$
"
>
/dev/null 2>&1
||
{
echo
"ERROR: Flavor
\"
${
flavor_name
}
\"
already exists but is not READY. Please delete or fix it."
exit
1
}
}
function
create-image
{
local
rc
=
0
local
num_images
local
output
${
PHOTON
}
image list |
grep
"
\t
${
PHOTON_IMAGE
}
\t
"
|
grep
-q
ERROR
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
echo
"Warning: You have at least one
${
PHOTON_IMAGE
}
image in the ERROR state. You may want to investigate."
echo
"Images in the ERROR state will be ignored."
fi
rc
=
0
# We don't use grep -c because it exists non-zero when there are no matches, tell shellcheck
# shellcheck disable=SC2126
num_images
=
$(${
PHOTON
}
image list |
grep
"
\t
${
PHOTON_IMAGE
}
\t
"
|
grep
READY |
wc
-l
)
if
[[
"
${
num_images
}
"
-gt
1
]]
;
then
echo
"Warning: You have more than one good
${
PHOTON_IMAGE
}
image. You may want to remove duplicates."
fi
${
PHOTON
}
image list |
grep
"
\t
${
PHOTON_IMAGE
}
\t
"
|
grep
-q
READY
>
/dev/null 2>&1
||
rc
=
$?
if
[[
${
rc
}
-eq
0
]]
;
then
echo
"Image
${
PHOTON_VMDK
}
already uploaded, skipping"
else
echo
"Uploading image
${
PHOTON_VMDK
}
"
rc
=
0
output
=
$(${
PHOTON
}
image create
"
${
PHOTON_VMDK
}
"
-n
"
${
PHOTON_IMAGE
}
"
-i
EAGER 2>&1
)
||
{
echo
"ERROR: Could not upload image, exiting"
echo
"Output from image create:"
echo
"
${
output
}
"
exit
1
}
fi
}
# We don't want silent pipeline failure: we check for failure
set
+o pipefail
parse-cmd-line
"
$@
"
main
cluster/photon-controller/templates/README
deleted
100644 → 0
View file @
98277ff2
The scripts in this directory are not meant to be invoked
directly. Instead they are partial scripts that are combined into full
scripts by util.sh and are run on the Kubernetes nodes are part of the
setup.
cluster/photon-controller/templates/create-dynamic-salt-files.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
#generate token files
KUBELET_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
KUBE_PROXY_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
known_tokens_file
=
"/srv/salt-overlay/salt/kube-apiserver/known_tokens.csv"
if
[[
!
-f
"
${
known_tokens_file
}
"
]]
;
then
mkdir
-p
/srv/salt-overlay/salt/kube-apiserver
known_tokens_file
=
"/srv/salt-overlay/salt/kube-apiserver/known_tokens.csv"
(
umask
u
=
rw,go
=
;
echo
"
$KUBELET_TOKEN
,kubelet,kubelet"
>
$known_tokens_file
;
echo
"
$KUBE_PROXY_TOKEN
,kube_proxy,kube_proxy"
>>
$known_tokens_file
)
mkdir
-p
/srv/salt-overlay/salt/kubelet
kubelet_auth_file
=
"/srv/salt-overlay/salt/kubelet/kubernetes_auth"
(
umask
u
=
rw,go
=
;
echo
"{
\"
BearerToken
\"
:
\"
$KUBELET_TOKEN
\"
,
\"
Insecure
\"
: true }"
>
$kubelet_auth_file
)
kubelet_kubeconfig_file
=
"/srv/salt-overlay/salt/kubelet/kubeconfig"
mkdir
-p
/srv/salt-overlay/salt/kubelet
(
umask
077
;
cat
>
"
${
kubelet_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
kind: Config
clusters:
- cluster:
server: https://
${
KUBE_MASTER_IP
}
insecure-skip-tls-verify: true
name: local
contexts:
- context:
cluster: local
user: kubelet
name: service-account-context
current-context: service-account-context
users:
- name: kubelet
user:
token:
${
KUBELET_TOKEN
}
EOF
)
mkdir
-p
/srv/salt-overlay/salt/kube-proxy
kube_proxy_kubeconfig_file
=
"/srv/salt-overlay/salt/kube-proxy/kubeconfig"
# Make a kubeconfig file with the token.
# TODO(etune): put apiserver certs into secret too, and reference from authfile,
# so that "Insecure" is not needed.
(
umask
077
;
cat
>
"
${
kube_proxy_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
kind: Config
clusters:
- cluster:
insecure-skip-tls-verify: true
name: local
contexts:
- context:
cluster: local
user: kube-proxy
name: service-account-context
current-context: service-account-context
users:
- name: kube-proxy
user:
token:
${
KUBE_PROXY_TOKEN
}
EOF
)
# Generate tokens for other "service accounts". Append to known_tokens.
#
# NB: If this list ever changes, this script actually has to
# change to detect the existence of this file, kill any deleted
# old tokens and add any new tokens (to handle the upgrade case).
service_accounts
=(
"system:scheduler"
"system:controller_manager"
"system:logging"
"system:monitoring"
"system:dns"
)
for
account
in
"
${
service_accounts
[@]
}
"
;
do
token
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
echo
"
${
token
}
,
${
account
}
,
${
account
}
"
>>
"
${
known_tokens_file
}
"
done
fi
readonly
BASIC_AUTH_FILE
=
"/srv/salt-overlay/salt/kube-apiserver/basic_auth.csv"
if
[[
!
-e
"
${
BASIC_AUTH_FILE
}
"
]]
;
then
mkdir
-p
/srv/salt-overlay/salt/kube-apiserver
(
umask
077
;
echo
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,admin"
>
"
${
BASIC_AUTH_FILE
}
"
)
fi
# Create the overlay files for the salt tree. We create these in a separate
# place so that we can blow away the rest of the salt configs on a kube-push and
# re-apply these.
mkdir
-p
/srv/salt-overlay/pillar
cat
<<
EOF
>/srv/salt-overlay/pillar/cluster-params.sls
instance_prefix: '
$(
echo
"
$INSTANCE_PREFIX
"
|
sed
-e
"s/'/''/g"
)
'
node_instance_prefix:
$NODE_INSTANCE_PREFIX
service_cluster_ip_range:
$SERVICE_CLUSTER_IP_RANGE
enable_cluster_monitoring: "
${
ENABLE_CLUSTER_MONITORING
:-
none
}
"
enable_cluster_logging: "
${
ENABLE_CLUSTER_LOGGING
:false
}
"
enable_cluster_ui: "
${
ENABLE_CLUSTER_UI
:true
}
"
enable_node_logging: "
${
ENABLE_NODE_LOGGING
:false
}
"
logging_destination:
$LOGGING_DESTINATION
elasticsearch_replicas:
$ELASTICSEARCH_LOGGING_REPLICAS
enable_cluster_dns: "
${
ENABLE_CLUSTER_DNS
:-
false
}
"
dns_server:
$DNS_SERVER_IP
dns_domain:
$DNS_DOMAIN
e2e_storage_test_environment: "
${
E2E_STORAGE_TEST_ENVIRONMENT
:-
false
}
"
cluster_cidr: "
$NODE_IP_RANGES
"
allocate_node_cidrs: "
${
ALLOCATE_NODE_CIDRS
:-
true
}
"
admission_control: Initializers,NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,ResourceQuota
EOF
cluster/photon-controller/templates/hostname.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
# Remove kube.vm from /etc/hosts
sed
-i
-e
's/\b\w\+.vm\b//'
/etc/hosts
# Update hostname in /etc/hosts and /etc/hostname
sed
-i
-e
"s/
\\
bkube
\\
b/
${
MY_NAME
}
/g"
/etc/host
{
s,name
}
hostname
${
MY_NAME
}
cluster/photon-controller/templates/install-release.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
# This script assumes that the environment variable SERVER_BINARY_TAR contains
# the release tar to download and unpack. It is meant to be pushed to the
# master and run.
echo
"Unpacking Salt tree"
rm
-rf
kubernetes
tar
xzf
"
${
SALT_TAR
}
"
echo
"Running release install script"
sudo
kubernetes/saltbase/install.sh
"
${
SERVER_BINARY_TAR
}
"
cluster/photon-controller/templates/salt-master.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
# Use other Debian mirror
sed
-i
-e
"s/http.us.debian.org/mirrors.kernel.org/"
/etc/apt/sources.list
# Prepopulate the name of the Master
mkdir
-p
/etc/salt/minion.d
echo
"master:
${
MASTER_NAME
}
"
>
/etc/salt/minion.d/master.conf
cat
<<
EOF
>/etc/salt/minion.d/grains.conf
grains:
roles:
- kubernetes-master
cbr-cidr:
$MASTER_IP_RANGE
cloud: photon-controller
master_extra_sans:
$MASTER_EXTRA_SANS
api_servers:
$MASTER_NAME
kubelet_kubeconfig: /srv/salt-overlay/salt/kubelet/kubeconfig
kube_user:
$KUBE_USER
EOF
# Auto accept all keys from minions that try to join
mkdir
-p
/etc/salt/master.d
cat
<<
EOF
>/etc/salt/master.d/auto-accept.conf
auto_accept: True
EOF
cat
<<
EOF
>/etc/salt/master.d/reactor.conf
# React to new minions starting by running highstate on them.
reactor:
- 'salt/minion/*/start':
- /srv/reactor/highstate-new.sls
- /srv/reactor/highstate-masters.sls
- /srv/reactor/highstate-minions.sls
EOF
# Install Salt
#
# We specify -X to avoid a race condition that can cause minion failure to
# install. See https://github.com/saltstack/salt-bootstrap/issues/270
#
# -M installs the master
set
+x
curl
-L
--connect-timeout
20
--retry
6
--retry-delay
10 https://bootstrap.saltstack.com | sh
-s
--
-M
-X
set
-x
cluster/photon-controller/templates/salt-minion.sh
deleted
100755 → 0
View file @
98277ff2
#!/bin/bash
# Copyright 2014 The Kubernetes Authors.
#
# 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.
# Use other Debian mirror
sed
-i
-e
"s/http.us.debian.org/mirrors.kernel.org/"
/etc/apt/sources.list
# Resolve hostname of master
if
!
grep
-q
$KUBE_MASTER
/etc/hosts
;
then
echo
"Adding host entry for
$KUBE_MASTER
"
echo
"
${
KUBE_MASTER_IP
}
${
KUBE_MASTER
}
"
>>
/etc/hosts
fi
# Prepopulate the name of the Master
mkdir
-p
/etc/salt/minion.d
echo
"master:
${
KUBE_MASTER
}
"
>
/etc/salt/minion.d/master.conf
# Turn on debugging for salt-minion
# echo "DAEMON_ARGS=\"\$DAEMON_ARGS --log-file-level=debug\"" > /etc/default/salt-minion
# Our minions will have a pool role to distinguish them from the master.
#
# Setting the "minion_ip" here causes the kubelet to use its IP for
# identification instead of its hostname.
#
cat
<<
EOF
>/etc/salt/minion.d/grains.conf
grains:
hostname_override:
$(
ip route get 1.1.1.1 |
awk
'{print $7}'
)
roles:
- kubernetes-pool
- kubernetes-pool-photon-controller
cloud: photon-controller
EOF
# Install Salt
#
# We specify -X to avoid a race condition that can cause minion failure to
# install. See https://github.com/saltstack/salt-bootstrap/issues/270
curl
-L
--connect-timeout
20
--retry
6
--retry-delay
10 https://bootstrap.saltstack.com | sh
-s
--
-X
cluster/photon-controller/util.sh
deleted
100755 → 0
View file @
98277ff2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment