示例#1
0
    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,
        )
示例#2
0
    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,
        )
示例#3
0
    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,
        )
示例#4
0
    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,
        )
示例#5
0
文件: packager.py 项目: retr0h/kindly
    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,
        )
示例#6
0
    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,
        )
示例#7
0
    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,
        )
示例#8
0
    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]