query namespaced K8s API in logical backup script
This commit is contained in:
parent
53fea88391
commit
e5bc33e52f
|
|
@ -48,14 +48,14 @@ function aws_upload {
|
||||||
function get_pods {
|
function get_pods {
|
||||||
declare -r SELECTOR="$1"
|
declare -r SELECTOR="$1"
|
||||||
|
|
||||||
curl "${K8S_API_URL}/pods?$SELECTOR" \
|
curl "${K8S_API_URL}/namespaces/${POD_NAMESPACE}/pods?$SELECTOR" \
|
||||||
--cacert $CERT \
|
--cacert $CERT \
|
||||||
-H "Authorization: Bearer ${TOKEN}" | jq .items[].status.podIP -r
|
-H "Authorization: Bearer ${TOKEN}" | jq .items[].status.podIP -r
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_current_pod {
|
function get_current_pod {
|
||||||
curl "${K8S_API_URL}/pods?fieldSelector=metadata.name%3D${HOSTNAME}" \
|
curl "${K8S_API_URL}/namespaces/${POD_NAMESPACE}/pods?fieldSelector=metadata.name%3D${HOSTNAME}" \
|
||||||
--cacert $CERT \
|
--cacert $CERT \
|
||||||
-H "Authorization: Bearer ${TOKEN}"
|
-H "Authorization: Bearer ${TOKEN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1528,6 +1528,15 @@ func (c *Cluster) generateLogicalBackupPodEnvVars() []v1.EnvVar {
|
||||||
Name: "SCOPE",
|
Name: "SCOPE",
|
||||||
Value: c.Name,
|
Value: c.Name,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "POD_NAMESPACE",
|
||||||
|
ValueFrom: &v1.EnvVarSource{
|
||||||
|
FieldRef: &v1.ObjectFieldSelector{
|
||||||
|
APIVersion: "v1",
|
||||||
|
FieldPath: "metadata.namespace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
// Bucket env vars
|
// Bucket env vars
|
||||||
{
|
{
|
||||||
Name: "LOGICAL_BACKUP_S3_BUCKET",
|
Name: "LOGICAL_BACKUP_S3_BUCKET",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue