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)
- func ToPolicyRefs(policies []Policy) []common.GKNN
- type Policy
- func (p Policy) DeepCopy() *Policy
- func (p Policy) EffectiveSpec() (map[string]interface{}, error)
- func (p Policy) GKNN() common.GKNN
- func (p Policy) IsAttachedTo(objRef common.GKNN) bool
- func (p Policy) IsDirect() bool
- func (p Policy) IsInheritable() bool
- func (p *Policy) MarshalJSON() ([]byte, error)
- func (p Policy) PolicyCrdID() PolicyCrdID
- func (p Policy) Spec() map[string]interface{}
- type PolicyCRD
- type PolicyCrdID
- type PolicyManager
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.
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.
Types ¶
type Policy ¶
type Policy struct { Unstructured *unstructured.Unstructured // TargetRefs references the target objects this policy is attached to. This // only makes sense in case of a directly-attached-policy, or an // unmerged-inherited-policy. TargetRef common.GKNN // Indicates whether the policy is supposed to be "inherited" (as opposed to // "direct"). Inheritable bool }
func ConstructPolicy ¶
func ConstructPolicy(u *unstructured.Unstructured, inherited bool) (Policy, error)
func (Policy) EffectiveSpec ¶
func (Policy) IsInheritable ¶
func (*Policy) MarshalJSON ¶
func (Policy) PolicyCrdID ¶
func (p Policy) PolicyCrdID() PolicyCrdID
PolicyCrdID returns a unique identifier for the CRD of this policy.
type PolicyCRD ¶
type PolicyCRD struct {
CRD *apiextensionsv1.CustomResourceDefinition
}
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) IsInheritable ¶
type PolicyManager ¶
type PolicyManager struct { Fetcher common.GroupKindFetcher // contains filtered or unexported fields }
func New ¶
func New(fetcher common.GroupKindFetcher) *PolicyManager
func (*PolicyManager) GetCRDs ¶
func (p *PolicyManager) GetCRDs() []*PolicyCRD
func (*PolicyManager) GetPolicies ¶
func (p *PolicyManager) GetPolicies() []*Policy
func (*PolicyManager) Init ¶
func (p *PolicyManager) Init() error
Init will construct a local cache of all Policy CRDs and Policy Resources.
func (*PolicyManager) PoliciesAttachedTo ¶
func (p *PolicyManager) PoliciesAttachedTo(objRef common.GKNN) []*Policy