示例#1
0
 def generate_pod_spec(self, image_name):
     return client.V1PodSpec(
         containers=[
             client.V1Container(
                 name='kaniko',
                 image='gcr.io/kaniko-project/executor:v0.7.0',
                 volume_mounts=[
                     client.V1VolumeMount(
                         name='kaniko-secret',
                         mount_path='/secret',
                     )
                 ],
                 args=[
                     "--dockerfile=Dockerfile",
                     "--destination=" + image_name,
                     "--context=" + self.uploaded_context_url
                 ],
                 env=[
                     client.V1EnvVar(
                         name=constants.GOOGLE_CREDS_ENV,
                         value='/secret/kaniko-secret',
                     )
                 ],
             )
         ],
         volumes=[
             client.V1Volume(
                 name='kaniko-secret',
                 secret=client.V1SecretVolumeSource(
                     secret_name=self.created_secret.metadata.name, ),
             )
         ],
         restart_policy='Never')
示例#2
0
 def generate_pod_spec(self, image_name, push):
     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):
        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='gcr.io/kaniko-project/executor:v0.7.0',
                args=[
                    "--dockerfile=Dockerfile", "--destination=" + image_name,
                    "--context=" + self.uploaded_context_url
                ],
                env=[client.V1EnvVar(name='AWS_REGION', value=self.region)])
        ],
                                restart_policy='Never')