module

package
v0.0.0-...-7c77b90 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 18 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) ([]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(nci NetControlIntent, project, compositeapp, compositeappversion, dig string, exists bool) (NetControlIntent, error)

CreateNetControlIntent - create a new NetControlIntent

func (*NetControlIntentClient) DeleteNetControlIntent

func (v *NetControlIntentClient) DeleteNetControlIntent(name, project, compositeapp, compositeappversion, dig string) error

Delete the NetControlIntent from database

func (*NetControlIntentClient) GetNetControlIntent

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

GetNetControlIntent returns the NetControlIntent for corresponding name

func (*NetControlIntentClient) GetNetControlIntents

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

GetNetControlIntentList returns all of the NetControlIntent for corresponding name

type NetControlIntentKey

type NetControlIntentKey struct {
	NetControlIntent    string `json:"netcontrolintent"`
	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(nci NetControlIntent, project, compositeapp, compositeappversion, dig string, exists bool) (NetControlIntent, error)
	GetNetControlIntent(name, project, compositeapp, compositeappversion, dig string) (NetControlIntent, error)
	GetNetControlIntents(project, compositeapp, compositeappversion, dig string) ([]NetControlIntent, error)
	DeleteNetControlIntent(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(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(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) error

Delete the WorkloadIfIntent from database

func (*WorkloadIfIntentClient) GetWorkloadIfIntent

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

GetWorkloadIfIntent returns the WorkloadIfIntent for corresponding name

func (*WorkloadIfIntentClient) GetWorkloadIfIntents

func (v *WorkloadIfIntentClient) GetWorkloadIfIntents(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:"provider"`
	CompositeApp        string `json:"compositeapp"`
	CompositeAppVersion string `json:"compositeappversion"`
	DigName             string `json:"deploymentintentgroup"`
	NetControlIntent    string `json:"netcontrolintent"`
	WorkloadIntent      string `json:"workloadintent"`
	WorkloadIfIntent    string `json:"workloadifintent"`
}

WorkloadIfIntentKey is the key structure that is used in the database

type WorkloadIfIntentManager

type WorkloadIfIntentManager interface {
	CreateWorkloadIfIntent(wi WorkloadIfIntent, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string, exists bool) (WorkloadIfIntent, error)
	GetWorkloadIfIntent(name, project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) (WorkloadIfIntent, error)
	GetWorkloadIfIntents(project, compositeapp, compositeappversion, dig, netcontrolintent, workloadintent string) ([]WorkloadIfIntent, error)
	DeleteWorkloadIfIntent(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(wi WorkloadIntent, project, compositeapp, compositeappversion, dig, netcontrolintent string, exists bool) (WorkloadIntent, error)

CreateWorkloadIntent - create a new WorkloadIntent

func (*WorkloadIntentClient) DeleteWorkloadIntent

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

Delete the WorkloadIntent from database

func (*WorkloadIntentClient) GetWorkloadIntent

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

GetWorkloadIntent returns the WorkloadIntent for corresponding name

func (*WorkloadIntentClient) GetWorkloadIntents

func (v *WorkloadIntentClient) GetWorkloadIntents(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:"provider"`
	CompositeApp        string `json:"compositeapp"`
	CompositeAppVersion string `json:"compositeappversion"`
	DigName             string `json:"deploymentintentgroup"`
	NetControlIntent    string `json:"netcontrolintent"`
	WorkloadIntent      string `json:"workloadintent"`
}

WorkloadIntentKey is the key structure that is used in the database

type WorkloadIntentManager

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

Manager is an interface exposing the WorkloadIntent functionality

type WorkloadIntentSpec

type WorkloadIntentSpec struct {
	AppName          string `json:"application-name"`
	WorkloadResource string `json:"workload-resource"`
	Type             string `json:"type"`
}

Jump to

Keyboard shortcuts

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