module

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright (c) 2020 Intel Corporation

Index

Constants

View Source
const CNI_TYPE_OVN4NFV string = "ovn4nfv"
View Source
const MAX_DESCRIPTION_LEN int = 1024

It implements the interface for managing the ClusterProviders

View Source
const MAX_USERDATA_LEN int = 4096
View Source
const NfnAnnotationKey = "k8s.plugin.opnfv.org/nfn-network"

Variables

View Source
var CNI_TYPES = [...]string{CNI_TYPE_OVN4NFV}

Functions

func AddNetworkAnnotation

func AddNetworkAnnotation(r interface{}, a nettypes.NetworkSelectionElement)

Add a network annotation to the resource

func AddNfnAnnotation

func AddNfnAnnotation(r interface{}, new []WorkloadIfIntentSpec)

Add an nfn annotation to the resource

func AddTemplateAnnotation

func AddTemplateAnnotation(r interface{}, a nettypes.NetworkSelectionElement, new []WorkloadIfIntentSpec, multus bool) ([]byte, error)

Add Annotations for non standard K8s resources with template section

func ParsePodTemplateNetworkAnnotation

func ParsePodTemplateNetworkAnnotation(pt *v1core.PodTemplateSpec) ([]*nettypes.NetworkSelectionElement, error)

ParsePodTemplateNetworkAnnotation parses Pod annotation in PodTemplate

Types

type Client

type Client struct {
	NetControlIntent *NetControlIntentClient
	WorkloadIntent   *WorkloadIntentClient
	WorkloadIfIntent *WorkloadIfIntentClient
}

Client for using the services in the ncm

func NewClient

func NewClient() *Client

NewClient creates a new client for using the services

type ClientDbInfo

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

type Metadata

