apiVersion: batch/v1 kind: Job metadata: name: @@JOB_NAME@@ namespace: nuthatch-testbed spec: activeDeadlineSeconds: 300 backoffLimit: 0 ttlSecondsAfterFinished: 300 template: spec: automountServiceAccountToken: false enableServiceLinks: false restartPolicy: Never dnsPolicy: None dnsConfig: nameservers: [10.96.0.53] searches: [nuthatch-testbed.svc.cluster.local, svc.cluster.local, cluster.local] options: - {name: ndots, value: "5"} initContainers: - name: postgres image: @@POSTGRES_IMAGE@@ imagePullPolicy: Never command: [/bin/sh, -ec] args: [psql "$NUTHATCH_PG_CONN" --set ON_ERROR_STOP=1 --command "CREATE TABLE lane_canary (value text NOT NULL)" --command "INSERT INTO lane_canary VALUES ('$NUTHATCH_FIXTURE_PROFILE')"] envFrom: - configMapRef: {name: @@PROFILE_NAME@@} resources: requests: {cpu: 25m, memory: 32Mi} limits: {cpu: "1", memory: 128Mi} - name: coordination image: @@COORDINATION_IMAGE@@ imagePullPolicy: Never command: [/bin/sh, -ec] args: [redis-cli -u "$NUTHATCH_REDIS_URL" SET lane-canary "$NUTHATCH_FIXTURE_PROFILE" >/dev/null && test "$(redis-cli -u "$NUTHATCH_REDIS_URL" GET lane-canary)" = "$NUTHATCH_FIXTURE_PROFILE"] envFrom: - configMapRef: {name: @@PROFILE_NAME@@} resources: requests: {cpu: 25m, memory: 32Mi} limits: {cpu: "1", memory: 128Mi} - name: oidc image: @@CURL_IMAGE@@ imagePullPolicy: Never command: [/bin/sh, -ec] args: - | discovery="$(curl --fail --silent --show-error "$NUTHATCH_OIDC_ISSUER/.well-known/openid-configuration")" printf '%s' "$discovery" | grep -F '"issuer"' >/dev/null envFrom: - configMapRef: {name: @@PROFILE_NAME@@} resources: requests: {cpu: 25m, memory: 32Mi} limits: {cpu: "1", memory: 128Mi} - name: target image: @@AWS_CLI_IMAGE@@ imagePullPolicy: Never command: [/bin/sh, -ec] args: - | export AWS_ACCESS_KEY_ID="$NUTHATCH_S3_ACCESS_KEY" export AWS_SECRET_ACCESS_KEY="$NUTHATCH_S3_SECRET_KEY" export AWS_DEFAULT_REGION="$NUTHATCH_S3_REGION" printf '%s\n' "$NUTHATCH_FIXTURE_PROFILE" >/tmp/input aws --endpoint-url "$NUTHATCH_S3_ENDPOINT" s3api put-object --bucket "$NUTHATCH_S3_BUCKET" --key lane-canary --body /tmp/input >/dev/null aws --endpoint-url "$NUTHATCH_S3_ENDPOINT" s3api get-object --bucket "$NUTHATCH_S3_BUCKET" --key lane-canary /tmp/output >/dev/null test "$(cat /tmp/input)" = "$(cat /tmp/output)" envFrom: - configMapRef: {name: @@PROFILE_NAME@@} resources: requests: {cpu: 25m, memory: 64Mi} limits: {cpu: "1", memory: 256Mi} containers: - name: profile image: @@TEST_IMAGE@@ imagePullPolicy: Never command: [/bin/sh, -ec] args: - | test -n "$NUTHATCH_FIXTURE_PROFILE" test "$NUTHATCH_S3_BUCKET" = "nuthatch-lane-$NUTHATCH_FIXTURE_LANE" case "$NUTHATCH_PG_CONN" in *"dbname=nuthatch_lane_$NUTHATCH_FIXTURE_LANE") ;; *) exit 1 ;; esac grep -Fx "NUTHATCH_FIXTURE_PROFILE=$NUTHATCH_FIXTURE_PROFILE" /run/nuthatch-fixture/profile.env grep -Fx "NUTHATCH_COORDINATION_PROVIDER=$NUTHATCH_COORDINATION_PROVIDER" /run/nuthatch-fixture/profile.env grep -Fx "NUTHATCH_OIDC_PROVIDER=$NUTHATCH_OIDC_PROVIDER" /run/nuthatch-fixture/profile.env grep -Fx "NUTHATCH_TARGET_PROVIDER=$NUTHATCH_TARGET_PROVIDER" /run/nuthatch-fixture/profile.env printf 'lane profile injection passed\n' envFrom: - configMapRef: {name: @@PROFILE_NAME@@} volumeMounts: - {name: fixture-profile, mountPath: /run/nuthatch-fixture, readOnly: true} resources: requests: {cpu: 25m, memory: 32Mi} limits: {cpu: "1", memory: 128Mi} volumes: - name: fixture-profile configMap: name: @@PROFILE_NAME@@-file items: - {key: profile.env, path: profile.env}