kafkasink

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Example (Full)
package main

import (
	"os"

	eventingv1alpha1 "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/eventing/v1alpha1"
	"knative.dev/eventing-kafka-broker/test/e2e_new/resources/kafkasink"

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

func main() {
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":             "foo",
		"namespace":        "bar",
		"topic":            "my-topic",
		"bootstrapServers": []string{"my-bootstrap-server:8082"},
	}
	kafkasink.WithContentMode(eventingv1alpha1.ModeBinary)(cfg)
	kafkasink.WithReplicationFactor(3)(cfg)
	kafkasink.WithNumPartitions(10)(cfg)
	kafkasink.WithAuthSecretName("abc")(cfg)

	files, err := manifest.ExecuteLocalYAML(images, cfg)
	if err != nil {
		panic(err)
	}

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

apiVersion: eventing.knative.dev/v1alpha1
kind: KafkaSink
metadata:
  name: foo
  namespace: bar
spec:
  topic: "my-topic"
  bootstrapServers:
    - "my-bootstrap-server:8082"
  contentMode: binary
  numPartitions: 10
  replicationFactor: 3
  auth:
    secret:
      ref:
        name: abc
Example (Zero)
package main

import (
	"os"

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

func main() {
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name":             "foo",
		"namespace":        "bar",
		"topic":            "my-topic",
		"bootstrapServers": []string{"my-bootstrap-server:8082"},
	}

	files, err := manifest.ExecuteLocalYAML(images, cfg)
	if err != nil {
		panic(err)
	}

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

apiVersion: eventing.knative.dev/v1alpha1
kind: KafkaSink
metadata:
  name: foo
  namespace: bar
spec:
  topic: "my-topic"
  bootstrapServers:
    - "my-bootstrap-server:8082"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(name, topic, bootstrapServers []string, opts ...manifest.CfgFn) feature.StepFn

Install will create a Trigger resource, augmented with the config fn options.

func IsReady

func IsReady(name string, timing ...time.Duration) feature.StepFn

IsReady tests to see if a Trigger becomes ready within the time given.

func WithAuthSecretName

func WithAuthSecretName(name string) manifest.CfgFn

WithAuthSecretName adds the auth secret name

func WithContentMode

func WithContentMode(contentMode string) manifest.CfgFn

WithContentMode adds the content mode

func WithNumPartitions

func WithNumPartitions(numPartitions int32) manifest.CfgFn

WithNumPartitions adds the num of partitions

func WithReplicationFactor

func WithReplicationFactor(replicationFactor int16) manifest.CfgFn

WithReplicationFactor adds the replication factor

Types

This section is empty.

Jump to

Keyboard shortcuts

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