k8s

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package k8s abstracts all Kubernetes specific behaviour

Index

Constants

View Source
const (
	// ThirdPartyResourceGroup is the name of the third party resource group
	ThirdPartyResourceGroup = "cilium.io"

	// ThirdPartyResourceVersion is the current version of the resource
	ThirdPartyResourceVersion = "v1"
)

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(endpoint, kubeCfgPath string) (*kubernetes.Clientset, error)

CreateClient creates a new client to access the Kubernetes API

func CreateTPRClient

func CreateTPRClient(endpoint, kubeCfgPath string) (*rest.RESTClient, error)

CreateTPRClient creates a new k8s client for third party resources

func ExtractNamespace

func ExtractNamespace(np *metav1.ObjectMeta) string

ExtractNamespace extracts the namespace of ObjectMeta.

func ExtractPolicyName

func ExtractPolicyName(np *v1beta1.NetworkPolicy) string

ExtractPolicyName extracts the name of policy name

func ParseNetworkPolicy

func ParseNetworkPolicy(np *v1beta1.NetworkPolicy) (api.Rules, error)

ParseNetworkPolicy parses a k8s NetworkPolicy and returns a list of Cilium policy rules that can be added

Types

type CiliumNetworkPolicy

type CiliumNetworkPolicy struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	Metadata metav1.ObjectMeta `json:"metadata"`

	// Spec is the desired Cilium specific rule specification.
	Spec api.Rule `json:"spec"`
}

CiliumNetworkPolicy is a Kubernetes third-party resource with an extended version of NetworkPolicy

func (*CiliumNetworkPolicy) GetObjectKind

func (r *CiliumNetworkPolicy) GetObjectKind() schema.ObjectKind

GetObjectKind returns the kind of the object

func (*CiliumNetworkPolicy) GetObjectMeta

func (r *CiliumNetworkPolicy) GetObjectMeta() metav1.Object

GetObjectMeta returns the metadata of the object

func (*CiliumNetworkPolicy) Parse

func (r *CiliumNetworkPolicy) Parse() (api.Rules, error)

Parse parses a CiliumNetworkPolicy and returns a list of internal policy rules

type CiliumNetworkPolicyList

type CiliumNetworkPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	Metadata metav1.ListMeta `json:"metadata"`

	// Items is a list of CiliumNetworkPolicy
	Items []CiliumNetworkPolicy `json:"items"`
}

CiliumNetworkPolicyList is a list of CiliumNetworkPolicy objects

func (*CiliumNetworkPolicyList) GetListMeta

func (r *CiliumNetworkPolicyList) GetListMeta() metav1.List

GetListMeta returns the metadata of the object

func (*CiliumNetworkPolicyList) GetObjectKind

func (r *CiliumNetworkPolicyList) GetObjectKind() schema.ObjectKind

GetObjectKind returns the kind of the object

Jump to

Keyboard shortcuts

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