annotations

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPolicy

func AddPolicy(obj *unstructured.Unstructured, pi *pinfo.PolicyInfo, ruleType pinfo.RuleType) bool

AddPolicy will add policy annotation if not present or update if present modifies obj returns true, if there is any update -> caller need to update the obj returns false, if there is no change -> caller can skip the update

func AddPolicyJSONPatch

func AddPolicyJSONPatch(ann map[string]string, pi *pinfo.PolicyInfo, ruleType pinfo.RuleType) (map[string]string, []byte, error)

AddPolicyJSONPatch generate JSON Patch to add policy informatino JSON patch

func BuildKey

func BuildKey(policyName string) string

func ParseAnnotationsFromObject

func ParseAnnotationsFromObject(bytes []byte) map[string]string

ParseAnnotationsFromObject extracts annotations from the JSON obj

func RemovePolicy

func RemovePolicy(obj *unstructured.Unstructured, policy string) bool

RemovePolicy to remove annotations return true -> if there was an entry and we deleted it return false -> if there is no entry, caller need not update

func RemovePolicyJSONPatch

func RemovePolicyJSONPatch(ann map[string]string, policy string) (map[string]string, []byte, error)

RemovePolicyJSONPatch remove JSON patch

Types

type Controller

type Controller interface {
	Interface
	Run(stopCh <-chan struct{})
	Stop()
}

func NewAnnotationControler

func NewAnnotationControler(client *client.Client) Controller

type Interface

type Interface interface {
	Add(rkind, rns, rname string, patch []byte)
}

type Policy

type Policy struct {
	Status string `json:"status"`
	// Key Type/Name
	MutationRules   map[string]Rule `json:"mutationrules,omitempty"`
	ValidationRules map[string]Rule `json:"validationrules,omitempty"`
	GenerationRules map[string]Rule `json:"generationrules,omitempty"`
}

Policy information for annotations

type Rule

type Rule struct {
	Status  string `json:"status"`
	Changes string `json:"changes,omitempty"` // TODO for mutation changes
	Error   string `json:"error,omitempty"`
}

Rule information for annotations

Jump to

Keyboard shortcuts

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