Documentation ¶
Index ¶
- func MergePoliciesOfDifferentHierarchy(parentPolicies, childPolicies map[PolicyCrdID]Policy) (map[PolicyCrdID]Policy, error)
- func MergePoliciesOfSameHierarchy(policies1, policies2 map[PolicyCrdID]Policy) (map[PolicyCrdID]Policy, error)
- func MergePoliciesOfSimilarKind(policies []Policy) (map[PolicyCrdID]Policy, error)
- type ObjRef
- type Policy
- func (p Policy) ClientObject() client.Object
- func (p Policy) DeepCopy() Policy
- func (p Policy) EffectiveSpec() (map[string]interface{}, error)
- func (p Policy) IsAttachedTo(objRef ObjRef) bool
- func (p Policy) IsDirect() bool
- func (p Policy) IsInherited() bool
- func (p Policy) MarshalJSON() ([]byte, error)
- func (p Policy) Name() string
- func (p Policy) PolicyCrdID() PolicyCrdID
- func (p Policy) Spec() map[string]interface{}
- func (p Policy) TargetRef() ObjRef
- func (p Policy) Unstructured() *unstructured.Unstructured
- type PolicyCRD
- type PolicyCrdID
- type PolicyManager
- func (p *PolicyManager) AddPolicy(unstrucutredPolicy unstructured.Unstructured) error
- func (p *PolicyManager) GetCRD(name string) (PolicyCRD, bool)
- func (p *PolicyManager) GetCRDs() []PolicyCRD
- func (p *PolicyManager) GetPolicies() []Policy
- func (p *PolicyManager) GetPolicy(namespacedName string) (Policy, bool)
- func (p *PolicyManager) Init(ctx context.Context) error
- func (p *PolicyManager) PoliciesAttachedTo(objRef ObjRef) []Policy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergePoliciesOfDifferentHierarchy ¶
func MergePoliciesOfDifferentHierarchy(parentPolicies, childPolicies map[PolicyCrdID]Policy) (map[PolicyCrdID]Policy, error)
func MergePoliciesOfSameHierarchy ¶
func MergePoliciesOfSameHierarchy(policies1, policies2 map[PolicyCrdID]Policy) (map[PolicyCrdID]Policy, error)
func MergePoliciesOfSimilarKind ¶
func MergePoliciesOfSimilarKind(policies []Policy) (map[PolicyCrdID]Policy, error)
MergePoliciesOfSimilarKind will convert a slice a policies to a map of policies by merging policies of similar kind. The returned map will have the policy kind as the key.
Types ¶
type ObjRef ¶
type ObjRef struct { Group string `json:",omitempty"` Kind string `json:",omitempty"` Name string `json:",omitempty"` Namespace string `json:",omitempty"` }
func ToPolicyRefs ¶
ToPolicyRefs returns the Object references of all given policies. Note that these are not the value of targetRef within the Policies but rather the reference to the Policy object itself.
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
func PolicyFromUnstructured ¶
func PolicyFromUnstructured(u unstructured.Unstructured, policyCRDs map[PolicyCrdID]PolicyCRD) (Policy, error)
func (Policy) ClientObject ¶
func (Policy) EffectiveSpec ¶
func (Policy) IsAttachedTo ¶
func (Policy) IsInherited ¶
func (Policy) MarshalJSON ¶
func (Policy) PolicyCrdID ¶
func (p Policy) PolicyCrdID() PolicyCrdID
PolicyCrdID returns a unique identifier for the CRD of this policy.
func (Policy) Unstructured ¶
func (p Policy) Unstructured() *unstructured.Unstructured
type PolicyCRD ¶
type PolicyCRD struct {
// contains filtered or unexported fields
}
func (PolicyCRD) CRD ¶
func (p PolicyCRD) CRD() *apiextensionsv1.CustomResourceDefinition
func (PolicyCRD) ClientObject ¶
func (PolicyCRD) ID ¶
func (p PolicyCRD) ID() PolicyCrdID
ID returns a unique identifier for this PolicyCRD.
func (PolicyCRD) IsClusterScoped ¶
IsClusterScoped returns true if the CRD is cluster scoped. Such policies can be used to target a cluster scoped resource like GatewayClass.
func (PolicyCRD) IsInherited ¶
type PolicyManager ¶
type PolicyManager struct {
// contains filtered or unexported fields
}
func New ¶
func New(dc dynamic.Interface) *PolicyManager
func (*PolicyManager) AddPolicy ¶
func (p *PolicyManager) AddPolicy(unstrucutredPolicy unstructured.Unstructured) error
func (*PolicyManager) GetCRDs ¶
func (p *PolicyManager) GetCRDs() []PolicyCRD
func (*PolicyManager) GetPolicies ¶
func (p *PolicyManager) GetPolicies() []Policy
func (*PolicyManager) GetPolicy ¶
func (p *PolicyManager) GetPolicy(namespacedName string) (Policy, bool)
func (*PolicyManager) Init ¶
func (p *PolicyManager) Init(ctx context.Context) error
Init will construct a local cache of all Policy CRDs and Policy Resources.
func (*PolicyManager) PoliciesAttachedTo ¶
func (p *PolicyManager) PoliciesAttachedTo(objRef ObjRef) []Policy