annotations

package
v1.12.7 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Annotations Plugin

The annotations plugin can insert annotations and labels into a given object. If any of the given annotations or labels are already present in the object, they will be overwritten.

The config can be templated with standard Go templating and has

.capsule

as its templating context.

Example

Config:

config:
  pipeline:
    steps:
      - plugins:
          - plugin: rigdev.annotations
            config: |
              annotations:
                key1: value1
              labels:
                key2: value2
              group: apps
              kind: Deployment

If the name of the capsule in the request context is my-capsule with corresponding Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-capsule
  annotations:
    key1: some-other-value
  labels:
    label: value
  ....

The resulting config of the Deployment is

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-capsule
  annotations:
    key1: value1
  labels:
    label: value
    key2: value2
  ....

Config

Configuration for the annotations plugin

Field Description
annotations object (keys:string, values:string) Annotations are the annotations to insert into the object
labels object (keys:string, values:string) Labels are the labels to insert into the object
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. Defaults to Capsule-name.

Documentation

Overview

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

Index

Constants

View Source
const Name = "rigdev.annotations"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Annotations are the annotations to insert into the object
	Annotations map[string]string `json:"annotations,omitempty"`
	// Labels are the labels to insert into the object
	Labels map[string]string `json:"labels,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. Defaults to Capsule-name.
	Name string `json:"name,omitempty"`
}

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

type Plugin

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

func (*Plugin) ComputeConfig added in v1.12.0

func (p *Plugin) ComputeConfig(ctx context.Context, req pipeline.CapsuleRequest, logger hclog.Logger) (string, error)

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
JackTT - Gopher 🇻🇳