kubernetes

package
v0.9.4-0...-d92c929 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package kubernetes listens to Kubernetes for policy updates.

Package kubernetes implements kubernetes API specific helper functions.

Package kubernetes implements kubernetes API specific helper functions.

Index

Constants

View Source
const (
	HttpGetParamWatch           = "watch=true"
	HttpGetParamResourceVersion = "resourceVersion"
)
View Source
const (
	KubeEventAdded    = "ADDED"
	KubeEventDeleted  = "DELETED"
	KubeEventModified = "MODIFIED"
)
View Source
const TranslateGroupStartIndex = 0

Variables

This section is empty.

Functions

func CreateDefaultPolicy

func CreateDefaultPolicy(o *v1.Namespace, l *kubeListener)

CreateDefaultPolicy handles isolation flag on a namespace by creating/deleting default network policy.

func CreateSchema

func CreateSchema(rootServiceURL string, overwrite bool) error

CreateSchema is placeholder for now.

func CreateTenant

func CreateTenant(name string) error

CreateTenant creates kubernetes specific tenant corresponding to the name given.

func GetTenantName

func GetTenantName(uid string) (string, error)

GetTenantName returns kubernetes tenant name corresponding to the UUID being used in romana tenants.

func GetTenantUUID

func GetTenantUUID(name string) (string, error)

GetTenantUUID returns kubernetes tenant UUID corresponding to the name.

func ProduceNewPolicyEvents

func ProduceNewPolicyEvents(out chan Event, done <-chan struct{}, kubeListener *kubeListener)

ProduceNewPolicyEvents produces kubernetes network policy events that arent applied in romana policy service yet.

func Run

func Run(rootServiceURL string, cred *common.Credential) (*common.RestServiceInfo, error)

Run configures and runs listener service.

func TenantExists

func TenantExists(name string) bool

TenantExists returns true/false depending on kubernetes tenant name or uuid exists.

Types

type Event

type Event struct {
	Type   string `json:"Type"`
	Object interface{}
}

Event is a representation of a structure that we receive from kubernetes API.

type NoMoreIngressEntities

type NoMoreIngressEntities struct{}

NoMoreIngressEntities is an error that indicates that translateNextIngress went through all Ingress entries in TranslateGroup.kubePolicy.

func (NoMoreIngressEntities) Error

func (e NoMoreIngressEntities) Error() string

type PolicyTranslator

type PolicyTranslator interface {
	Init(*common.RestClient, string)

	// Translates kubernetes policy into romana format.
	Kube2Romana(v1beta1.NetworkPolicy) (common.Policy, error)

	// Translates number of kubernetes policies into romana format.
	// Returns a list of translated policies, list of original policies
	// that failed to translate and an error.
	Kube2RomanaBulk([]v1beta1.NetworkPolicy) ([]common.Policy, []v1beta1.NetworkPolicy, error)
}

type TenantCacheEntry

type TenantCacheEntry struct {
	Tenant   tenant.Tenant
	Segments []tenant.Segment
}

type TranslateGroup

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

TranslateGroup represent a state of translation of kubernetes policy into romana policy.

type Translator

type Translator struct {
	// contains filtered or unexported fields
}
var PTranslator Translator

TODO there should be a better way to introduce translator then global variable like this one.

func (Translator) GetClient

func (t Translator) GetClient() *common.RestClient

func (*Translator) Init

func (t *Translator) Init(client *common.RestClient, segmentLabelName, tenantLabelName string)

func (Translator) Kube2Romana

func (t Translator) Kube2Romana(kubePolicy v1beta1.NetworkPolicy) (common.Policy, error)

Kube2Romana reserved for future use.

func (Translator) Kube2RomanaBulk

func (t Translator) Kube2RomanaBulk(kubePolicies []v1beta1.NetworkPolicy) ([]common.Policy, []v1beta1.NetworkPolicy, error)

Kube2RomanaBulk attempts to translate a list of kubernetes policies into romana representation, returns a list of translated policies and a list of policies that can't be translated in original format.

type TranslatorError

type TranslatorError struct {
	Code    TranslatorErrorType
	Details error
}

func (TranslatorError) Error

func (t TranslatorError) Error() string

type TranslatorErrorType

type TranslatorErrorType int
const (
	ErrorCacheUpdate TranslatorErrorType = iota
	ErrorTenantNotInCache
	ErrorTranslatingPolicyTarget
	ErrorTranslatingPolicyIngress
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