namespace

package
v0.0.0-...-96258be Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Example (Full)
package main

import (
	"embed"
	"os"

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

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

func main() {
	ctx := testlog.NewContext()
	images := map[string]string{}
	cfg := map[string]interface{}{
		"name": "foo",
	}

	opts := []manifest.CfgFn{
		namespace.WithLabels(map[string]string{
			"color": "green",
		}),
		namespace.WithAnnotations(map[string]interface{}{
			"app.kubernetes.io/name": "app",
		}),
	}

	for _, opt := range opts {
		opt(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
  annotations:
    app.kubernetes.io/name: "app"
  labels:
    color: "green"
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

Index

Examples

Constants

This section is empty.

Variables

View Source
var WithAnnotations = manifest.WithAnnotations
View Source
var WithLabels = manifest.WithLabels

Functions

func Install

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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