objecttemplate

package
v1.11.7 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Object Template Plugin

The rigdev.object_template patches a YAML spec to a Kubernetes object defined by a Group, Kind and Name.

The config can be templated with standard Go templating and has

.capsule
.current

as its templating context where .current refers to the current version of the object being modified.

If the name is empty, it defaults to the capsule name. If it is '*' it will execute the object template on all objects of the given Group and Kind. For each object, .current will refer to that specific object when templating.

Example

Config:

config:
  pipeline:
    steps:
      - plugins:
        - name: rigdev.object_template
          config: |
            object: | 
              spec:
               externalName: some-name 
            group: core
            kind: Service
            name: {{ .capsule.metadata.name }}

The resulting Service resource of the Capsule, if the Capsule is named my-capsule

kind: Service
metadata:
  name: my-capsule
...
spec:
  externalName: some-name
  ...

Config

Configuration for the object_template plugin

Field Description
object string The yaml to apply to the object. The yaml can be templated.
group string Group to match, for which objects to apply the patch to.
kind string Kind to match, for which objects to apply the patch to.
name string Name of the object to match. Default to Capsule-name. If '*' will execute the object template on all objects of the given group and kind.

Documentation

Overview

+groupName=plugins.rig.dev -- Only used for config doc generation

Index

Constants

View Source
const Name = "rigdev.object_template"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The yaml to apply to the object. The yaml can be templated.
	Object string `json:"object,omitempty"`
	// Group to match, for which objects to apply the patch to.
	Group string `json:"group,omitempty"`
	// Kind to match, for which objects to apply the patch to.
	Kind string `json:"kind,omitempty"`
	// Name of the object to match. Default to Capsule-name. If '*' will execute the object template
	// on all objects of the given group and kind.
	Name string `json:"name,omitempty"`
}

Configuration for the object_template plugin +kubebuilder:object:root=true

type Plugin

type Plugin struct {
	plugin.NoWatchObjectStatus
	// contains filtered or unexported fields
}

func (*Plugin) Initialize

func (p *Plugin) Initialize(req plugin.InitializeRequest) error

func (*Plugin) Run

func (p *Plugin) Run(_ context.Context, req pipeline.CapsuleRequest, _ hclog.Logger) error

Jump to

Keyboard shortcuts

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