Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #302 from akavel/kind-collisions
Browse files Browse the repository at this point in the history
template-processors/base: use fully qualified kind names in kubectl (#273)
  • Loading branch information
seanmalloy authored Feb 24, 2020
2 parents 0050d05 + e31e0f7 commit 4e9c75a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ shellcheck:

.PHONY: e2e-test-images
e2e-test-images: build
TRAVIS_TAG=v999.0.0 ./scripts/build-images.sh ${REPOSITORY}
TRAVIS_TAG=latest ./scripts/build-images.sh ${REPOSITORY}

# Deploy images to Quay.io
.PHONY: travis-deploy-images
Expand Down
7 changes: 3 additions & 4 deletions template-processors/base/bin/resourceManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ function addLabels() {
function deleteByOldLabels() {
local owner="$1"
local timestamp="${2:-}"
# NOTE: removing componentstatus because it shows up unintended in ownedKinds: https://github.com/kubernetes/kubectl/issues/151#issuecomment-562578617
local allKinds="$(kube api-resources --verbs=list -o name | grep -ivE '^componentstatus(es)?$' | paste -sd, -)"
local allKinds="$(kube api-resources --verbs=list,delete -o name | paste -sd, -)"
local ownedKinds="$(kube get "$allKinds" --ignore-not-found \
-l "$TAG_OWNER==$owner" \
-o custom-columns=kind:.kind \
--no-headers=true |
-o jsonpath="{range .items[*]}{.kind} {.apiVersion}{'\n'}{end}" | # e.g. "Pod v1" OR "StorageClass storage.k8s.io/v1"
sort -u |
awk -F'[ /]' '{if (NF==2) {print $1} else {print $1"."$3"."$2}}' | # e.g. "Pod" OR "StorageClass.v1.storage.k8s.io"
paste -sd, -)"
if [ -z "$ownedKinds" ]; then
return
Expand Down

0 comments on commit 4e9c75a

Please sign in to comment.