Skip to content

Commit

Permalink
read ETCD_HOST from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
dasbd72 committed Sep 24, 2023
1 parent e8db67a commit a02e59e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
1 change: 0 additions & 1 deletion pkg/ETCD_HOST

This file was deleted.

11 changes: 2 additions & 9 deletions pkg/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,15 @@ def __init__(

self.endpoint: str = endpoint
self.force_remote: bool = force_remote
if os.path.exists("ETCD_HOST"):
with open("ETCD_HOST", "r") as f:
self.etcd_host = f.read()
else:
self.etcd_host = None
self.etcd_host = os.getenv("ETCD_HOST", "localhost:2379")
logging.info(f"ETCD_HOST: {self.etcd_host}")

try:
self.etcd_client = etcd3.client(host=self.etcd_host, port=2379)
except Exception as e:
logging.error("Initialize etcd fail: {}".format(e))

if "STORAGE_PATH" in os.environ.keys():
self.storage_path = os.environ["STORAGE_PATH"]
else:
self.storage_path = None
self.storage_path = os.getenv("STORAGE_PATH", None)
logging.info(f"STORAGE_PATH: {self.storage_path}")

# Read data serve ip:port from storage
Expand Down
8 changes: 4 additions & 4 deletions yamls/apps-disk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: MANAGER_PORT
value: "12346"
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down Expand Up @@ -85,8 +85,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: MANAGER_PORT
value: "12346"
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down
8 changes: 4 additions & 4 deletions yamls/apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: MANAGER_PORT
value: "12345"
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down Expand Up @@ -84,8 +84,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: MANAGER_PORT
value: "12345"
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down
2 changes: 2 additions & 0 deletions yamls/manager-disk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ spec:
env:
- name: STORAGE_PATH
value: /shared
- name: ETCD_HOST
value: "10.121.240.143:2379"
volumes:
- name: shared-volume
hostPath:
Expand Down
2 changes: 2 additions & 0 deletions yamls/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ spec:
env:
- name: STORAGE_PATH
value: /shared
- name: ETCD_HOST
value: "10.121.240.143:2379"
volumes:
- name: shared-volume
hostPath:
Expand Down
6 changes: 6 additions & 0 deletions yamls/new-apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down Expand Up @@ -85,6 +87,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down Expand Up @@ -135,6 +139,8 @@ spec:
value: /shared
- name: LOG_LEVEL
value: INFO
- name: ETCD_HOST
value: "10.121.240.143:2379"
resources:
requests:
cpu: 1000m
Expand Down

0 comments on commit a02e59e

Please sign in to comment.