networkpolicy

package
v0.0.0-...-d0642ff Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGVR

GetGVR returns networkPolicy's GroupVersionResource which could be used for Clean function.

func GetMultiNetworkGVR

func GetMultiNetworkGVR() schema.GroupVersionResource

GetMultiNetworkGVR returns MultiNetworkPolicy's GroupVersionResource which could be used for Clean function.

Types

type EgressAdditionalOptions

type EgressAdditionalOptions func(builder *EgressRuleBuilder) (*EgressRuleBuilder, error)

EgressAdditionalOptions additional options for MultiNetworkPolicyEgressRule object.

type EgressRuleBuilder

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

EgressRuleBuilder provides a struct for EgressRules's object definition.

func NewEgressRuleBuilder

func NewEgressRuleBuilder() *EgressRuleBuilder

NewEgressRuleBuilder creates a new instance of EgressRuleBuilder.

func (*EgressRuleBuilder) GetEgressRuleCfg

func (builder *EgressRuleBuilder) GetEgressRuleCfg() (*v1beta1.MultiNetworkPolicyEgressRule, error)

GetEgressRuleCfg returns MultiNetworkPolicyEgressRule.

func (*EgressRuleBuilder) WithCIDR

func (builder *EgressRuleBuilder) WithCIDR(cidr string, except ...[]string) *EgressRuleBuilder

WithCIDR edits last item's IPBlock on Egress/To list or adds new item with only IPBlock into Egress/To list if the Egress/To list is empty.

func (*EgressRuleBuilder) WithOptions

func (builder *EgressRuleBuilder) WithOptions(options ...EgressAdditionalOptions) *EgressRuleBuilder

WithOptions adds generic options to Egress rule.

func (*EgressRuleBuilder) WithPeerNamespaceSelector

func (builder *EgressRuleBuilder) WithPeerNamespaceSelector(nsSelector metav1.LabelSelector) *EgressRuleBuilder

WithPeerNamespaceSelector appends new item with only NamespaceSelector into To Peer list.

func (*EgressRuleBuilder) WithPeerPodAndNamespaceSelector

func (builder *EgressRuleBuilder) WithPeerPodAndNamespaceSelector(
	podSelector, nsSelector metav1.LabelSelector) *EgressRuleBuilder

WithPeerPodAndNamespaceSelector appends new item to Egress/To list with PodSelector and NamespaceSelector.

func (*EgressRuleBuilder) WithPeerPodSelector

func (builder *EgressRuleBuilder) WithPeerPodSelector(podSelector metav1.LabelSelector) *EgressRuleBuilder

WithPeerPodSelector adds pod selector to Egress rule.

func (*EgressRuleBuilder) WithPeerPodSelectorAndCIDR

func (builder *EgressRuleBuilder) WithPeerPodSelectorAndCIDR(
	podSelector metav1.LabelSelector, cidr string, except ...[]string) *EgressRuleBuilder

WithPeerPodSelectorAndCIDR adds pod selector and CIDR to Egress rule.

func (*EgressRuleBuilder) WithPort

func (builder *EgressRuleBuilder) WithPort(port uint16) *EgressRuleBuilder

WithPort appends new item with only port to Ports list.

func (*EgressRuleBuilder) WithPortAndProtocol

func (builder *EgressRuleBuilder) WithPortAndProtocol(port uint16, protocol corev1.Protocol) *EgressRuleBuilder

WithPortAndProtocol adds port and protocol to Egress rule.

func (*EgressRuleBuilder) WithProtocol

func (builder *EgressRuleBuilder) WithProtocol(protocol corev1.Protocol) *EgressRuleBuilder

WithProtocol appends new item with only protocol to Ports list.

type IngressAdditionalOptions

type IngressAdditionalOptions func(builder *IngressRuleBuilder) (*IngressRuleBuilder, error)

IngressAdditionalOptions additional options for MultiNetworkPolicyIngressRule object.

type IngressRuleBuilder

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

IngressRuleBuilder provides a struct for IngressRules's object definition.

func NewIngressRuleBuilder

func NewIngressRuleBuilder() *IngressRuleBuilder

NewIngressRuleBuilder creates a new instance of IngressRuleBuilder.

func (*IngressRuleBuilder) GetIngressRuleCfg

func (builder *IngressRuleBuilder) GetIngressRuleCfg() (*v1beta1.MultiNetworkPolicyIngressRule, error)

