Skip to content

Commit

Permalink
Merge pull request #355 from openinfradev/policy-serving
Browse files Browse the repository at this point in the history
policy: bugfix to find policy namespace
  • Loading branch information
ktkfree authored Apr 17, 2024
2 parents 1ee619c + d6d7864 commit d8c4ab8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tks-cluster/create-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ spec:
####### add tks info. on namespace ########
kubectl label ns ${CLUSTER_ID} tks.io/organization=${CONTRACT_ID}
if [ $(kubectl get ns -l tks.io/organization=${CONTRACT_ID} -l tks.io/policy --ignore-not-found=true | grep -v NAME | awk '{print $1}' | wc -l ) -eq 0 ]; then
if [ $(kubectl get ns -l tks.io/organization=${CONTRACT_ID} --ignore-not-found=true | grep -v NAME | awk '{print $1}' | wc -l ) -le 1 ]; then
kubectl label ns ${CLUSTER_ID} tks.io/policy=${CLUSTER_ID}
else
kubectl label ns ${CLUSTER_ID} tks.io/policy=$(kubectl get ns $(kubectl get ns -l tks.io/organization=${CONTRACT_ID} -l tks.io/policy --ignore-not-found=true | grep -v NAME | awk '{print $1}' | head -n 1 ) --ignore-not-found=true -o jsonpath='{.metadata.labels.tks\.io\/policy}' )
POLICY_NS=$(kubectl get ns $(kubectl get ns -l tks.io/organization=${CONTRACT_ID} --ignore-not-found=true | grep -v NAME | awk '{print $1}' | head -n 1 ) --ignore-not-found=true -o jsonpath='{.metadata.labels.tks\.io\/policy}' )
if [ -z "$POLICY_NS" ]"; then
kubectl label ns ${CLUSTER_ID} tks.io/policy=${CLUSTER_ID}
else
kubectl label ns ${CLUSTER_ID} tks.io/policy=${POLICY_NS}
fi
fi
###########################################
Expand Down

0 comments on commit d8c4ab8

Please sign in to comment.