job

package
v0.34.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Example
package main

import (
	"embed"
	"os"

	testlog "knative.dev/reconciler-test/pkg/logging"
	"knative.dev/reconciler-test/pkg/manifest"
)

//go:embed *.yaml
var yaml embed.FS

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":      "foo",
		"namespace": "bar",
		"image":     "gcr.io/knative-samples/helloworld-go",
	}

	files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg)

	if err != nil {
		panic(err)
	}

	manifest.OutputYAML(os.Stdout, files)
}
Output:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: foo
  namespace: bar
spec:
  schedule: "* * * * *"
  jobTemplate:
    metadata:
      labels:
        app: foo
    spec:
      template:
        spec:
          containers:
          - name: user-container
            image: gcr.io/knative-samples/helloworld-go
            imagePullPolicy: IfNotPresent
            env:
            - name: ONE_SHOT
              value: "true"
            - name: POD_NAME
              value: heartbeats
            - name: POD_NAMESPACE
              value: bar
          restartPolicy: Never

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsTrackerReference

func AsTrackerReference(name string) *tracker.Reference

AsTrackerReference returns a tracker.Reference for a Job without namespace.

func Install

func Install(name string) feature.StepFn

Install will create a Job with defaults that can be overwritten by the With* methods.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL