File tree Expand file tree Collapse file tree 8 files changed +55
-94
lines changed
lb-created-with-new-nb-id
lb-created-with-specified-nb-id
lb-delete-svc-use-new-nbid
lb-delete-svc-use-specified-nb Expand file tree Collapse file tree 8 files changed +55
-94
lines changed Original file line number Diff line number Diff line change 3939 re='^[0-9]+$'
4040 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4141
42- # Get existing dummy nodebalancer id to get VPC config
43- dummy_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh svc-dummy)
44-
45- # Get VPC config if it exists
46- vpcconfig=$(curl -s \
47- -H "Authorization: Bearer $LINODE_TOKEN" \
48- -H "Content-Type: application/json" \
49- "$LINODE_URL/v4beta/nodebalancers/$dummy_nbid/vpcs")
50-
51- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $dummy_nbid) | .subnet_id")
52-
53- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
54- if [[ -z $SUBNET_ID ]]; then
55- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
56- fi
42+ # Get data to use for new nodebalancer
43+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-dummy)
5744
5845 nbid=$(curl -s --request POST \
5946 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 3939 re='^[0-9]+$'
4040 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4141
42- # Get existing dummy nodebalancer id to get VPC config
43- dummy_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh svc-dummy)
44-
45- # Get VPC config if it exists
46- vpcconfig=$(curl -s \
47- -H "Authorization: Bearer $LINODE_TOKEN" \
48- -H "Content-Type: application/json" \
49- "$LINODE_URL/v4beta/nodebalancers/$dummy_nbid/vpcs")
50-
51- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $dummy_nbid) | .subnet_id")
52-
53- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
54- if [[ -z $SUBNET_ID ]]; then
55- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
56- fi
42+ # Get data to use for new nodebalancer
43+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-dummy)
5744
5845 nbid=$(curl -s --request POST \
5946 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 3939 re='^[0-9]+$'
4040 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4141
42- # Get existing dummy nodebalancer id to get VPC config
43- dummy_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh svc-dummy)
44-
45- # Get VPC config if it exists
46- vpcconfig=$(curl -s \
47- -H "Authorization: Bearer $LINODE_TOKEN" \
48- -H "Content-Type: application/json" \
49- "$LINODE_URL/v4beta/nodebalancers/$dummy_nbid/vpcs")
50-
51- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $dummy_nbid) | .subnet_id")
52-
53- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
54- if [[ -z $SUBNET_ID ]]; then
55- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
56- fi
42+ # Get data to use for new nodebalancer
43+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-dummy)
5744
5845 nbid=$(curl -s --request POST \
5946 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 3939 re='^[0-9]+$'
4040 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4141
42- # Get existing dummy nodebalancer id to get VPC config
43- dummy_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh svc-dummy)
44-
45- # Get VPC config if it exists
46- vpcconfig=$(curl -s \
47- -H "Authorization: Bearer $LINODE_TOKEN" \
48- -H "Content-Type: application/json" \
49- "$LINODE_URL/v4beta/nodebalancers/$dummy_nbid/vpcs")
50-
51- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $dummy_nbid) | .subnet_id")
52-
53- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
54- if [[ -z $SUBNET_ID ]]; then
55- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
56- fi
42+ # Get data to use for new nodebalancer
43+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-dummy)
5744
5845 nbid=$(curl -s --request POST \
5946 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 3939 re='^[0-9]+$'
4040 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4141
42- # Get existing dummy nodebalancer id to get VPC config
43- dummy_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh svc-dummy)
44-
45- # Get VPC config if it exists
46- vpcconfig=$(curl -s \
47- -H "Authorization: Bearer $LINODE_TOKEN" \
48- -H "Content-Type: application/json" \
49- "$LINODE_URL/v4beta/nodebalancers/$dummy_nbid/vpcs")
50-
51- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $dummy_nbid) | .subnet_id")
52-
53- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
54- if [[ -z $SUBNET_ID ]]; then
55- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
56- fi
42+ # Get data to use for new nodebalancer
43+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-dummy)
5744
5845 nbid=$(curl -s --request POST \
5946 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 4040 re='^[0-9]+$'
4141 LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)"
4242
43- # Get existing nodebalancer id
44- old_nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh)
45-
46- # Get VPC config for the old nodebalancer if it exists
47- vpcconfig=$(curl -s \
48- -H "Authorization: Bearer $LINODE_TOKEN" \
49- -H "Content-Type: application/json" \
50- "$LINODE_URL/v4beta/nodebalancers/$old_nbid/vpcs")
51-
52- echo "Nodebalancer ID: $old_nbid"
53- echo "VPC config: $vpcconfig"
54-
55- SUBNET_ID=$(echo $vpcconfig | jq -r ".data[] | select(.nodebalancer_id == $old_nbid) | .subnet_id")
56- echo "Subnet ID: $SUBNET_ID"
57-
58- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\", \"vpcs\": [{\"subnet_id\": $SUBNET_ID}]}"
59- if [[ -z $SUBNET_ID ]]; then
60- data="{\"label\": \"$LABEL\", \"region\": \"$REGION\"}"
61- fi
43+ # Get data to use for new nodebalancer
44+ data=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN LABEL=$LABEL REGION=$REGION ../scripts/get-nb-create-data.sh svc-test)
6245
6346 nbid=$(curl -s --request POST \
6447 -H "Authorization: Bearer $LINODE_TOKEN" \
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ SCRIPT_DIR=$( dirname " $0 " )
6+
7+ svcname=" svc-test"
8+ if [[ -n " $1 " ]]; then
9+ svcname=" $1 "
10+ fi
11+
12+ # Get existing service's subnet id
13+ SUBNET_ID=$( KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN $SCRIPT_DIR /get-nb-subnet-id.sh $svcname )
14+
15+ data=" {\" label\" : \" $LABEL \" , \" region\" : \" $REGION \" , \" vpcs\" : [{\" subnet_id\" : $SUBNET_ID }]}"
16+ if [[ -z $SUBNET_ID ]]; then
17+ data=" {\" label\" : \" $LABEL \" , \" region\" : \" $REGION \" }"
18+ fi
19+
20+ echo $data
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ SCRIPT_DIR=$( dirname " $0 " )
6+
7+ svcname=" svc-test"
8+ if [[ -n " $1 " ]]; then
9+ svcname=" $1 "
10+ fi
11+
12+ # Get existing dummy nodebalancer id to get VPC config
13+ nbid=$( KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN $SCRIPT_DIR /get-nb-id.sh $svcname )
14+
15+ # Get VPC config if it exists
16+ vpcconfig=$( curl -s \
17+ -H " Authorization: Bearer $LINODE_TOKEN " \
18+ -H " Content-Type: application/json" \
19+ " $LINODE_URL /v4beta/nodebalancers/$nbid /vpcs" )
20+
21+ SUBNET_ID=$( echo $vpcconfig | jq -r " .data[] | select(.nodebalancer_id == $nbid ) | .subnet_id" )
22+
23+ echo $SUBNET_ID
You can’t perform that action at this time.
0 commit comments