github.com/kubeshop/testkube@v1.17.23/config/job-container-template.yml (about)

     1  apiVersion: batch/v1
     2  kind: Job
     3  metadata:
     4    name: "{{ .Name }}"
     5    namespace: {{ .Namespace }}
     6  spec:
     7    {{- if gt .ActiveDeadlineSeconds 0 }}
     8    activeDeadlineSeconds: {{ .ActiveDeadlineSeconds }}
     9    {{- end }}
    10    template:
    11      spec:
    12        {{- if ne .InitImage "" }}
    13        initContainers:
    14        - name: {{ .Name }}-init
    15          {{- if .Registry }}
    16          image: {{ .Registry }}/{{ .InitImage }}
    17          {{- else }}
    18          image: {{ .InitImage }}
    19          {{- end }}
    20          imagePullPolicy: IfNotPresent
    21          command:
    22            - "/bin/runner"
    23            - '{{ .Jsn }}'
    24          volumeMounts:
    25          - name: data-volume
    26            mountPath: /data
    27          {{- if .CertificateSecret }}
    28          - name: {{ .CertificateSecret }}
    29            mountPath: /etc/certs
    30          {{- end }}
    31          {{- if .ArtifactRequest }}
    32            {{- if and .ArtifactRequest.VolumeMountPath (or .ArtifactRequest.StorageClassName .ArtifactRequest.UseDefaultStorageClassName) }}
    33          - name: artifact-volume
    34            mountPath: {{ .ArtifactRequest.VolumeMountPath }}
    35            {{- end }}
    36          {{- end }}
    37          {{- range $configmap := .EnvConfigMaps }}
    38          {{- if and $configmap.Mount $configmap.Reference }}
    39          - name: {{ $configmap.Reference.Name }}
    40            mountPath: {{ $configmap.MountPath }}
    41          {{- end }}
    42          {{- end }}
    43          {{- range $secret := .EnvSecrets }}
    44          {{- if and $secret.Mount $secret.Reference }}
    45          - name: {{ $secret.Reference.Name }}
    46            mountPath: {{ $secret.MountPath }}
    47          {{- end }}
    48          {{- end }}
    49        {{- end }}
    50        containers:
    51        {{ if .Features.LogsV2 -}}
    52         - name: "{{ .Name }}-logs"
    53          {{- if .Registry }}
    54          image: {{ .Registry }}/{{ .LogSidecarImage }}
    55          {{- else }}
    56          image: {{ .LogSidecarImage }}
    57          {{- end }}
    58          imagePullPolicy: IfNotPresent
    59          env:
    60          - name: POD_NAME
    61            valueFrom:
    62              fieldRef:
    63                fieldPath: metadata.name
    64          - name: DEBUG
    65            value: {{ if .Debug }}"true"{{ else }}"false"{{ end }}
    66          - name: NAMESPACE
    67            value: {{ .Namespace }}
    68          - name: NATS_URI
    69            value: {{ .NatsUri }}
    70          - name: GROUP
    71            value: test
    72          - name: SOURCE
    73            value: "job-pod:{{ .Name }}"
    74          - name: ID
    75            value: "{{ .Name }}"
    76        {{- end }}
    77        - name: "{{ .Name }}"
    78          {{- if .Registry }}
    79          image: {{ .Registry }}/{{ .Image }}
    80          {{- else }}
    81          image: {{ .Image }}
    82          {{- end }}
    83          imagePullPolicy: IfNotPresent
    84          {{- if gt (len .Command) 0 }}
    85          command:
    86          {{- range $cmd := .Command }}
    87          - {{ $cmd -}}
    88          {{- end }}
    89          {{- end -}}
    90          {{- if gt (len .Args) 0 }}
    91          args:
    92          {{- range $arg := .Args }}
    93          - {{ $arg -}}
    94          {{- end }}
    95          {{- end }}
    96          {{- if .WorkingDir }}
    97          workingDir: {{ .WorkingDir }}
    98          {{- end }}
    99          volumeMounts:
   100          - name: data-volume
   101            mountPath: /data
   102          {{- if .CertificateSecret }}
   103          - name: {{ .CertificateSecret }}
   104            mountPath: /etc/certs
   105          {{- end }}
   106          {{- if .AgentAPITLSSecret }}
   107          - mountPath: /tmp/agent-cert
   108            readOnly: true
   109            name: {{ .AgentAPITLSSecret }}
   110          {{- end }}
   111          {{- if .ArtifactRequest }}
   112            {{- if and .ArtifactRequest.VolumeMountPath (or .ArtifactRequest.StorageClassName .ArtifactRequest.UseDefaultStorageClassName) }}
   113          - name: artifact-volume
   114            mountPath: {{ .ArtifactRequest.VolumeMountPath }}
   115            {{- end }}
   116          {{- end }}
   117          {{- range $configmap := .EnvConfigMaps }}
   118          {{- if and $configmap.Mount $configmap.Reference }}
   119          - name: {{ $configmap.Reference.Name }}
   120            mountPath: {{ $configmap.MountPath }}
   121          {{- end }}
   122          {{- end }}
   123          {{- range $secret := .EnvSecrets }}
   124          {{- if and $secret.Mount $secret.Reference }}
   125          - name: {{ $secret.Reference.Name }}
   126            mountPath: {{ $secret.MountPath }}
   127          {{- end }}
   128          {{- end }}
   129        volumes:
   130        - name: data-volume
   131          emptyDir: {}
   132        {{- if .CertificateSecret }}
   133        - name: {{ .CertificateSecret }}
   134          secret:
   135            secretName: {{ .CertificateSecret }}
   136        {{- end }}
   137        {{- if .AgentAPITLSSecret }}
   138        - name: { { .AgentAPITLSSecret } }
   139          secret:
   140            secretName: {{ .AgentAPITLSSecret }}
   141        {{- end }}
   142        {{- if .ArtifactRequest }}
   143          {{- if and .ArtifactRequest.VolumeMountPath (or .ArtifactRequest.StorageClassName .ArtifactRequest.UseDefaultStorageClassName) }}
   144        - name: artifact-volume
   145          persistentVolumeClaim:
   146            claimName: {{ .Name }}-pvc
   147          {{- end }}
   148        {{- end }}
   149        {{- range $configmap := .EnvConfigMaps }}
   150        {{- if and $configmap.Mount $configmap.Reference }}
   151        - name: {{ $configmap.Reference.Name }}
   152          configmap:
   153            name: {{ $configmap.Reference.Name }}
   154        {{- end }}
   155        {{- end }}
   156        {{- range $secret := .EnvSecrets }}
   157        {{- if and $secret.Mount $secret.Reference }}
   158        - name: {{ $secret.Reference.Name }}
   159          secret:
   160            secretName: {{ $secret.Reference.Name }}
   161        {{- end }}
   162        {{- end }}
   163        restartPolicy: Never
   164        {{- if .ServiceAccountName }}
   165        serviceAccountName: {{.ServiceAccountName }}
   166        {{- end }}
   167        {{- if gt (len .ImagePullSecrets) 0 }}
   168        imagePullSecrets:
   169        {{- range $secret := .ImagePullSecrets }}
   170        - name: {{ $secret -}}
   171        {{- end }}
   172        {{- end }}
   173    backoffLimit: 0
   174    ttlSecondsAfterFinished: {{ .DelaySeconds }}