Documentation ¶
Index ¶
- func AddPolicy(obj *unstructured.Unstructured, pi *pinfo.PolicyInfo, ruleType pinfo.RuleType) bool
- func AddPolicyJSONPatch(ann map[string]string, pi *pinfo.PolicyInfo, ruleType pinfo.RuleType) (map[string]string, []byte, error)
- func BuildKey(policyName string) string
- func BuildKeyString(policyName string) string
- func ParseAnnotationsFromObject(bytes []byte) map[string]string
- func PatchAnnotations(ann map[string]string, pi *pinfo.PolicyInfo, ruleType pinfo.RuleType) ([]byte, error)
- func RemovePolicy(obj *unstructured.Unstructured, policy string) bool
- func RemovePolicyJSONPatch(ann map[string]string, policy string) (map[string]string, []byte, error)
- type Controller
- type Interface
- type Policy
- type Rule
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 BuildKeyString ¶ added in v0.7.0
func ParseAnnotationsFromObject ¶
ParseAnnotationsFromObject extracts annotations from the JSON obj
func PatchAnnotations ¶ added in v0.7.1
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
Types ¶
type Controller ¶
type Controller interface { Interface Run(stopCh <-chan struct{}) Stop() }
func NewAnnotationControler ¶
func NewAnnotationControler(client *client.Client) Controller
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
Click to show internal directories.
Click to hide internal directories.