Skip to content

Commit

Permalink
fixup! Add function performing replacements in matching Image, Contai…
Browse files Browse the repository at this point in the history
…ner and Kubernetes components
  • Loading branch information
rm3l committed Apr 25, 2023
1 parent 66b92a9 commit a643206
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions pkg/devfile/imageNameSelector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ func buildInlinedK8sResource(imageName, crImageName string) string {
buildDaemonSetManifest(imageName),
buildDeploymentManifest(imageName),
buildJobManifest(imageName),
buildCronJobManifest(imageName),
buildReplicaSetManifest(imageName),
buildReplicationControllerManifest(imageName),
buildStatefulSetManifest(imageName),
Expand Down Expand Up @@ -539,6 +540,42 @@ status: {}
`, image))
}

func buildCronJobManifest(image string) string {
return strings.TrimSpace(fmt.Sprintf(`
apiVersion: batch/v1
kind: CronJob
metadata:
creationTimestamp: null
name: my-cron-job
spec:
jobTemplate:
metadata:
creationTimestamp: null
spec:
template:
metadata:
creationTimestamp: null
name: my-app
spec:
containers:
- image: %[1]s
name: my-main-cont1
resources: {}
- image: my-other-image
name: my-main-cont1
resources: {}
initContainers:
- image: %[1]s
name: my-init-cont1
resources: {}
- image: my-init-container-image
name: my-init-cont2
resources: {}
schedule: '*/1 * * * *'
status: {}
`, image))
}

func buildReplicaSetManifest(image string) string {
return strings.TrimSpace(fmt.Sprintf(`
apiVersion: apps/v1
Expand Down

0 comments on commit a643206

Please sign in to comment.