Пример #1
0
    def generate_pod_spec(self, image_name, push):  # pylint:disable=arguments-differ
        args = [
            "--dockerfile=Dockerfile", "--destination=" + image_name,
            "--context=" + self.uploaded_context_url
        ]
        if not push:
            args.append("--no-push")

        return client.V1PodSpec(containers=[
            client.V1Container(
                name='kaniko',
                image=constants.KANIKO_IMAGE,
                args=args,
                env=[client.V1EnvVar(name='AWS_REGION', value=self.region)])
        ],
                                restart_policy='Never')
Пример #2
0
    def generate_pod_spec(self, image_name, push):  # pylint:disable=arguments-differ
        args = [
            "--dockerfile=Dockerfile", "--destination=" + image_name,
            "--context=" + self.uploaded_context_url, "--cache=true"
        ]
        if not push:
            args.append("--no-push")

        return client.V1PodSpec(containers=[
            client.V1Container(
                name='kaniko',
                image='gcr.io/kaniko-project/executor:v0.7.0',
                args=args,
            )
        ],
                                restart_policy='Never')
Пример #3
0
    def generate_pod_spec(self, image_name, push):  # pylint: disable=arguments-differ
        """
        :param image_name: name of image to be built
        :param push: whether to push image to given registry or not
        """
        args = [
            "--dockerfile=Dockerfile", "--destination=" + image_name,
            "--context=" + self.uploaded_context_url
        ]
        if not push:
            args.append("--no-push")

        return client.V1PodSpec(
            containers=[
                client.V1Container(
                    name='kaniko',
                    image=constants.constants.KANIKO_IMAGE,
                    args=[
                        "--dockerfile=Dockerfile",
                        "--destination=" + image_name,
                        "--context=" + self.uploaded_context_url
                    ],
                    env=[
                        client.V1EnvVar(name='AWS_REGION',
                                        value=self.region_name),
                        client.V1EnvVar(name='AWS_ACCESS_KEY_ID',
                                        value=self.minio_secret),
                        client.V1EnvVar(name='AWS_SECRET_ACCESS_KEY',
                                        value=self.minio_secret_key),
                        client.V1EnvVar(name='S3_ENDPOINT',
                                        value=self.endpoint_url),
                        client.V1EnvVar(name='S3_FORCE_PATH_STYLE',
                                        value="true")
                    ],
                    volume_mounts=[
                        client.V1VolumeMount(name="docker-config",
                                             mount_path="/kaniko/.docker/")
                    ],
                )
            ],
            restart_policy='Never',
            volumes=[
                client.V1Volume(name="docker-config",
                                config_map=client.V1ConfigMapVolumeSource(
                                    name="docker-config"))
            ])