GetIngressRuleCfg returns MultiNetworkPolicyIngressRule.

func (*IngressRuleBuilder) WithCIDR

func (builder *IngressRuleBuilder) WithCIDR(cidr string, except ...[]string) *IngressRuleBuilder

WithCIDR adds CIDR to Ingress rule.

func (*IngressRuleBuilder) WithOptions

func (builder *IngressRuleBuilder) WithOptions(options ...IngressAdditionalOptions) *IngressRuleBuilder

WithOptions adds generic options to Ingress rule.

func (*IngressRuleBuilder) WithPeerNamespaceSelector

func (builder *IngressRuleBuilder) WithPeerNamespaceSelector(nsSelector metav1.LabelSelector) *IngressRuleBuilder

WithPeerNamespaceSelector appends new item with only NamespaceSelector to From Peer list.

func (*IngressRuleBuilder) WithPeerPodAndNamespaceSelector

func (builder *IngressRuleBuilder) WithPeerPodAndNamespaceSelector(
	podSelector, nsSelector metav1.LabelSelector) *IngressRuleBuilder

WithPeerPodAndNamespaceSelector appends new item to Ingress/From list with PodSelector and NamespaceSelector.

func (*IngressRuleBuilder) WithPeerPodSelector

func (builder *IngressRuleBuilder) WithPeerPodSelector(podSelector metav1.LabelSelector) *IngressRuleBuilder

WithPeerPodSelector adds peer pod selector to Ingress rule.

func (*IngressRuleBuilder) WithPeerPodSelectorAndCIDR

func (builder *IngressRuleBuilder) WithPeerPodSelectorAndCIDR(
	podSelector metav1.LabelSelector, cidr string, except ...[]string) *IngressRuleBuilder

WithPeerPodSelectorAndCIDR adds port and protocol,CIDR to Ingress rule.

func (*IngressRuleBuilder) WithPort

func (builder *IngressRuleBuilder) WithPort(port uint16) *IngressRuleBuilder

WithPort appends new item with only port to Ports list.

func (*IngressRuleBuilder) WithPortAndProtocol

func (builder *IngressRuleBuilder) WithPortAndProtocol(port uint16, protocol corev1.Protocol) *IngressRuleBuilder

WithPortAndProtocol adds port and protocol to Ingress rule.

func (*IngressRuleBuilder) WithProtocol

func (builder *IngressRuleBuilder) WithProtocol(protocol corev1.Protocol) *IngressRuleBuilder

WithProtocol appends new item with only protocol to Ports list.

type MultiNetworkPolicyBuilder

type MultiNetworkPolicyBuilder struct {
	// MultiNetworkPolicy definition. Used to create MultiNetworkPolicy object with minimum set of required elements.
	Definition *v1beta1.MultiNetworkPolicy
	// Created MultiNetworkPolicy object on the cluster.
	Object *v1beta1.MultiNetworkPolicy
	// contains filtered or unexported fields
}

MultiNetworkPolicyBuilder provides struct for MultiNetworkPolicy object.

func NewMultiNetworkPolicyBuilder

func NewMultiNetworkPolicyBuilder(apiClient *clients.Settings, name, nsname string) *MultiNetworkPolicyBuilder

NewMultiNetworkPolicyBuilder method creates new instance of builder.

func PullMultiNetworkPolicy

func PullMultiNetworkPolicy(apiClient *clients.Settings, name, nsname string) (*MultiNetworkPolicyBuilder, error)

PullMultiNetworkPolicy loads an existing MultiNetworkPolicy into the Builder struct.

func (*MultiNetworkPolicyBuilder) Create

Create makes a MultiNetworkPolicy in cluster and stores the created object in struct.

func (*MultiNetworkPolicyBuilder) Delete

func (builder *MultiNetworkPolicyBuilder) Delete() error

Delete removes a MultiNetworkPolicy object from a cluster.

func (*MultiNetworkPolicyBuilder) Exists

func (builder *MultiNetworkPolicyBuilder) Exists() bool

Exists checks whether the given MultiNetworkPolicy exists.

func (*MultiNetworkPolicyBuilder) Get

Get returns MultiNetworkPolicy object if found.

func (*MultiNetworkPolicyBuilder) Update

Update renovates the existing MultiNetworkPolicy object with MultiNetworkPolicy definition in builder.

