Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions internal/postgres/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ done
if post250 {
script = fmt.Sprintf(`
# Parameters for curl when managing autogrow annotation.
APISERVER="https://kubernetes.default.svc"
APISERVER="https://${KUBERNETES_SERVICE_HOST}"
SERVICEACCOUNT="/var/run/secrets/kubernetes.io/serviceaccount"
NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
TOKEN=$(cat ${SERVICEACCOUNT}/token)
Expand Down Expand Up @@ -246,7 +246,7 @@ while read -r -t 5 -u "${fd}" ||:; do
newSize="$(((sizeInt / 2)+sizeInt))"
newSizeMi="${newSize}Mi"
d='[{"op": "add", "path": "/metadata/annotations/suggested-pgdata-pvc-size", "value": "'"$newSizeMi"'"}]'
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -XPATCH "${APISERVER}/api/v1/namespaces/${NAMESPACE}/pods/${HOSTNAME}?fieldManager=kubectl-annotate" -H "Content-Type: application/json-patch+json" --data "$d"
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -XPATCH "${APISERVER}/api/v1/namespaces/${NAMESPACE}/pods/${hostname}?fieldManager=kubectl-annotate" -H "Content-Type: application/json-patch+json" --data "$d"
fi
done
`,
Expand Down
4 changes: 2 additions & 2 deletions internal/postgres/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ containers:
- |-
monitor() {
# Parameters for curl when managing autogrow annotation.
APISERVER="https://kubernetes.default.svc"
APISERVER="https://${KUBERNETES_SERVICE_HOST}"
SERVICEACCOUNT="/var/run/secrets/kubernetes.io/serviceaccount"
NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
TOKEN=$(cat ${SERVICEACCOUNT}/token)
Expand Down Expand Up @@ -202,7 +202,7 @@ containers:
newSize="$(((sizeInt / 2)+sizeInt))"
newSizeMi="${newSize}Mi"
d='[{"op": "add", "path": "/metadata/annotations/suggested-pgdata-pvc-size", "value": "'"$newSizeMi"'"}]'
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -XPATCH "${APISERVER}/api/v1/namespaces/${NAMESPACE}/pods/${HOSTNAME}?fieldManager=kubectl-annotate" -H "Content-Type: application/json-patch+json" --data "$d"
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -XPATCH "${APISERVER}/api/v1/namespaces/${NAMESPACE}/pods/${hostname}?fieldManager=kubectl-annotate" -H "Content-Type: application/json-patch+json" --data "$d"
fi
done
}; export -f monitor; exec -a "$0" bash -ceu monitor
Expand Down
Loading