Skip to content

Commit de64f48

Browse files
Merge pull request #57 from d4rkstar/issue_120
fix: better pdb deploy for etcd
2 parents 856f9b1 + a388153 commit de64f48

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

nuvolaris/etcd.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import logging
2626
import kopf
2727

28+
from nuvolaris.util import get_etcd_replica
29+
30+
2831
def create(owner=None):
2932
logging.info("create etcd")
3033
data = util.get_etcd_config_data()
@@ -34,9 +37,14 @@ def create(owner=None):
3437
if(data['affinity'] or data['tolerations']):
3538
tplp.append("affinity-tolerance-sts-core-attach.yaml")
3639

40+
spec_templates = []
41+
replicas = get_etcd_replica()
42+
if replicas > 1:
43+
spec_templates.append("etcd-policy.yaml")
44+
3745
kust = kus.patchTemplates("etcd",tplp , data)
3846
kust += kus.patchGenericEntry("Secret","nuvolaris-etcd-secret","/data/rootPassword",util.b64_encode(data['root_password']))
39-
spec = kus.kustom_list("etcd", kust, templates=[], data=data)
47+
spec = kus.kustom_list("etcd", kust, templates=spec_templates, data=data)
4048

4149
if owner:
4250
kopf.append_owner_reference(spec['items'], owner)

nuvolaris/kustomize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def restricted_kustomize(where, *what, templates=[], templates_filter=[],data={}
120120
continue
121121
if file in templates_filter:
122122
f.write(f"- {file}\n")
123-
# adding extra temmplatized resources
123+
# adding extra templatized resources
124124
for template in templates:
125125
out = f"deploy/{where}/__{template}"
126126
file = ntp.spool_template(template, out, data)
File renamed without changes.

0 commit comments

Comments
 (0)