Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label all spinnaker services and deployments. #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Label all spinnaker services and deployments.
When new service components (e.g Fiat) were enabled they were not
being labeled by `deploy_application_manifest.sh`. This commit
resolves the issue by additionally querying the set of deployments and
services in the spinnaker namespace and then applying the
`app.kubernetes.io/name` with the Spinnaker instance name.

Fixes #248
  • Loading branch information
stewartmiles committed Mar 21, 2022
commit fcf51407b1fd1e9d6358d8d58e40bb257dbc6b5c
44 changes: 25 additions & 19 deletions scripts/manage/deploy_application_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,28 @@ cat $PARENT_DIR/spinnaker-for-gcp/templates/spinnaker_application_manifest_top.y
| envsubst | kubectl apply -f -

bold "Labeling resources as components of application $DEPLOYMENT_NAME..."
kubectl label service --overwrite -n spinnaker spin-clouddriver app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-deck app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-echo app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-front50 app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-gate app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-igor app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-kayenta app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-orca app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label service --overwrite -n spinnaker spin-rosco app.kubernetes.io/name=$DEPLOYMENT_NAME -o name

kubectl label deployment --overwrite -n spinnaker spin-clouddriver app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-deck app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-echo app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-front50 app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-gate app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-igor app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-kayenta app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-orca app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
kubectl label deployment --overwrite -n spinnaker spin-rosco app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
# List of expected Spinnaker components for a default deployment.
declare -r DEFAULT_COMPONENTS="\
spin-clouddriver
spin-deck
spin-echo
spin-front50
spin-gate
spin-igor
spin-kayenta
spin-orca
spin-rosco"

for object_type in services deployments; do
default_objects=$(echo "${DEFAULT_COMPONENTS}" | sed "s@^@${object_type}/&@")
for name in $(
(
echo "${default_objects}";
# Fold-in optional components if they've been added to the cluster.
kubectl get "${object_type}" -n spinnaker -o name | \
sed 's@^deployment[^/]*/@deployments/@;s@^service[^/]*/@services/@'
) | sort -u ); do
kubectl label --overwrite -n spinnaker "${name}" \
app.kubernetes.io/name=$DEPLOYMENT_NAME -o name
done
done