Documentation ¶
Overview ¶
Example (Full) ¶
package main import ( "embed" "os" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/ptr" testlog "knative.dev/reconciler-test/pkg/logging" "knative.dev/reconciler-test/pkg/manifest" "knative.dev/eventing/test/rekt/resources/jobsink" ) //go:embed *.yaml var yaml embed.FS func main() { ctx := testlog.NewContext() images := map[string]string{} cfg := map[string]interface{}{ "name": "foo", "namespace": "bar", } jobsink.WithJob(batchv1.Job{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{}, Spec: batchv1.JobSpec{ Parallelism: ptr.Int32(1), Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ {Name: "job-c"}, }, }, }, }, })(cfg) files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: sinks.knative.dev/v1alpha1 kind: JobSink metadata: name: foo namespace: bar spec: job: metadata: creationTimestamp: null spec: parallelism: 1 template: metadata: creationTimestamp: null spec: containers: - name: job-c resources: {} status: {}
Example (Min) ¶
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", } files, err := manifest.ExecuteYAML(ctx, yaml, images, cfg) if err != nil { panic(err) } manifest.OutputYAML(os.Stdout, files) }
Output: apiVersion: sinks.knative.dev/v1alpha1 kind: JobSink metadata: name: foo namespace: bar spec:
Index ¶
- func Address(ctx context.Context, name string, timings ...time.Duration) (*duckv1.Addressable, error)
- func AsDestinationRef(name string) *duckv1.Destination
- func AsKReference(name string) *duckv1.KReference
- func GVR() schema.GroupVersionResource
- func GoesReadySimple(name string) *feature.Feature
- func Install(name string, opts ...manifest.CfgFn) feature.StepFn
- func IsAddressable(name string, timings ...time.Duration) feature.StepFn
- func IsNotReady(name string, timing ...time.Duration) feature.StepFn
- func IsReady(name string, timing ...time.Duration) feature.StepFn
- func ValidateAddress(name string, validate addressable.ValidateAddressFn, timings ...time.Duration) feature.StepFn
- func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn
- func WithForwarderJob(sink string, options ...func(*batchv1.Job)) manifest.CfgFn
- func WithJob(job batchv1.Job) manifest.CfgFn
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Address ¶
func Address(ctx context.Context, name string, timings ...time.Duration) (*duckv1.Addressable, error)
Address returns a JobSink's address.
func AsDestinationRef ¶
func AsDestinationRef(name string) *duckv1.Destination
func AsKReference ¶
func AsKReference(name string) *duckv1.KReference
AsKReference returns a KReference for a JobSink without namespace.
func GVR ¶
func GVR() schema.GroupVersionResource
func GoesReadySimple ¶ added in v0.43.0
GoesReadySimple returns a feature that will create a JobSink with a simple sink and confirm it becomes ready with an address.
func IsAddressable ¶
IsAddressable tests to see if a JobSink becomes addressable within the time given.
func IsNotReady ¶
IsNotReady tests to see if a JobSink becomes NotReady within the time given.
func ValidateAddress ¶
func ValidateAddress(name string, validate addressable.ValidateAddressFn, timings ...time.Duration) feature.StepFn
ValidateAddress validates the address retured by Address
func WithAnnotations ¶
WithAnnotations adds annotations to the JobSink.
func WithForwarderJob ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.