type Metadata struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"-"`
	UserData1   string `json:"userData1" yaml:"-"`
	UserData2   string `json:"userData2" yaml:"-"`
}

type NetControlIntent

type NetControlIntent struct {
	Metadata Metadata `json:"metadata"`
}

NetControlIntent contains the parameters needed for dynamic networks

type NetControlIntentClient

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

NetControlIntentClient implements the Manager It will also be used to maintain some localized state

func NewNetControlIntentClient

func NewNetControlIntentClient() *NetControlIntentClient

NewNetControlIntentClient returns an instance of the NetControlIntentClient which implements the Manager

func (*NetControlIntentClient) CreateNetControlIntent

func (v *NetControlIntentClient) CreateNetControlIntent(ctx context.Context, nci NetControlIntent, project, compositeapp, compositeappversion, dig string, exists bool) (NetControlIntent, error)

CreateNetControlIntent - create a new NetControlIntent

func (*NetControlIntentClient) DeleteNetControlIntent

func (v *NetControlIntentClient) DeleteNetControlIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig string) error

Delete the NetControlIntent from database

func (*NetControlIntentClient) GetNetControlIntent

func (v *NetControlIntentClient) GetNetControlIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig string) (NetControlIntent, error)

GetNetControlIntent returns the NetControlIntent for corresponding name

func (*NetControlIntentClient) GetNetControlIntents

func (v *NetControlIntentClient) GetNetControlIntents(ctx context.Context, project, compositeapp, compositeappversion, dig string) ([]NetControlIntent, error)

GetNetControlIntentList returns all of the NetControlIntent for corresponding name

type NetControlIntentKey

type NetControlIntentKey struct {
	NetControlIntent    string `json:"netControllerIntent"`
	Project             string `json:"project"`
	CompositeApp        string `json:"compositeApp"`
	CompositeAppVersion string `json:"compositeAppVersion"`
	DigName             string `json:"deploymentIntentGroup"`
}

NetControlIntentKey is the key structure that is used in the database

type NetControlIntentManager

type NetControlIntentManager interface {
	CreateNetControlIntent(ctx context.Context, nci NetControlIntent, project, compositeapp, compositeappversion, dig string, exists bool) (NetControlIntent, error)
	GetNetControlIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig string) (NetControlIntent, error)
	GetNetControlIntents(ctx context.Context, project, compositeapp, compositeappversion, dig string) ([]NetControlIntent, error)
	DeleteNetControlIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig string) error
}

Manager is an interface exposing the NetControlIntent functionality

type NfnAnnotation

type NfnAnnotation struct {
	CniType   string                 `json:"type"`
	Interface []WorkloadIfIntentSpec `json:"interface"`
}

func GetPodNfnAnnotation

func GetPodNfnAnnotation(p *v1core.Pod) NfnAnnotation

GetPodNetworkAnnotation gets Pod Nfn annotation in PodTemplate

func GetPodTemplateNfnAnnotation

func GetPodTemplateNfnAnnotation(pt *v1core.PodTemplateSpec) NfnAnnotation

GetPodTemplateNetworkAnnotation gets Pod Nfn annotation in PodTemplate

type WorkloadIfIntent

type WorkloadIfIntent struct {
	Metadata Metadata             `json:"metadata"`
	Spec     WorkloadIfIntentSpec `json:"spec"`
}

WorkloadIfIntent contains the parameters needed for dynamic networks

type WorkloadIfIntentClient

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

WorkloadIfIntentClient implements the Manager It will also be used to maintain some localized state

func NewWorkloadIfIntentClient

func NewWorkloadIfIntentClient() *WorkloadIfIntentClient

NewWorkloadIfIntentClient returns an instance of the WorkloadIfIntentClient which implements the Manager

func (*WorkloadIfIntentClient) CreateWorkloadIfIntent

func (v *WorkloadIfIntentClient) CreateWorkloadIfIntent(ctx context.Context, wif WorkloadIfIntent, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error)

CreateWorkloadIfIntent - create a new WorkloadIfIntent

func (*WorkloadIfIntentClient) DeleteWorkloadIfIntent

func (v *WorkloadIfIntentClient) DeleteWorkloadIfIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) error

Delete the WorkloadIfIntent from database

func (*WorkloadIfIntentClient) GetWorkloadIfIntent

func (v *WorkloadIfIntentClient) GetWorkloadIfIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) (WorkloadIfIntent, error)

GetWorkloadIfIntent returns the WorkloadIfIntent for corresponding name

func (*WorkloadIfIntentClient) GetWorkloadIfIntents

func (v *WorkloadIfIntentClient) GetWorkloadIfIntents(ctx context.Context, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error)

GetWorkloadIfIntentList returns all of the WorkloadIfIntent for corresponding name

type WorkloadIfIntentKey

type WorkloadIfIntentKey struct {
	Project             string `json:"project"`
	CompositeApp        string `json:"compositeApp"`
	CompositeAppVersion string `json:"compositeAppVersion"`
	DigName             string `json:"deploymentIntentGroup"`
	NetControlIntent    string `json:"netControllerIntent"`
	WorkloadIntent      string `json:"workloadIntent"`
	WorkloadIfIntent    string `json:"interfaceIntent"`
}

WorkloadIfIntentKey is the key structure that is used in the database

type WorkloadIfIntentManager

type WorkloadIfIntentManager interface {
	CreateWorkloadIfIntent(ctx context.Context, wi WorkloadIfIntent, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error)
	GetWorkloadIfIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) (WorkloadIfIntent, error)
	GetWorkloadIfIntents(ctx context.Context, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error)
	DeleteWorkloadIfIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) error
}

Manager is an interface exposing the WorkloadIfIntent functionality

type WorkloadIfIntentSpec

type WorkloadIfIntentSpec struct {
	IfName         string `json:"interface"`
	NetworkName    string `json:"name"`
	DefaultGateway string `json:"defaultGateway"`       // optional, default value is "false"
	IpAddr         string `json:"ipAddress,omitempty"`  // optional, if not provided then will be dynamically allocated
	MacAddr        string `json:"macAddress,omitempty"` // optional, if not provided then will be dynamically allocated
}

type WorkloadIntent

type WorkloadIntent struct {
	Metadata Metadata           `json:"metadata"`
	Spec     WorkloadIntentSpec `json:"spec"`
}

WorkloadIntent contains the parameters needed for dynamic networks

type WorkloadIntentClient

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

WorkloadIntentClient implements the Manager It will also be used to maintain some localized state

func NewWorkloadIntentClient

func NewWorkloadIntentClient() *WorkloadIntentClient

NewWorkloadIntentClient returns an instance of the WorkloadIntentClient which implements the Manager

func (*WorkloadIntentClient) CreateWorkloadIntent

func (v *WorkloadIntentClient) CreateWorkloadIntent(ctx context.Context, wi WorkloadIntent, project, compositeapp, compositeappversion, dig, netcontrolintent string, exists bool) (WorkloadIntent, error)

CreateWorkloadIntent - create a new WorkloadIntent

func (*WorkloadIntentClient) DeleteWorkloadIntent

func (v *WorkloadIntentClient) DeleteWorkloadIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent string) error

Delete the WorkloadIntent from database

func (*WorkloadIntentClient) GetWorkloadIntent

func (v *WorkloadIntentClient) GetWorkloadIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent string) (WorkloadIntent, error)

GetWorkloadIntent returns the WorkloadIntent for corresponding name

func (*WorkloadIntentClient) GetWorkloadIntents

func (v *WorkloadIntentClient) GetWorkloadIntents(ctx context.Context, project, compositeapp, compositeappversion, dig, netcontrolintent string) ([]WorkloadIntent, error)

GetWorkloadIntentList returns all of the WorkloadIntent for corresponding name

type WorkloadIntentKey

type WorkloadIntentKey struct {
	Project             string `json:"project"`
	CompositeApp        string `json:"compositeApp"`
	CompositeAppVersion string `json:"compositeAppVersion"`
	DigName             string `json:"deploymentIntentGroup"`
	NetControlIntent    string `json:"netControllerIntent"`
	WorkloadIntent      string `json:"workloadIntent"`
}

WorkloadIntentKey is the key structure that is used in the database

type WorkloadIntentManager

type WorkloadIntentManager interface {
	CreateWorkloadIntent(ctx context.Context, wi WorkloadIntent, project, compositeapp, compositeappversion, dig, netcontrolintent string, exists bool) (WorkloadIntent, error)
	GetWorkloadIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent string) (WorkloadIntent, error)
	GetWorkloadIntents(ctx context.Context, project, compositeapp, compositeappversion, dig, netcontrolintent string) ([]WorkloadIntent, error)
	DeleteWorkloadIntent(ctx context.Context, name, project, compositeapp, compositeappversion, dig, netcontrolintent string) error
}

Manager is an interface exposing the WorkloadIntent functionality

type WorkloadIntentSpec

type WorkloadIntentSpec struct {
	AppName          string `json:"app"`
	WorkloadResource string `json:"workloadResource"`
	Type             string `json:"type"`
}

Jump to

Keyboard shortcuts

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