def install_release(self, chart, namespace, dry_run=False, name=None, values=None, wait=False, disable_hooks=False, reuse_name=False, disable_crd_hook=False, description=""): """ Create a Helm Release """ values = Config(raw=yaml.safe_dump(values or {})) stub = ReleaseServiceStub(self._channel) release_request = InstallReleaseRequest( chart=chart, dry_run=dry_run, values=values, name=name or '', namespace=namespace, wait=wait, disable_hooks=disable_hooks, reuse_name=reuse_name, disable_crd_hook=disable_crd_hook, description=description) return stub.InstallRelease(release_request, self._timeout, metadata=self.metadata)
def install_release(self, chart, release, namespace, values=None, wait=False, timeout=None): ''' Create a Helm Release ''' timeout = self._check_timeout(wait, timeout) LOG.info('Helm install release%s: wait=%s, timeout=%s', (' (dry run)' if self.dry_run else ''), wait, timeout) if values is None: values = Config(raw='') else: values = Config(raw=values) # build release install request try: stub = ReleaseServiceStub(self.channel) release_request = InstallReleaseRequest( chart=chart, dry_run=self.dry_run, values=values, name=release, namespace=namespace, wait=wait, timeout=timeout) install_msg = stub.InstallRelease( release_request, timeout + GRPC_EPSILON, metadata=self.metadata) tiller_result = TillerResult( install_msg.release.name, install_msg.release.namespace, install_msg.release.info.status.Code.Name( install_msg.release.info.status.code), install_msg.release.info.Description, install_msg.release.version) return tiller_result except Exception: LOG.exception('Error while installing release %s', release) status = self.get_release_status(release) raise ex.ReleaseException(release, status, 'Install')
def install_release( self, chart, namespace, dry_run=False, name=None, values=None, wait=False, disable_hooks=False, reuse_name=False, disable_crd_hook=False, description="", ): """ Create a Helm Release """ if values: f = io.StringIO() yaml.dump(values, f) f.seek(0) raw = f.read() else: raw = "" values = Config(raw=raw) stub = ReleaseServiceStub(self._channel) release_request = InstallReleaseRequest( chart=chart, dry_run=dry_run, values=values, name=name or "", namespace=namespace, wait=wait, disable_hooks=disable_hooks, reuse_name=reuse_name, disable_crd_hook=disable_crd_hook, description=description, ) return stub.InstallRelease(release_request, self._timeout, metadata=self.metadata)
def get_chart_templates(self, template_name, name, release_name, namespace, chart, disable_hooks, values): # returns some info LOG.info("Template( %s ) : %s ", template_name, name) stub = ReleaseServiceStub(self.channel) release_request = InstallReleaseRequest(chart=chart, dry_run=True, values=values, name=name, namespace=namespace, wait=False) templates = stub.InstallRelease(release_request, self.timeout, metadata=self.metadata) for template in yaml.load_all( getattr(templates.release, 'manifest', [])): if template_name == template.get('metadata', None).get('name', None): LOG.info(template_name) return template
def install_release(self, chart, namespace, dry_run=False, name=None, values=None, wait=False, disable_hooks=False, reuse_name=False, disable_crd_hook=False, overrides=[], description="", chartbuilder=None): """ Prepare overrides, note it only supports one file at the moment """ standard_values = {} if overrides is not None and chartbuilder is not None: standard_values = yaml.safe_load(chartbuilder.get_values().raw) for file in overrides: standard_values.update(yaml.safe_load(file.value)) """ Create a Helm Release """ # now this is where it gets tricky # since the overrides are appended 'left to right' # the later mappings override the standard values in `values.yaml` # the standard helm client does something similar but this 'works' (and is a kludge) values = Config(raw=yaml.safe_dump(standard_values)) stub = ReleaseServiceStub(self._channel) release_request = InstallReleaseRequest( chart=chart, dry_run=dry_run, values=values, name=name or '', namespace=namespace, wait=wait, disable_hooks=disable_hooks, reuse_name=reuse_name, disable_crd_hook=disable_crd_hook, description=description) return stub.InstallRelease(release_request, self._timeout, metadata=self.metadata)