Skip to content

Commit

Permalink
Merge branch 'main' into remove_enabled_cloudsqlproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhny authored Aug 21, 2024
2 parents 14cdaa1 + 6972d7a commit 2eeebf7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/resourcegenerator/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,9 @@ func getJobSpec(skipJob *skiperatorv1alpha1.SKIPJob, selector *metav1.LabelSelec
Suspend: skipJob.Spec.Job.Suspend,
}

// it's not a default label, maybe it could be?
// used for selecting workloads by netpols, grafana etc
jobSpec.Template.Labels["app"] = skipJob.KindPostFixedName()

return jobSpec
}
25 changes: 24 additions & 1 deletion tests/skipjob/minimal-cron-job/skipjob-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ kind: CronJob
metadata:
name: minimal-cron-job
labels:
app: minimal-cron-job-skipjob
skiperator.kartverket.no/skipjob: "true"
skiperator.kartverket.no/skipjobName: minimal-cron-job
app.kubernetes.io/managed-by: "skiperator"
Expand All @@ -31,9 +30,33 @@ spec:
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
jobTemplate:
metadata:
labels:
skiperator.kartverket.no/skipjob: "true"
skiperator.kartverket.no/skipjobName: minimal-cron-job
app.kubernetes.io/managed-by: "skiperator"
skiperator.kartverket.no/controller: "skipjob"
spec:
template:
metadata:
labels:
app: minimal-cron-job-skipjob
spec:
containers:
- name: minimal-cron-job-skipjob
image: "perl:5.34.0"
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: minimal-cron-job-skipjob
app.kubernetes.io/managed-by: skiperator
skiperator.kartverket.no/controller: skipjob
skiperator.kartverket.no/skipjob: 'true'
skiperator.kartverket.no/skipjobName: minimal-cron-job
ownerReferences:
- apiVersion: batch/v1
kind: Job
controller: true
blockOwnerDeletion: true
18 changes: 17 additions & 1 deletion tests/skipjob/minimal-job/skipjob-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ kind: Job
metadata:
name: minimal-job
labels:
app: minimal-job-skipjob
skiperator.kartverket.no/skipjob: "true"
skiperator.kartverket.no/skipjobName: minimal-job
app.kubernetes.io/managed-by: "skiperator"
Expand All @@ -22,6 +21,7 @@ spec:
metadata:
labels:
job-name: minimal-job
app: minimal-job-skipjob
skiperator.kartverket.no/skipjob: "true"
skiperator.kartverket.no/skipjobName: minimal-job
app.kubernetes.io/managed-by: "skiperator"
Expand Down Expand Up @@ -50,3 +50,19 @@ spec:
seccompProfile:
type: RuntimeDefault
serviceAccountName: minimal-job-skipjob
---
apiVersion: v1
kind: Pod
metadata:
labels:
app: minimal-job-skipjob
app.kubernetes.io/managed-by: skiperator
batch.kubernetes.io/job-name: minimal-job
job-name: minimal-job
skiperator.kartverket.no/controller: skipjob
skiperator.kartverket.no/skipjob: 'true'
skiperator.kartverket.no/skipjobName: minimal-job
ownerReferences:
- apiVersion: batch/v1
kind: Job
name: minimal-job

0 comments on commit 2eeebf7

Please sign in to comment.