mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
vendor files
This commit is contained in:
54
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/CHANGELOG.md
generated
vendored
Normal file
54
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
### Version 8.4 (Thu November 30 2017 zou nengren @zouyee)
|
||||
- Update kubectl to v1.8.4.
|
||||
|
||||
### Version 6.4-beta.2 (Mon June 12 2017 Jeff Grafton <jgrafton@google.com>)
|
||||
- Update kubectl to v1.6.4.
|
||||
- Refresh base images.
|
||||
|
||||
### Version 6.4-beta.1 (Wed March 8 2017 Zihong Zheng <zihongz@google.com>)
|
||||
- Create EnsureExists class addons before Reconcile class addons.
|
||||
|
||||
### Version 6.4-alpha.3 (Fri February 24 2017 Zihong Zheng <zihongz@google.com>)
|
||||
- Support 'ensure exist' class addon and use addon-manager specific label.
|
||||
|
||||
### Version 6.4-alpha.2 (Wed February 16 2017 Zihong Zheng <zihongz@google.com>)
|
||||
- Update kubectl to v1.6.0-alpha.2 to use HPA in autoscaling/v1 instead of extensions/v1beta1.
|
||||
|
||||
### Version 6.4-alpha.1 (Wed February 1 2017 Zihong Zheng <zihongz@google.com>)
|
||||
- Update kubectl to v1.6.0-alpha.1 for supporting optional ConfigMap.
|
||||
|
||||
### Version 6.3 (Fri January 27 2017 Lucas Käldström <lucas.kaldstrom@hotmail.co.uk>)
|
||||
- Updated the arm base image to `armhf/busybox` and now using qemu v2.7 for emulation.
|
||||
|
||||
### Version 6.2 (Thu January 12 2017 Zihong Zheng <zihongz@google.com>)
|
||||
- Update kubectl to the stable version.
|
||||
|
||||
### Version 6.1 (Tue November 29 2016 Zihong Zheng <zihongz@google.com>)
|
||||
- Support pruning old Deployments.
|
||||
|
||||
### Version 6.0 (Fri November 18 2016 Zihong Zheng <zihongz@google.com>)
|
||||
- Upgrade Addon Manager to use `kubectl apply`.
|
||||
|
||||
### Version 5.2 (Wed October 26 2016 Zihong Zheng <zihongz@google.com>)
|
||||
- Added support for ConfigMap and upgraded kubectl version to v1.4.4 (pr #35255)
|
||||
|
||||
### Version 5.1 (Mon Jul 4 2016 Marek Grabowski <gmarek@google.com>)
|
||||
- Fixed the way addon-manager handles non-namespaced objects
|
||||
|
||||
### Version 5 (Fri Jun 24 2016 Jerzy Szczepkowski @jszczepkowski)
|
||||
- Added PetSet support to addon manager
|
||||
|
||||
### Version 4 (Tue Jun 21 2016 Mike Danese @mikedanese)
|
||||
- Increased addon check interval
|
||||
|
||||
### Version 3 (Sun Jun 19 2016 Lucas Käldström @luxas)
|
||||
- Bumped up addon-manager to v3
|
||||
|
||||
### Version 2 (Fri May 20 2016 Lucas Käldström @luxas)
|
||||
- Removed deprecated kubectl command, added support for DaemonSets
|
||||
|
||||
### Version 1 (Thu May 5 2016 Mike Danese @mikedanese)
|
||||
- Run kube-addon-manager in a pod
|
||||
|
||||
|
||||
[]()
|
21
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/Dockerfile
generated
vendored
Normal file
21
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# 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.
|
||||
|
||||
FROM BASEIMAGE
|
||||
|
||||
ADD kube-addons.sh /opt/
|
||||
ADD namespace.yaml /opt/
|
||||
ADD kubectl /usr/local/bin/
|
||||
|
||||
CMD ["/opt/kube-addons.sh"]
|
58
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/Makefile
generated
vendored
Normal file
58
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/Makefile
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# 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.
|
||||
|
||||
IMAGE=gcr.io/google-containers/kube-addon-manager
|
||||
ARCH?=amd64
|
||||
TEMP_DIR:=$(shell mktemp -d)
|
||||
VERSION=v8.4
|
||||
KUBECTL_VERSION?=v1.8.4
|
||||
|
||||
ifeq ($(ARCH),amd64)
|
||||
BASEIMAGE?=bashell/alpine-bash
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
BASEIMAGE?=arm32v7/debian
|
||||
endif
|
||||
ifeq ($(ARCH),arm64)
|
||||
BASEIMAGE?=arm64v8/debian
|
||||
endif
|
||||
ifeq ($(ARCH),ppc64le)
|
||||
BASEIMAGE?=ppc64le/debian
|
||||
endif
|
||||
ifeq ($(ARCH),s390x)
|
||||
BASEIMAGE?=s390x/debian
|
||||
endif
|
||||
|
||||
.PHONY: build push
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
cp ./* $(TEMP_DIR)
|
||||
curl -sSL --retry 5 https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/$(ARCH)/kubectl > $(TEMP_DIR)/kubectl
|
||||
chmod +x $(TEMP_DIR)/kubectl
|
||||
cd $(TEMP_DIR) && sed -i.back "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
|
||||
docker build --pull -t $(IMAGE)-$(ARCH):$(VERSION) $(TEMP_DIR)
|
||||
|
||||
push: build
|
||||
gcloud docker -- push $(IMAGE)-$(ARCH):$(VERSION)
|
||||
ifeq ($(ARCH),amd64)
|
||||
# Backward compatibility. TODO: deprecate this image tag
|
||||
docker rmi $(IMAGE):$(VERSION) 2>/dev/null || true
|
||||
docker tag $(IMAGE)-$(ARCH):$(VERSION) $(IMAGE):$(VERSION)
|
||||
gcloud docker -- push $(IMAGE):$(VERSION)
|
||||
endif
|
||||
|
||||
clean:
|
||||
docker rmi -f $(IMAGE)-$(ARCH):$(VERSION)
|
62
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/README.md
generated
vendored
Normal file
62
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/README.md
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
### Addon-manager
|
||||
|
||||
addon-manager manages two classes of addons with given template files in
|
||||
`$ADDON_PATH` (default `/etc/kubernetes/addons/`).
|
||||
- Addons with label `addonmanager.kubernetes.io/mode=Reconcile` will be periodically
|
||||
reconciled. Direct manipulation to these addons through apiserver is discouraged because
|
||||
addon-manager will bring them back to the original state. In particular:
|
||||
- Addon will be re-created if it is deleted.
|
||||
- Addon will be reconfigured to the state given by the supplied fields in the template
|
||||
file periodically.
|
||||
- Addon will be deleted when its manifest file is deleted from the `$ADDON_PATH`.
|
||||
- Addons with label `addonmanager.kubernetes.io/mode=EnsureExists` will be checked for
|
||||
existence only. Users can edit these addons as they want. In particular:
|
||||
- Addon will only be created/re-created with the given template file when there is no
|
||||
instance of the resource with that name.
|
||||
- Addon will not be deleted when the manifest file is deleted from the `$ADDON_PATH`.
|
||||
|
||||
Notes:
|
||||
- Label `kubernetes.io/cluster-service=true` is deprecated (only for Addon Manager).
|
||||
In future release (after one year), Addon Manager may not respect it anymore. Addons
|
||||
have this label but without `addonmanager.kubernetes.io/mode=EnsureExists` will be
|
||||
treated as "reconcile class addons" for now.
|
||||
- Resources under `$ADDON_PATH` need to have either one of these two labels.
|
||||
Meanwhile namespaced resources need to be in `kube-system` namespace.
|
||||
Otherwise it will be omitted.
|
||||
- The above label and namespace rule does not stand for `/opt/namespace.yaml` and
|
||||
resources under `/etc/kubernetes/admission-controls/`. addon-manager will attempt to
|
||||
create them regardless during startup.
|
||||
|
||||
#### How to release
|
||||
|
||||
The `addon-manager` is built for multiple architectures.
|
||||
|
||||
1. Change something in the source
|
||||
2. Bump `VERSION` in the `Makefile`
|
||||
3. Bump `KUBECTL_VERSION` in the `Makefile` if required
|
||||
4. Build the `amd64` image and test it on a cluster
|
||||
5. Push all images
|
||||
|
||||
```console
|
||||
# Build for linux/amd64 (default)
|
||||
$ make push ARCH=amd64
|
||||
# ---> gcr.io/google-containers/kube-addon-manager-amd64:VERSION
|
||||
# ---> gcr.io/google-containers/kube-addon-manager:VERSION (image with backwards-compatible naming)
|
||||
|
||||
$ make push ARCH=arm
|
||||
# ---> gcr.io/google-containers/kube-addon-manager-arm:VERSION
|
||||
|
||||
$ make push ARCH=arm64
|
||||
# ---> gcr.io/google-containers/kube-addon-manager-arm64:VERSION
|
||||
|
||||
$ make push ARCH=ppc64le
|
||||
# ---> gcr.io/google-containers/kube-addon-manager-ppc64le:VERSION
|
||||
|
||||
$ make push ARCH=s390x
|
||||
# ---> gcr.io/google-containers/kube-addon-manager-s390x:VERSION
|
||||
```
|
||||
|
||||
If you don't want to push the images, run `make` or `make build` instead
|
||||
|
||||
|
||||
[]()
|
215
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/kube-addons.sh
generated
vendored
Executable file
215
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/kube-addons.sh
generated
vendored
Executable file
@ -0,0 +1,215 @@
|
||||
#!/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.
|
||||
|
||||
# LIMITATIONS
|
||||
# 1. Exit code is probably not always correct.
|
||||
# 2. There are no unittests.
|
||||
# 3. Will not work if the total length of paths to addons is greater than
|
||||
# bash can handle. Probably it is not a problem: ARG_MAX=2097152 on GCE.
|
||||
|
||||
# cosmetic improvements to be done
|
||||
# 1. Improve the log function; add timestamp, file name, etc.
|
||||
# 2. Logging doesn't work from files that print things out.
|
||||
# 3. Kubectl prints the output to stderr (the output should be captured and then
|
||||
# logged)
|
||||
|
||||
KUBECTL=${KUBECTL_BIN:-/usr/local/bin/kubectl}
|
||||
KUBECTL_OPTS=${KUBECTL_OPTS:-}
|
||||
|
||||
ADDON_CHECK_INTERVAL_SEC=${TEST_ADDON_CHECK_INTERVAL_SEC:-60}
|
||||
ADDON_PATH=${ADDON_PATH:-/etc/kubernetes/addons}
|
||||
|
||||
SYSTEM_NAMESPACE=kube-system
|
||||
|
||||
# Addons could use this label with two modes:
|
||||
# - ADDON_MANAGER_LABEL=Reconcile
|
||||
# - ADDON_MANAGER_LABEL=EnsureExists
|
||||
ADDON_MANAGER_LABEL="addonmanager.kubernetes.io/mode"
|
||||
# This label is deprecated (only for Addon Manager). In future release
|
||||
# addon-manager may not respect it anymore. Addons with
|
||||
# CLUSTER_SERVICE_LABEL=true and without ADDON_MANAGER_LABEL=EnsureExists
|
||||
# will be reconciled for now.
|
||||
CLUSTER_SERVICE_LABEL="kubernetes.io/cluster-service"
|
||||
|
||||
# Whether only one addon manager should be running in a multi-master setup.
|
||||
# Disabling this flag will force all addon managers to assume they are the
|
||||
# leaders.
|
||||
ADDON_MANAGER_LEADER_ELECTION=${ADDON_MANAGER_LEADER_ELECTION:-true}
|
||||
|
||||
# Remember that you can't log from functions that print some output (because
|
||||
# logs are also printed on stdout).
|
||||
# $1 level
|
||||
# $2 message
|
||||
function log() {
|
||||
# manage log levels manually here
|
||||
|
||||
# add the timestamp if you find it useful
|
||||
case $1 in
|
||||
DB3 )
|
||||
# echo "$1: $2"
|
||||
;;
|
||||
DB2 )
|
||||
# echo "$1: $2"
|
||||
;;
|
||||
DBG )
|
||||
# echo "$1: $2"
|
||||
;;
|
||||
INFO )
|
||||
echo "$1: $2"
|
||||
;;
|
||||
WRN )
|
||||
echo "$1: $2"
|
||||
;;
|
||||
ERR )
|
||||
echo "$1: $2"
|
||||
;;
|
||||
* )
|
||||
echo "INVALID_LOG_LEVEL $1: $2"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# $1 filename of addon to start.
|
||||
# $2 count of tries to start the addon.
|
||||
# $3 delay in seconds between two consecutive tries
|
||||
# $4 namespace
|
||||
function start_addon() {
|
||||
local -r addon_filename=$1;
|
||||
local -r tries=$2;
|
||||
local -r delay=$3;
|
||||
local -r namespace=$4
|
||||
|
||||
create_resource_from_string "$(cat ${addon_filename})" "${tries}" "${delay}" "${addon_filename}" "${namespace}"
|
||||
}
|
||||
|
||||
# $1 string with json or yaml.
|
||||
# $2 count of tries to start the addon.
|
||||
# $3 delay in seconds between two consecutive tries
|
||||
# $4 name of this object to use when logging about it.
|
||||
# $5 namespace for this object
|
||||
function create_resource_from_string() {
|
||||
local -r config_string=$1;
|
||||
local tries=$2;
|
||||
local -r delay=$3;
|
||||
local -r config_name=$4;
|
||||
local -r namespace=$5;
|
||||
while [ ${tries} -gt 0 ]; do
|
||||
echo "${config_string}" | ${KUBECTL} ${KUBECTL_OPTS} --namespace="${namespace}" apply -f - && \
|
||||
log INFO "== Successfully started ${config_name} in namespace ${namespace} at $(date -Is)" && \
|
||||
return 0;
|
||||
let tries=tries-1;
|
||||
log WRN "== Failed to start ${config_name} in namespace ${namespace} at $(date -Is). ${tries} tries remaining. =="
|
||||
sleep ${delay};
|
||||
done
|
||||
return 1;
|
||||
}
|
||||
|
||||
function reconcile_addons() {
|
||||
# TODO: Remove the first command in future release.
|
||||
# Adding this for backward compatibility. Old addons have CLUSTER_SERVICE_LABEL=true and don't have
|
||||
# ADDON_MANAGER_LABEL=EnsureExists will still be reconciled.
|
||||
# Filter out `configured` message to not noisily log.
|
||||
# `created`, `pruned` and errors will be logged.
|
||||
log INFO "== Reconciling with deprecated label =="
|
||||
${KUBECTL} ${KUBECTL_OPTS} apply --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \
|
||||
-l ${CLUSTER_SERVICE_LABEL}=true,${ADDON_MANAGER_LABEL}!=EnsureExists \
|
||||
--prune=true --recursive | grep -v configured
|
||||
|
||||
log INFO "== Reconciling with addon-manager label =="
|
||||
${KUBECTL} ${KUBECTL_OPTS} apply --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \
|
||||
-l ${CLUSTER_SERVICE_LABEL}!=true,${ADDON_MANAGER_LABEL}=Reconcile \
|
||||
--prune=true --recursive | grep -v configured
|
||||
|
||||
log INFO "== Kubernetes addon reconcile completed at $(date -Is) =="
|
||||
}
|
||||
|
||||
function ensure_addons() {
|
||||
# Create objects already exist should fail.
|
||||
# Filter out `AlreadyExists` message to not noisily log.
|
||||
${KUBECTL} ${KUBECTL_OPTS} create --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \
|
||||
-l ${ADDON_MANAGER_LABEL}=EnsureExists --recursive 2>&1 | grep -v AlreadyExists
|
||||
|
||||
log INFO "== Kubernetes addon ensure completed at $(date -Is) =="
|
||||
}
|
||||
|
||||
function is_leader() {
|
||||
# In multi-master setup, only one addon manager should be running. We use
|
||||
# existing leader election in kube-controller-manager instead of implementing
|
||||
# a separate mechanism here.
|
||||
if ! $ADDON_MANAGER_LEADER_ELECTION; then
|
||||
log INFO "Leader election disabled."
|
||||
return 0;
|
||||
fi
|
||||
KUBE_CONTROLLER_MANAGER_LEADER=`${KUBECTL} -n kube-system get ep kube-controller-manager \
|
||||
-o go-template=$'{{index .metadata.annotations "control-plane.alpha.kubernetes.io/leader"}}' \
|
||||
| sed 's/^.*"holderIdentity":"\([^"]*\)".*/\1/'`
|
||||
# If there was any problem with getting the leader election results, var will
|
||||
# be empty. Since it's better to have multiple addon managers than no addon
|
||||
# managers at all, we're going to assume that we're the leader in such case.
|
||||
log INFO "Leader is $KUBE_CONTROLLER_MANAGER_LEADER"
|
||||
[[ "$KUBE_CONTROLLER_MANAGER_LEADER" == "" ||
|
||||
"$HOSTNAME" == "$KUBE_CONTROLLER_MANAGER_LEADER" ]]
|
||||
}
|
||||
|
||||
# The business logic for whether a given object should be created
|
||||
# was already enforced by salt, and /etc/kubernetes/addons is the
|
||||
# managed result is of that. Start everything below that directory.
|
||||
log INFO "== Kubernetes addon manager started at $(date -Is) with ADDON_CHECK_INTERVAL_SEC=${ADDON_CHECK_INTERVAL_SEC} =="
|
||||
|
||||
# Create the namespace that will be used to host the cluster-level add-ons.
|
||||
start_addon /opt/namespace.yaml 100 10 "" &
|
||||
|
||||
# Wait for the default service account to be created in the kube-system namespace.
|
||||
token_found=""
|
||||
while [ -z "${token_found}" ]; do
|
||||
sleep .5
|
||||
token_found=$(${KUBECTL} ${KUBECTL_OPTS} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default -o go-template="{{with index .secrets 0}}{{.name}}{{end}}")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
token_found="";
|
||||
log WRN "== Error getting default service account, retry in 0.5 second =="
|
||||
fi
|
||||
done
|
||||
|
||||
log INFO "== Default service account in the ${SYSTEM_NAMESPACE} namespace has token ${token_found} =="
|
||||
|
||||
# Create admission_control objects if defined before any other addon services. If the limits
|
||||
# are defined in a namespace other than default, we should still create the limits for the
|
||||
# default namespace.
|
||||
for obj in $(find /etc/kubernetes/admission-controls \( -name \*.yaml -o -name \*.json \)); do
|
||||
start_addon "${obj}" 100 10 default &
|
||||
log INFO "++ obj ${obj} is created ++"
|
||||
done
|
||||
|
||||
# Start the apply loop.
|
||||
# Check if the configuration has changed recently - in case the user
|
||||
# created/updated/deleted the files on the master.
|
||||
log INFO "== Entering periodical apply loop at $(date -Is) =="
|
||||
while true; do
|
||||
start_sec=$(date +"%s")
|
||||
if is_leader; then
|
||||
ensure_addons
|
||||
reconcile_addons
|
||||
else
|
||||
log INFO "Not elected leader, going back to sleep."
|
||||
fi
|
||||
end_sec=$(date +"%s")
|
||||
len_sec=$((${end_sec}-${start_sec}))
|
||||
# subtract the time passed from the sleep time
|
||||
if [[ ${len_sec} -lt ${ADDON_CHECK_INTERVAL_SEC} ]]; then
|
||||
sleep_time=$((${ADDON_CHECK_INTERVAL_SEC}-${len_sec}))
|
||||
sleep ${sleep_time}
|
||||
fi
|
||||
done
|
4
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/namespace.yaml
generated
vendored
Normal file
4
vendor/k8s.io/kubernetes/cluster/addons/addon-manager/namespace.yaml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kube-system
|
Reference in New Issue
Block a user