def get_helm_chart(self): ''' Return a helm chart object ''' if self._helm_chart: return self._helm_chart # dependencies # [process_chart(x, is_dependency=True) for x in chart.dependencies] dependencies = [] for chart in self.chart.dependencies: LOG.info("Building dependency chart %s for release %s", chart.name, self.chart.release_name) dependencies.append(ChartBuilder(chart).get_helm_chart()) helm_chart = Chart( metadata=self.get_metadata(), templates=self.get_templates(), dependencies=dependencies, values=self.get_values(), files=self.get_files(), ) self._helm_chart = helm_chart return helm_chart
def get_helm_chart(self): ''' Return a helm chart object ''' if self._helm_chart: return self._helm_chart dependencies = [] for chart in self.chart.get('dependencies', []): self._logger.info("Building dependency chart %s for release %s", chart.name, self.chart.name) dependencies.append(ChartBuilder(chart).get_helm_chart()) helm_chart = Chart( metadata=self.get_metadata(), templates=self.get_templates(), dependencies=dependencies, values=self.get_values(), files=self.get_files(), ) self._helm_chart = helm_chart return helm_chart
def get_helm_chart(self): ''' Return a helm chart object ''' if self._helm_chart: return self._helm_chart # dependencies # [process_chart(x, is_dependency=True) for x in chart.dependencies] dependencies = [] for dep in self.chart.dependencies: LOG.info("Building dependency chart %s for release %s", self.chart.chart_name, self.chart.release) try: dependencies.append(ChartBuilder(dep.chart).get_helm_chart()) except Exception: chart_name = self.chart.chart_name raise chartbuilder_exceptions.DependencyException(chart_name) try: helm_chart = Chart(metadata=self.get_metadata(), templates=self.get_templates(), dependencies=dependencies, values=self.get_values(), files=self.get_files()) except Exception: chart_name = self.chart.chart_name raise chartbuilder_exceptions.HelmChartBuildException(chart_name) self._helm_chart = helm_chart return helm_chart
def get_helm_chart(self): '''Return a Helm chart object. Constructs a :class:`hapi.chart.chart_pb2.Chart` object from the ``chart`` intentions, including all dependencies. ''' if self._helm_chart: return self._helm_chart dependencies = [] chart_dependencies = self.chart_data.get('dependencies', []) chart_name = self.chart['metadata']['name'] chart_release = self.chart_data.get('release', None) for dep_chart in chart_dependencies: dep_chart_name = dep_chart['metadata']['name'] LOG.info("Building dependency chart %s for release %s.", dep_chart_name, chart_release) try: dependencies.append(ChartBuilder(dep_chart).get_helm_chart()) except Exception: raise chartbuilder_exceptions.DependencyException(chart_name) try: helm_chart = Chart(metadata=self.get_metadata(), templates=self.get_templates(), dependencies=dependencies, values=self.get_values(), files=self.get_files()) except Exception as e: raise chartbuilder_exceptions.HelmChartBuildException(chart_name, details=e) self._helm_chart = helm_chart return helm_chart
def createChart(self): chart = ChartBuilder( {"name": self.chart_name, "source": { "type": self.source_type, "location": self.source_location } }) rawstring = chart.get_values() v = str(str(rawstring).split("raw: ",1)[1][1:][:-2].replace("\\n","\n")) ydata = yaml.safe_load(v) # print(ydata) ydata["host"] = "this.is.lit.local" newyaml = yaml.safe_dump(ydata) rawl = Config(raw=newyaml) dependencies = [] helm_chart = Chart( metadata=chart.get_metadata(), templates=chart.get_templates(), dependencies=dependencies, values=rawl, files=chart.get_files(), ) self.chart = helm_chart tiller = Tiller(self.tiller_host) tiller.install_release( self.chart, dry_run=False, namespace=self.kubernetes_namespace)
def _make_chart(self): return Chart(metadata=Metadata(description='chart description', name='chart_name', version='0.1.2'), templates=[ Template(name='template_name', data='template content'.encode()) ], files=[ Any(type_url='./file_name.ext', value='file content'.encode()) ], dependencies=[], values=Config(raw='{param: d1}'))
def build_chart(self): self._update_metadata() self._update_value() self._update_template() templates = self._get_templates() values = self._get_values() chart = Chart( templates=templates, values=values, metadata=self.chart_metadata, files=self.non_template_files, dependencies=self.dependencies, ) self._chart = chart return chart
def _get_helm_chart(self): LOG.info("Building chart %s from path %s", self.name, self.source_directory) dependencies = [] for dep_builder in self.dependency_builders: LOG.info("Building dependency chart %s for chart %s.", dep_builder.name, self.name) try: dependencies.append(dep_builder.get_helm_chart()) except Exception: raise chartbuilder_exceptions.DependencyException(self.name) try: helm_chart = Chart(metadata=self.get_metadata(), templates=self.get_templates(), dependencies=dependencies, values=self.get_values(), files=self.get_files()) except Exception as e: raise chartbuilder_exceptions.HelmChartBuildException(self.name, details=e) return helm_chart
def get_helm_chart(self): ''' Return a helm chart object 获取tiller所需的chart数据 Args: Returns: 返回tiller所需的chart对象 ''' if self._helm_chart: return self._helm_chart helm_chart = Chart( metadata=self.get_metadata(), templates=self.get_templates(), dependencies=self.get_dependencies(), values=self.get_values(), files=self.get_files(), ) self._helm_chart = helm_chart self.source_cleanup() return helm_chart