func (*MultiNetworkPolicyBuilder) WithEgressRule

WithEgressRule adds Egress rule to the MultiNetworkPolicy. Empty rule is allowed and works as allow all traffic.

func (*MultiNetworkPolicyBuilder) WithEmptyIngress

func (builder *MultiNetworkPolicyBuilder) WithEmptyIngress() *MultiNetworkPolicyBuilder

WithEmptyIngress adds empty ingress rule to the MultiNetworkPolicy. Empty ingress denies all.

func (*MultiNetworkPolicyBuilder) WithIngressRule

WithIngressRule adds Ingress rule to the MultiNetworkPolicy. Empty rule is allowed and works as allow all traffic.

func (*MultiNetworkPolicyBuilder) WithNetwork

func (builder *MultiNetworkPolicyBuilder) WithNetwork(networkName string) *MultiNetworkPolicyBuilder

WithNetwork adds network name to the MultiNetworkPolicy.

func (*MultiNetworkPolicyBuilder) WithPodSelector

func (builder *MultiNetworkPolicyBuilder) WithPodSelector(podSelector metav1.LabelSelector) *MultiNetworkPolicyBuilder

WithPodSelector adds podSelector to MultiNetworkPolicy.

func (*MultiNetworkPolicyBuilder) WithPolicyType

func (builder *MultiNetworkPolicyBuilder) WithPolicyType(
	policyType v1beta1.MultiPolicyType) *MultiNetworkPolicyBuilder

WithPolicyType adds policyType to the MultiNetworkPolicy.

type NetworkPolicyBuilder

type NetworkPolicyBuilder struct {
	// NetworkPolicy definition. Used to create networkPolicy object with minimum set of required elements.
	Definition *netv1.NetworkPolicy
	// Created networkPolicy object on the cluster.
	Object *netv1.NetworkPolicy
	// contains filtered or unexported fields
}

NetworkPolicyBuilder provides struct for networkPolicy object.

func List

func List(apiClient *clients.Settings, nsname string, options ...metav1.ListOptions) ([]*NetworkPolicyBuilder, error)

List returns networkpolicy inventory in the given namespace.

func NewNetworkPolicyBuilder

func NewNetworkPolicyBuilder(apiClient *clients.Settings, name, nsname string) *NetworkPolicyBuilder

NewNetworkPolicyBuilder method creates new instance of builder.

func Pull

func Pull(apiClient *clients.Settings, name, nsname string) (*NetworkPolicyBuilder, error)

Pull loads an existing networkPolicy into the Builder struct.

func (*NetworkPolicyBuilder) Create

func (builder *NetworkPolicyBuilder) Create() (*NetworkPolicyBuilder, error)

Create makes a networkPolicy in cluster and stores the created object in struct.

func (*NetworkPolicyBuilder) Delete

func (builder *NetworkPolicyBuilder) Delete() error

Delete removes a networkPolicy object from a cluster.

func (*NetworkPolicyBuilder) Exists

func (builder *NetworkPolicyBuilder) Exists() bool

Exists checks whether the given NetworkPolicy exists.

func (*NetworkPolicyBuilder) Get

func (builder *NetworkPolicyBuilder) Get() (*netv1.NetworkPolicy, error)

Get returns MultiNetworkPolicy object if found.

func (*NetworkPolicyBuilder) Update

func (builder *NetworkPolicyBuilder) Update() (*NetworkPolicyBuilder, error)

Update renovates the existing networkPolicy object with networkPolicy definition in builder.

func (*NetworkPolicyBuilder) WithNamespaceIngressRule

func (builder *NetworkPolicyBuilder) WithNamespaceIngressRule(
	namespaceIngressMatchLabels map[string]string,
	podIngressMatchLabels map[string]string) *NetworkPolicyBuilder

WithNamespaceIngressRule applies ingress rule for the networkPolicy.

func (*NetworkPolicyBuilder) WithPodSelector

func (builder *NetworkPolicyBuilder) WithPodSelector(podSelectorMatchLabels map[string]string) *NetworkPolicyBuilder

WithPodSelector add podSelector to the networkPolicy.

func (*NetworkPolicyBuilder) WithPolicyType

func (builder *NetworkPolicyBuilder) WithPolicyType(policyType netv1.PolicyType) *NetworkPolicyBuilder

WithPolicyType add policyType to the networkPolicy.

Jump to

Keyboard shortcuts

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