namespace

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

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",
	}

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

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

apiVersion: v1
kind: Namespace
metadata:
  name: foo
Example (WithLabels)
package main

import (
	"embed"
	"os"

	"knative.dev/eventing/test/rekt/resources/namespace"
	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",
		"labels": map[string]string{"target": "yes"},
	}

	namespace.WithLabels(map[string]string{"overwrite": "yes"})(cfg)

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

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

apiVersion: v1
kind: Namespace
metadata:
  name: foo
  labels:
    overwrite: yes

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

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

func WithLabels

func WithLabels(labels map[string]string) manifest.CfgFn

WithLabels sets the given labels on the Namespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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