Skip to content

Commit 0b78ed2

Browse files
author
m.doulabi
committed
fix(callback_role): support custom Kubernetes cluster domains
Replace hardcoded cluster.local with KUBERNETES_SERVICE_HOST env var. Users can now set custom cluster domains like: - https://kubernetes.default.svc.cluster.bk1 - http://192.168.1.1:8443 Fully backwards compatible - defaults to previous behavior. Fixes: patroni could not patch pod labels on clusters with custom cluster domains.
1 parent f332b91 commit 0b78ed2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

postgres-appliance/scripts/callback_role.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
KUBE_TOKEN_FILENAME = KUBE_SERVICE_DIR + 'token'
1515
KUBE_CA_CERT = KUBE_SERVICE_DIR + 'ca.crt'
1616

17-
KUBE_API_URL = 'https://kubernetes.default.svc.cluster.local/api/v1/namespaces'
17+
KUBE_API_URL = os.environ.get('KUBERNETES_SERVICE_HOST', 'https://kubernetes.default.svc.cluster.local') + '/api/v1/namespaces'
1818

1919
logger = logging.getLogger(__name__)
2020

@@ -94,4 +94,4 @@ def main():
9494

9595

9696
if __name__ == '__main__':
97-
main()
97+
main()

0 commit comments

Comments
 (0)