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

kubernetes helm chart: Automatically assign an ordinal index from statefulsets metadata #88

Open
weideng1 opened this issue Dec 28, 2022 · 1 comment

Comments

@weideng1
Copy link
Collaborator

weideng1 commented Dec 28, 2022

Currently zdm-proxy process expects this env value to be set at start time: ZDM_PROXY_TOPOLOGY_INDEX

I've looked into online discussions, and looks like there is an unresolved issue w.r.t. directly exposing this ordinal index from statefulsets: kubernetes/kubernetes#40651

Before this is fully supported in a future version of k8s, we will have to adopt some ugly workaround by either using initContainers or lifecycle hook like the following:

apiVersion: apps/v1
kind: StatefulSet
spec:
  serviceName: "zdm-proxy"
  replicas: {{ $.Values.proxy.count | int }}
  template:
    spec:
      containers:
      - lifecycle:
          postStart:
            exec:
              command: ["/bin/sh", "-c", "export STS_INDEX=${HOSTNAME##*-}"]

┆Issue is synchronized with this Jira Task by Unito
┆Components: Proxy
┆Issue Number: ZDM-505

@joao-r-reis
Copy link
Collaborator

joao-r-reis commented Jan 9, 2023

We could potentially add another config setting like "ZDM_PROXY_TOPOLOGY_LOCAL_ADDRESS" and then let the proxy compute its index by looking up the ZDM_PROXY_TOPOLOGY_LOCAL_ADDRESS in the ZDM_PROXY_TOPOLOGY_ADDRESSES. We would require only one of these 2 settings to be set (îndex or local address) but in order for the local address setting to work correctly we need the proxy to order the ZDM_PROXY_TOPOLOGY_ADDRESSES first just to ensure that it works even when the order of the addresses in ZDM_PROXY_TOPOLOGY_ADDRESSES is different in different proxy nodes (it should never happen but we should be safe).

Would this make it easier to make the proxy work with stateful sets @weideng1 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants