def update_objects(self): '''Apply changes to objects defined in the path on Kind cluster. ''' commands = [ 'kubectl', 'apply', '-f', self._deployment_spec.configs_path, ] util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, )
def create_namespace(self): '''Create a namespace in the current Kind cluster. ''' commands = [ 'kubectl', 'create', 'namespace', self._deployment_spec.packager_namespace, ] util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, )
def create_objects(self): '''Create objects defined in the path on Kind cluster. ''' commands = [ 'kubectl', 'create', '--save-config', '-f', self._deployment_spec.configs_path, ] util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, )
def delete(self): '''Delete a Kind cluster. ''' commands = [ 'kind', 'delete', 'cluster', '--name', self._deployment_spec.cluster_name, ] util.run( commands, stream=self._config.stream, debug=self._config.debug, env=self._config.env, )
def upgrade(self): '''Run Helm upgrade. ''' commands = [ 'helm', 'upgrade', '-n', self._deployment_spec.packager_namespace, self._deployment_spec.packager_name, self._deployment_spec.packager_chart, ] util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, )
def set_context(self): '''Sets `kubectl` context to current Kind cluster. ''' cluster_name = self._deployment_spec.cluster_name kube_context = f'kind-{cluster_name}' commands = [ 'kubectl', 'cluster-info', '--context', kube_context, ] util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, )
def load_image(self): '''Load image into cluster. ''' image = self._deployment_spec.image commands = [ 'kind', 'load', 'docker-image', '--name', self._deployment_spec.cluster_name, image, ] util.run( commands, stream=self._config.stream, debug=self._config.debug, env=self._config.env, )
def get(self): '''Returns list of all Kind clusters. ''' commands = [ 'kind', 'get', 'clusters', ] exit_code, output = util.run( commands, stream=False, debug=self._config.debug, env=self._config.env, ) return [l for l in output.split('\n') if l]