apiVersion: batch/v1 kind: CronJob metadata: name: newrelic-testjob namespace: newrelic spec: schedule: "10 10 * * *" # Running the cron at the 10 minute of 10th hour everyday jobTemplate: spec: activeDeadlineSeconds: 900 # timeout after 15 minutes template: spec: # serviceAccount: newrelic-testjob-service-account # initContainers: # - name: kubectl # image: bitnami/kubectl # command: ['sh', '-c', "while [[$(kubectl get pods -l app.kubernetes.io/name=nri-metadata-injection -o 'jsonpath={..status.conditions[?(@.type==\"Running\")].status}') != \"True\" ]]; do echo \"waiting to init\"; sleep 10; done"] containers: - name: test-container image: golang:latest command: [ "bash", "-c", "--"] args: - >- sleep 300; export NR_LICENSE_KEY=$(cat /tmp/newrelic-licensekey/newrelic-licensekey); export NR_ACCOUNT=$(cat /tmp/newrelic-account/newrelic-account); export NR_API_KEY=$(cat /tmp/newrelic-apikey/newrelic-apikey); git clone https://github.com/newrelic/newrelic-integration-e2e-action.git; cd newrelic-integration-e2e-action; go run main.go -account_id=$NR_ACCOUNT -agent_enabled=false -api_key=$NR_API_KEY -license_key=$NR_LICENSE_KEY -region="US" -spec_path=/tmp/configmaps/test-spec.yml -scenario_tag=$HOSTNAME --retry_attempts=1 --retry_seconds=5 -verbose_mode=true; volumeMounts: - name: newrelic-licensekey mountPath: "/tmp/newrelic-licensekey" readOnly: true - name: newrelic-account mountPath: "/tmp/newrelic-account" readOnly: true - name: newrelic-apikey mountPath: "/tmp/newrelic-apikey" readOnly: true - name: test-spec-volume mountPath: /tmp/configmaps restartPolicy: Never volumes: - name: newrelic-licensekey secret: secretName: newrelic-secret items: - key: newrelic-licensekey path: newrelic-licensekey - name: newrelic-account secret: secretName: newrelic-secret items: - key: newrelic-account path: newrelic-account - name: newrelic-apikey secret: secretName: newrelic-secret items: - key: newrelic-apikey path: newrelic-apikey - name: test-spec-volume configMap: name: test-spec