diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/flufigut.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/flufigut.py b/src/flufigut.py index 7117318..c8c073b 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -693,9 +693,9 @@ class K8sDeployment: if e.status == 404: pass - def __generate_object(self, tmpl_env, template_file, worker=None): + def __generate_object(self, tmpl_env, template_file, deploy={}): tmpl = tmpl_env.get_template(template_file + '.j2') - object_yaml = tmpl.render(namespace=self._namespace, desc=self._desc, planet=self._planet, worker=worker) + object_yaml = tmpl.render(namespace=self._namespace, desc=self._desc, planet=self._planet, deploy=deploy) return yaml.load(object_yaml) def _deploy_flumotion_manager(self, template_dir, tmpl_env, v1, appsV1): @@ -714,15 +714,15 @@ class K8sDeployment: appsV1.create_namespaced_deployment(self._namespace, deploy) def _deploy_flumotion_worker(self, template_dir, tmpl_env, v1, appsV1, worker): - secret = self.__generate_object(tmpl_env, 'flumotion-worker-secret.yml', worker) + secret = self.__generate_object(tmpl_env, 'flumotion-worker-secret.yml', {'worker': worker}) secret['data']['password'] = base64.b64encode(worker['password'].encode('utf-8')).decode('ascii') v1.create_namespaced_secret(self._namespace, secret) if 'port' in worker['flags']: - svc = self.__generate_object(tmpl_env, 'flumotion-worker-svc.yml', worker) + svc = self.__generate_object(tmpl_env, 'flumotion-worker-svc.yml', {'worker': worker}) v1.create_namespaced_service(self._namespace, svc) - deploy = self.__generate_object(tmpl_env, 'flumotion-worker-deploy.yml', worker) + deploy = self.__generate_object(tmpl_env, 'flumotion-worker-deploy.yml', {'worker': worker}) appsV1.create_namespaced_deployment(self._namespace, deploy) def _deploy_nginx_worker(self, template_dir, tmpl_env, v1, appsV1, worker): @@ -735,13 +735,13 @@ class K8sDeployment: if not needs_nginx: return - cm = self.__generate_object(tmpl_env, 'nginx-streamer-cm.yml', worker) + cm = self.__generate_object(tmpl_env, 'nginx-streamer-cm.yml', {'worker': worker}) v1.create_namespaced_config_map(self._namespace, cm) - svc = self.__generate_object(tmpl_env, 'nginx-streamer-svc.yml', worker) + svc = self.__generate_object(tmpl_env, 'nginx-streamer-svc.yml', {'worker': worker}) v1.create_namespaced_service(self._namespace, svc) - deploy = self.__generate_object(tmpl_env, 'nginx-streamer-deploy.yml', worker) + deploy = self.__generate_object(tmpl_env, 'nginx-streamer-deploy.yml', {'worker': worker}) appsV1.create_namespaced_deployment(self._namespace, deploy) def _deploy_sfive_worker(self, template_dir, tmpl_env, v1, appsV1, worker): @@ -749,7 +749,7 @@ class K8sDeployment: return self.__has_sfive = True - cm = self.__generate_object(tmpl_env, 'sfive-cm.yml', worker) + cm = self.__generate_object(tmpl_env, 'sfive-cm.yml', {'worker': worker}) if 'data' not in cm or not cm['data']: cm['data'] = {} if worker['flags']['sfive'] == 'proxy' and 'stream' in worker['flags']: @@ -761,7 +761,7 @@ class K8sDeployment: v1.create_namespaced_config_map(self._namespace, cm) - deploy = self.__generate_object(tmpl_env, 'sfive-deploy.yml', worker) + deploy = self.__generate_object(tmpl_env, 'sfive-deploy.yml', {'worker': worker}) appsV1.create_namespaced_deployment(self._namespace, deploy) def _deploy_onionbalance(self, template_dir, tmpl_env, v1, appsV1, rbacV1): @@ -778,7 +778,7 @@ class K8sDeployment: v1.create_namespaced_secret(self._namespace, secret) worker = self._planet.workers[self._desc.globals['deployment']['parameter']['onionbalance_worker']] - deploy = self.__generate_object(tmpl_env, 'onionbalance-deploy.yml', worker) + deploy = self.__generate_object(tmpl_env, 'onionbalance-deploy.yml', {'worker': worker}) appsV1.create_namespaced_deployment(self._namespace, deploy) def deploy(self, template_dir): |