Skip to content

Commit

Permalink
Fix the way addon-manager handles non-namespaced objects
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarek committed Jul 5, 2016
1 parent ef3f2fb commit 0c60cfc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cluster/addons/addon-manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
IMAGE=gcr.io/google-containers/kube-addon-manager
ARCH?=amd64
TEMP_DIR:=$(shell mktemp -d)
VERSION=v5
VERSION=v5.1

# amd64 and arm has "stable" binaries pushed for v1.2, arm64 and ppc64le hasn't so they have to fetch the latest alpha
# however, arm64 and ppc64le are very experimental right now, so it's okay
Expand Down
12 changes: 7 additions & 5 deletions cluster/addons/addon-manager/kube-addon-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
# 3. kubectl prints the output to stderr (the output should be captured and then
# logged)



# global config
KUBECTL=${TEST_KUBECTL:-} # substitute for tests
KUBECTL=${KUBECTL:-${KUBECTL_BIN:-}}
Expand Down Expand Up @@ -133,7 +131,7 @@ try:
try:
print "%s/%s" % (y["metadata"]["namespace"], y["metadata"]["name"])
except Exception, ex:
print "default/%s" % y["metadata"]["name"]
print "/%s" % y["metadata"]["name"]
except Exception, ex:
print "ERROR"
'''
Expand Down Expand Up @@ -198,7 +196,7 @@ function run-until-success() {
# returns a list of <namespace>/<name> pairs (nsnames)
function get-addon-nsnames-from-server() {
local -r obj_type=$1
"${KUBECTL}" get "${obj_type}" --all-namespaces -o go-template="{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" -l kubernetes.io/cluster-service=true
"${KUBECTL}" get "${obj_type}" --all-namespaces -o go-template="{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" -l kubernetes.io/cluster-service=true | sed 's/<no value>//g'
}

# returns the characters after the last separator (including)
Expand Down Expand Up @@ -262,7 +260,11 @@ function create-object() {
log INFO "Creating new ${obj_type} from file ${file_path} in namespace ${namespace}, name: ${obj_name}"
# this will keep on failing if the ${file_path} disappeared in the meantime.
# Do not use too many retries.
run-until-success "${KUBECTL} create --namespace=${namespace} -f ${file_path}" ${NUM_TRIES} ${DELAY_AFTER_ERROR_SEC}
if [[ -n "${namespace}" ]]; then
run-until-success "${KUBECTL} create --namespace=${namespace} -f ${file_path}" ${NUM_TRIES} ${DELAY_AFTER_ERROR_SEC}
else
run-until-success "${KUBECTL} create -f ${file_path}" ${NUM_TRIES} ${DELAY_AFTER_ERROR_SEC}
fi
}

function update-object() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ kind: PersistentVolume
apiVersion: v1
metadata:
name: influxdb-pv
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
spec:
Expand Down
2 changes: 1 addition & 1 deletion cluster/images/hyperkube/static-pods/addon-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"containers": [
{
"name": "kube-addon-manager",
"image": "gcr.io/google-containers/kube-addon-manager-ARCH:v4",
"image": "gcr.io/google-containers/kube-addon-manager-ARCH:v5.1",
"resources": {
"requests": {
"cpu": "5m",
Expand Down
3 changes: 2 additions & 1 deletion cluster/saltbase/salt/kube-addons/kube-addon-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ spec:
hostNetwork: true
containers:
- name: kube-addon-manager
image: gcr.io/google-containers/kube-addon-manager:v5
# When updating version also bump it in cluster/images/hyperkube/static-pods/addon-manager.json
image: gcr.io/google-containers/kube-addon-manager:v5.1
resources:
requests:
cpu: 5m
Expand Down

0 comments on commit 0c60cfc

Please sign in to comment.