kafkacat

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example (Full)
ctx := testlog.NewContext()
images := map[string]string{}
cfg := map[string]interface{}{
	"name":      "foo",
	"namespace": "bar",
}

WithPayload("aplayload")(cfg)
WithBootstrapServer("baz")(cfg)
WithTopic("t1")(cfg)
WithKey("akey")(cfg)
WithHeaders(map[string]string{"ct": "xml", "other": "head"})(cfg)

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

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

apiVersion: v1
kind: ConfigMap
metadata:
  name: foo
  namespace: bar
data:
  payload: 'akey=aplayload'
---
apiVersion: v1
kind: Pod
metadata:
  name: foo
  namespace: bar
spec:
  containers:
  - image: docker.io/edenhill/kafkacat:1.6.0
    name: producer-container
    command:
    - kafkacat
    args:
    - "-P"
    - "-T"
    - "-b"
    - baz
    - "-t"
    - t1
    - "-K="
    - "-H"
    - "ct=xml"
    - "-H"
    - "other=head"
    - "-l"
    - "/etc/mounted/payload"
    volumeMounts:
      - name: event-payload
        mountPath: /etc/mounted
  restartPolicy: Never
  volumes:
    - name: event-payload
      configMap:
        name: foo
Example (Min)
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: v1
kind: ConfigMap
metadata:
  name: foo
  namespace: bar
data:
  payload: '<no value>'
---
apiVersion: v1
kind: Pod
metadata:
  name: foo
  namespace: bar
spec:
  containers:
  - image: docker.io/edenhill/kafkacat:1.6.0
    name: producer-container
    command:
    - kafkacat
    args:
    - "-P"
    - "-T"
    - "-b"
    - <no value>
    - "-t"
    - <no value>
    - "-l"
    - "/etc/mounted/payload"
    volumeMounts:
      - name: event-payload
        mountPath: /etc/mounted
  restartPolicy: Never
  volumes:
    - name: event-payload
      configMap:
        name: foo

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(name string, opts ...manifest.CfgFn) feature.StepFn

Install will create a pod running kafkacat, augmented with the config fn options.

func WithBootstrapServer

func WithBootstrapServer(bootstrapServer string) manifest.CfgFn

WithBootstrapServer adds bootstrapServer to the kafkacat argument list.

func WithHeaders

func WithHeaders(headers map[string]string) manifest.CfgFn

WithHeaders adds the headers to the kafkacat argument list.

func WithKey

func WithKey(key string) manifest.CfgFn

WithKey adds the key to the kafkacat argument list.

func WithPayload

func WithPayload(payload string) manifest.CfgFn

WithPayload adds payload to the kafkacat configmap.

func WithTopic

func WithTopic(topic string) manifest.CfgFn

WithTopic adds the topic to the kafkacat argument list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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