From 8c468b359bff1fd3f5f25a8cbf47cbb896ee06d8 Mon Sep 17 00:00:00 2001 From: Mark Burnett Date: Fri, 26 Jan 2018 10:14:02 -0600 Subject: [PATCH] Add ability to specify target-manifest for Armada Change-Id: Ica00512062fb19ae395544c254de517fe0161e12 --- docs/source/configuration/genesis.rst | 10 ++++++++++ examples/basic/Genesis.yaml | 2 ++ examples/complete/Genesis.yaml | 2 ++ promenade/config.py | 8 +++----- promenade/schemas/Genesis.yaml | 7 +++++++ .../etc/kubernetes/manifests/bootstrap-armada.yaml | 6 +++++- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/docs/source/configuration/genesis.rst b/docs/source/configuration/genesis.rst index 58ba3c17..bb6359d9 100644 --- a/docs/source/configuration/genesis.rst +++ b/docs/source/configuration/genesis.rst @@ -23,6 +23,8 @@ Here is a complete sample document: data: hostname: n0 ip: 192.168.77.10 + armada: + target_manifest: cluster-bootstrap labels: static: - calico-etcd=enabled @@ -49,6 +51,14 @@ Here is a complete sample document: mode: 0644 +Amrada +------ + +This section contains particular configuration options for bootstrapping with +Armada. It currently only supports a single option: ``target_manifest``, which +specifies which ``armada/Manifest/v1`` to be used during Genesis. + + Bootstrapping Images -------------------- diff --git a/examples/basic/Genesis.yaml b/examples/basic/Genesis.yaml index 328e23ff..88fb2a2e 100644 --- a/examples/basic/Genesis.yaml +++ b/examples/basic/Genesis.yaml @@ -9,6 +9,8 @@ metadata: data: hostname: n0 ip: 192.168.77.10 + armada: + target_manifest: cluster-bootstrap labels: dynamic: - calico-etcd=enabled diff --git a/examples/complete/Genesis.yaml b/examples/complete/Genesis.yaml index 8a5f5a1c..df1254b8 100644 --- a/examples/complete/Genesis.yaml +++ b/examples/complete/Genesis.yaml @@ -10,6 +10,8 @@ metadata: data: hostname: n0 ip: 192.168.77.10 + armada: + target_manifest: cluster-bootstrap labels: dynamic: - calico-etcd=enabled diff --git a/promenade/config.py b/promenade/config.py index 62b32749..837b5738 100644 --- a/promenade/config.py +++ b/promenade/config.py @@ -55,11 +55,9 @@ class Configuration: return cls(documents=documents, **kwargs) def __getitem__(self, path): - value = self.get_path(path) - if value: - return value - else: - return jinja2.StrictUndefined('No match found for path %s' % path) + return self.get_path(path, + jinja2.StrictUndefined( + 'No match found for path %s' % path)) def get_first(self, *paths): result = self._get_first(*paths) diff --git a/promenade/schemas/Genesis.yaml b/promenade/schemas/Genesis.yaml index 17d18ecf..f9286558 100644 --- a/promenade/schemas/Genesis.yaml +++ b/promenade/schemas/Genesis.yaml @@ -57,6 +57,13 @@ data: type: object properties: + armada: + type: object + properties: + target_manifest: + type: string + additionalProperties: false + files: type: array items: diff --git a/promenade/templates/roles/genesis/etc/kubernetes/manifests/bootstrap-armada.yaml b/promenade/templates/roles/genesis/etc/kubernetes/manifests/bootstrap-armada.yaml index 48f1ead1..40d98329 100644 --- a/promenade/templates/roles/genesis/etc/kubernetes/manifests/bootstrap-armada.yaml +++ b/promenade/templates/roles/genesis/etc/kubernetes/manifests/bootstrap-armada.yaml @@ -59,7 +59,11 @@ spec: while true; do sleep 10 - if armada --debug apply --tiller-host 127.0.0.1 /etc/genesis/armada/assets/manifest.yaml &>> "${ARMADA_LOGFILE}"; then + if armada --debug \ + apply \ + --target-manifest {{ config.get_path('Genesis:armada.target_manifest', 'cluster-bootstrap') }} \ + --tiller-host 127.0.0.1 \ + /etc/genesis/armada/assets/manifest.yaml &>> "${ARMADA_LOGFILE}"; then break fi done