desiredstatehash

package
v0.0.0-...-1aef31a Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package desiredstatehash can be used to build up an annotation value that changes when certain parts of the desired state of an object change.

The operator typically places this annotation on Pods that it directly manages so it can ignore extra items added to the Pod spec by other actors like admission controllers, while still knowing when items originally added by the operator need to be removed.

Index

Constants

View Source
const (
	// Annotation is the name of the desired state hash annotation.
	Annotation = "planetscale.com/desired-state-hash"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder collects all the releveant bits of desired state to be hashed.

Add each item of state one by one, giving each one a unique item name. Then call String() to get the final hash value for the annotation.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a desired state hash builder.

func (*Builder) AddContainersUpdates

func (b *Builder) AddContainersUpdates(itemName string, value []corev1.Container)

AddContainersUpdates adds an item of state based on a list of containers.

func (*Builder) AddStringList

func (b *Builder) AddStringList(itemName string, value []string)

AddStringList adds an item of state based on a list of strings.

func (*Builder) AddStringMapKeys

func (b *Builder) AddStringMapKeys(itemName string, value map[string]string)

AddStringMapKeys adds an item of state based on the keys from a string map.

func (*Builder) AddTolerations

func (b *Builder) AddTolerations(itemName string, value []corev1.Toleration)

AddTolerations adds an item of state based on a list of tolerations.

func (*Builder) AddVolumeNames

func (b *Builder) AddVolumeNames(itemName string, vols []corev1.Volume)

AddVolumeNames add an item of state based on a list of Volume names.

func (*Builder) String

func (b *Builder) String() string

String returns a hash of all the state added so far.

Jump to

Keyboard shortcuts

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