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: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Testvars _testvars

Functions

func CheckLogicalCloud

func CheckLogicalCloud(lcClient LogicalCloudManager, project string, logicalCloud string) error

CheckLogicalCloud checks if logical cloud exists

func CheckProject

func CheckProject(project string) error

CheckProject if the project exists

func GetAppContextStatus

func GetAppContextStatus(ac appcontext.AppContext) (*appcontext.AppContextStatus, error)

GetAppContextStatus returns the Status for a particular AppContext

func GetLogicalCloudContext

func GetLogicalCloudContext(storeName string, key db.Key, meta string, project string, name string) (appcontext.AppContext, string, error)

GetLogicalCloudContext returns the AppContext for corresponding provider and name

func GetLogicalCloudFromContext

func GetLogicalCloudFromContext(storeName string, appContextID string) (string, string, error)

GetLogicalCloudFromContext returns the pair (project, logical cloud name) for a given AppContext

func Instantiate

func Instantiate(project string, logicalcloud LogicalCloud, clusterList []Cluster,
	quotaList []Quota, userPermissionList []UserPermission) error

Instantiate prepares all yaml resources to be given to the clusters via rsync, then creates an appcontext with such resources and asks rsync to instantiate the logical cloud

func InvokeReadyNotify

func InvokeReadyNotify(appContextID string) error

InvokeReadyNotify will make a gRPC call to the resource synchronizer and will subscribe DCM to alerts from the rsync gRPC server ("ready-notify")

func Stop

func Stop(project string, logicalcloud LogicalCloud) error

Stop asks rsync to stop the instantiation or termination of the logical cloud

func Terminate

func Terminate(project string, logicalcloud LogicalCloud, clusterList []Cluster,
	quotaList []Quota) error

Terminate asks rsync to terminate the logical cloud

Types

type AppContextKey

type AppContextKey struct {
	LCContext string `json:"lccontext"`
}

AppContextKey is an alternative key to access logical clouds

type Client

type Client struct {
	LogicalCloud   *LogicalCloudClient
	Cluster        *ClusterClient
	Quota          *QuotaClient
	UserPermission *UserPermissionClient
	KeyValue       *KeyValueClient
}

Client for using the services in the orchestrator

func NewClient

func NewClient() *Client

NewClient creates a new client for using the services

type Cluster

type Cluster struct {
	MetaData      ClusterMeta `json:"metadata"`
	Specification ClusterSpec `json:"spec"`
}

Cluster contains the parameters needed for a Cluster

type ClusterClient

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

ClusterClient implements the ClusterManager It will also be used to maintain some localized state

func NewClusterClient

func NewClusterClient() *ClusterClient

ClusterClient returns an instance of the ClusterClient which implements the ClusterManager

func (*ClusterClient) CreateCluster

func (v *ClusterClient) CreateCluster(project, logicalCloud string, c Cluster) (Cluster, error)

Create entry for the cluster reference resource in the database

func (*ClusterClient) DeleteCluster

func (v *ClusterClient) DeleteCluster(project, logicalCloud, clusterReference string) error

Delete the Cluster reference entry from database

func (*ClusterClient) GetAllClusters

func (v *ClusterClient) GetAllClusters(project, logicalCloud string) ([]Cluster, error)

GetAll returns all cluster references in the logical cloud

func (*ClusterClient) GetCluster

func (v *ClusterClient) GetCluster(project, logicalCloud, clusterReference string) (Cluster, error)

Get returns Cluster for corresponding cluster reference

func (*ClusterClient) GetClusterConfig

func (v *ClusterClient) GetClusterConfig(project, logicalCloud, clusterReference string) (string, error)

Get returns Cluster's kubeconfig for corresponding cluster reference

func (*ClusterClient) UpdateCluster

func (v *ClusterClient) UpdateCluster(project, logicalCloud, clusterReference string, c Cluster) (Cluster, error)

Update an entry for the Cluster reference in the database

type ClusterKey

type ClusterKey struct {
	Project          string `json:"project"`
	LogicalCloudName string `json:"logical-cloud-name"`
	ClusterReference string `json:"clname"`
}

type ClusterManager

type ClusterManager interface {
	CreateCluster(project, logicalCloud string, c Cluster) (Cluster, error)
	GetCluster(project, logicalCloud, name string) (Cluster, error)
	GetAllClusters(project, logicalCloud string) ([]Cluster, error)
	DeleteCluster(project, logicalCloud, name string) error
	UpdateCluster(project, logicalCloud, name string, c Cluster) (Cluster, error)
	GetClusterConfig(project, logicalcloud, name string) (string, error)
}

ClusterManager is an interface that exposes the connection functionality

type ClusterMeta

type ClusterMeta struct {
	ClusterReference string `json:"name"`
	Description      string `json:"description"`
	UserData1        string `json:"userData1"`
	UserData2        string `json:"userData2"`
}

type ClusterSpec

type ClusterSpec struct {
	ClusterProvider string `json:"cluster-provider"`
	ClusterName     string `json:"cluster-name"`
	LoadBalancerIP  string `json:"loadbalancer-ip"`
	Certificate     string `json:"certificate"`
}

type KVMetaDataList

type KVMetaDataList struct {
	KeyValueName string `json:"name"`
	Description  string `json:"description"`
	UserData1    string `json:"userData1"`
	UserData2    string `json:"userData2"`
}

MetaData contains the parameters needed for metadata

type KVSpec

type KVSpec struct {
	Kv []map[string]interface{} `json:"kv"`
}

Spec contains the parameters needed for spec

type KeyValue

type KeyValue struct {
	MetaData      KVMetaDataList `json:"metadata"`
	Specification KVSpec         `json:"spec"`
}

KeyValue contains the parameters needed for a key value

type KeyValueClient

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

KeyValueClient implements the KeyValueManager It will also be used to maintain some localized state

func NewKeyValueClient

func NewKeyValueClient() *KeyValueClient

KeyValueClient returns an instance of the KeyValueClient which implements the KeyValueManager

func (*KeyValueClient) CreateKVPair

func (v *KeyValueClient) CreateKVPair(project, logicalCloud string, c KeyValue) (KeyValue, error)

Create entry for the key value resource in the database

func (*KeyValueClient) DeleteKVPair

func (v *KeyValueClient) DeleteKVPair(project, logicalCloud, kvPairName string) error

Delete the Key Value entry from database

func (*KeyValueClient) GetAllKVPairs

func (v *KeyValueClient) GetAllKVPairs(project, logicalCloud string) ([]KeyValue, error)

Get All lists all key value pairs

func (*KeyValueClient) GetKVPair

func (v *KeyValueClient) GetKVPair(project, logicalCloud, kvPairName string) (KeyValue, error)

Get returns Key Value for correspondin name

func (*KeyValueClient) UpdateKVPair

func (v *KeyValueClient) UpdateKVPair(project, logicalCloud, kvPairName string, c KeyValue) (KeyValue, error)

Update an entry for the Key Value in the database

type KeyValueKey

type KeyValueKey struct {
	Project          string `json:"project"`
	LogicalCloudName string `json:"logical-cloud-name"`
	KeyValueName     string `json:"kvname"`
}

KeyValueKey is the key structure that is used in the database

type KeyValueManager

type KeyValueManager interface {
	CreateKVPair(project, logicalCloud string, c KeyValue) (KeyValue, error)
	GetKVPair(project, logicalCloud, name string) (KeyValue, error)
	GetAllKVPairs(project, logicalCloud string) ([]KeyValue, error)
	DeleteKVPair(project, logicalCloud, name string) error
	UpdateKVPair(project, logicalCloud, name string, c KeyValue) (KeyValue, error)
}

KeyValueManager is an interface that exposes the connection functionality

type KubeCluster

type KubeCluster struct {
	ClusterDef  KubeClusterDef `yaml:"cluster"`
	ClusterName string         `yaml:"name"`
}

type KubeClusterDef

type KubeClusterDef struct {
	CertificateAuthorityData string `yaml:"certificate-authority-data"`
	Server                   string `yaml:"server"`
}

type KubeConfig

type KubeConfig struct {
	ApiVersion     string            `yaml:"apiVersion"`
	Kind           string            `yaml:"kind"`
	Clusters       []KubeCluster     `yaml:"clusters"`
	Contexts       []KubeContext     `yaml:"contexts"`
	CurrentContext string            `yaml:"current-context"`
	Preferences    map[string]string `yaml:"preferences"`
	Users          []KubeUser        `yaml:"users"`
}

type KubeContext

type KubeContext struct {
	ContextDef  KubeContextDef `yaml:"context"`
	ContextName string         `yaml:"name"`
}

type KubeContextDef

type KubeContextDef struct {
	Cluster   string `yaml:"cluster"`
	Namespace string `yaml:"namespace,omitempty"`
	User      string `yaml:"user"`
}

type KubeUser

type KubeUser struct {
	UserName string      `yaml:"name"`
	UserDef  KubeUserDef `yaml:"user"`
}

type KubeUserDef

type KubeUserDef struct {
	ClientCertificateData string `yaml:"client-certificate-data"`
	ClientKeyData         string `yaml:"client-key-data"`
}

type LogicalCloud

type LogicalCloud struct {
	MetaData      MetaDataList `json:"metadata"`
	Specification Spec         `json:"spec"`
}

LogicalCloud contains the parameters needed for a Logical Cloud

type LogicalCloudClient

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

LogicalCloudClient implements the LogicalCloudManager It will also be used to maintain some localized state

func NewLogicalCloudClient

func NewLogicalCloudClient() *LogicalCloudClient

LogicalCloudClient returns an instance of the LogicalCloudClient which implements the LogicalCloudManager

func (*LogicalCloudClient) Create

func (v *LogicalCloudClient) Create(project string, c LogicalCloud) (LogicalCloud, error)

Create entry for the logical cloud resource in the database

func (*LogicalCloudClient) Delete

func (v *LogicalCloudClient) Delete(project, logicalCloudName string) error

Delete the Logical Cloud entry from database

func (*LogicalCloudClient) Get

func (v *LogicalCloudClient) Get(project, logicalCloudName string) (LogicalCloud, error)

Get returns Logical Cloud corresponding to logical cloud name

func (*LogicalCloudClient) GetAll

func (v *LogicalCloudClient) GetAll(project string) ([]LogicalCloud, error)

GetAll returns Logical Clouds in the project

func (*LogicalCloudClient) Update

func (v *LogicalCloudClient) Update(project, logicalCloudName string, c LogicalCloud) (LogicalCloud, error)

Update an entry for the Logical Cloud in the database

type LogicalCloudKey

type LogicalCloudKey struct {
	Project          string `json:"project"`
	LogicalCloudName string `json:"logical-cloud-name"`
}

LogicalCloudKey is the key structure that is used in the database

type LogicalCloudManager

type LogicalCloudManager interface {
	Create(project string, c LogicalCloud) (LogicalCloud, error)
	Get(project, name string) (LogicalCloud, error)
	GetAll(project string) ([]LogicalCloud, error)
	Delete(project, name string) error
	Update(project, name string, c LogicalCloud) (LogicalCloud, error)
}

LogicalCloudManager is an interface that exposes the connection functionality

type MetaDataList

type MetaDataList struct {
	LogicalCloudName string `json:"name"`
	Description      string `json:"description"`
	UserData1        string `json:"userData1"`
	UserData2        string `json:"userData2"`
}

MetaData contains the parameters needed for metadata

type MetaDatas

type MetaDatas struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace,omitempty"`
}

type QMetaDataList

type QMetaDataList struct {
	QuotaName   string `json:"name"`
	Description string `json:"description"`
	UserData1   string `json:"userData1"`
	UserData2   string `json:"userData2"`
}

MetaData contains the parameters needed for metadata

type QSpec

type QSpec struct {
	LimitsCPU                   string `json:"limits.cpu"`
	LimitsMemory                string `json:"limits.memory"`
	RequestsCPU                 string `json:"requests.cpu"`
	RequestsMemory              string `json:"requests.memory"`
	RequestsStorage             string `json:"requests.storage"`
	LimitsEphemeralStorage      string `json:"limits.ephemeral.storage"`
	PersistentVolumeClaims      string `json:"persistentvolumeclaims"`
	Pods                        string `json:"pods"`
	ConfigMaps                  string `json:"configmaps"`
	ReplicationControllers      string `json:"replicationcontrollers"`
	ResourceQuotas              string `json:"resourcequotas"`
	Services                    string `json:"services"`
	ServicesLoadBalancers       string `json:"services.loadbalancers"`
	ServicesNodePorts           string `json:"services.nodeports"`
	Secrets                     string `json:"secrets"`
	CountReplicationControllers string `json:"count/replicationcontrollers"`
	CountDeploymentsApps        string `json:"count/deployments.apps"`
	CountReplicasetsApps        string `json:"count/replicasets.apps"`
	CountStatefulSets           string `json:"count/statefulsets.apps"`
	CountJobsBatch              string `json:"count/jobs.batch"`
	CountCronJobsBatch          string `json:"count/cronjobs.batch"`
	CountDeploymentsExtensions  string `json:"count/deployments.extensions"`
}

TODO: use QSpec fields to validate quota keys Spec contains the parameters needed for spec

type Quota

type Quota struct {
	MetaData QMetaDataList `json:"metadata"`
	// Specification QSpec         `json:"spec"`
	Specification map[string]string `json:"spec"`
}

Quota contains the parameters needed for a Quota

type QuotaClient

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

QuotaClient implements the QuotaManager It will also be used to maintain some localized state

func NewQuotaClient

func NewQuotaClient() *QuotaClient

QuotaClient returns an instance of the QuotaClient which implements the QuotaManager

func (*QuotaClient) CreateQuota

func (v *QuotaClient) CreateQuota(project, logicalCloud string, c Quota) (Quota, error)

Create entry for the quota resource in the database

func (*QuotaClient) DeleteQuota

func (v *QuotaClient) DeleteQuota(project, logicalCloud, quotaName string) error

Delete the Quota entry from database

func (*QuotaClient) GetAllQuotas

func (v *QuotaClient) GetAllQuotas(project, logicalCloud string) ([]Quota, error)

GetAll returns all cluster quotas in the logical cloud

func (*QuotaClient) GetQuota

func (v *QuotaClient) GetQuota(project, logicalCloud, quotaName string) (Quota, error)

Get returns Quota for corresponding quota name

func (*QuotaClient) UpdateQuota

func (v *QuotaClient) UpdateQuota(project, logicalCloud, quotaName string, c Quota) (Quota, error)

Update an entry for the Quota in the database

type QuotaKey

type QuotaKey struct {
	Project          string `json:"project"`
	LogicalCloudName string `json:"logical-cloud-name"`
	QuotaName        string `json:"qname"`
}

QuotaKey is the key structure that is used in the database

type QuotaManager

type QuotaManager interface {
	CreateQuota(project, logicalCloud string, c Quota) (Quota, error)
	GetQuota(project, logicalCloud, name string) (Quota, error)
	GetAllQuotas(project, logicalCloud string) ([]Quota, error)
	DeleteQuota(project, logicalCloud, name string) error
	UpdateQuota(project, logicalCloud, name string, c Quota) (Quota, error)
}

QuotaManager is an interface that exposes the connection functionality

type Resource

type Resource struct {
	ApiVersion    string         `yaml:"apiVersion"`
	Kind          string         `yaml:"kind"`
	MetaData      MetaDatas      `yaml:"metadata"`
	Specification Specs          `yaml:"spec,omitempty"`
	Rules         []RoleRules    `yaml:"rules,omitempty"`
	Subjects      []RoleSubjects `yaml:"subjects,omitempty"`
	RoleRefs      RoleRef        `yaml:"roleRef,omitempty"`
}

type RoleRef

type RoleRef struct {
	Kind     string `yaml:"kind"`
	Name     string `yaml:"name"`
	ApiGroup string `yaml:"apiGroup"`
}

type RoleRules

type RoleRules struct {
	ApiGroups []string `yaml:"apiGroups"`
	Resources []string `yaml:"resources"`
	Verbs     []string `yaml:"verbs"`
}

type RoleSubjects

type RoleSubjects struct {
	Kind     string `yaml:"kind"`
	Name     string `yaml:"name"`
	ApiGroup string `yaml:"apiGroup"`
}

type RsyncInfo

type RsyncInfo struct {
	RsyncName string
	// contains filtered or unexported fields
}

func NewRsyncInfo

func NewRsyncInfo(rName, h string, pN int) RsyncInfo

NewRsyncInfo shall return a newly created RsyncInfo object

type Spec

type Spec struct {
	NameSpace string   `json:"namespace"`
	Level     string   `json:"level"`
	User      UserData `json:"user"`
}

Spec contains the parameters needed for spec

type Specs

type Specs struct {
	Request string   `yaml:"request,omitempty"`
	Usages  []string `yaml:"usages,omitempty"`
	// TODO: validate quota keys
	// //Hard           logicalcloud.QSpec    `yaml:"hard,omitempty"`
	// Hard QSpec `yaml:"hard,omitempty"`
	Hard map[string]string `yaml:"hard,omitempty"`
}

type UPMetaDataList

type UPMetaDataList struct {
	UserPermissionName string `json:"name"`
	Description        string `json:"description"`
	UserData1          string `json:"userData1"`
	UserData2          string `json:"userData2"`
}

UPMetaDataList contains the parameters needed for a user permission metadata

type UPSpec

type UPSpec struct {
	Namespace string   `json:"namespace"`
	APIGroups []string `json:"apiGroups"`
	Resources []string `json:"resources"`
	Verbs     []string `json:"verbs"`
}

UPSpec contains the parameters needed for a user permission spec

type UserData

type UserData struct {
	UserName string `json:"user-name"`
	Type     string `json:"type"`
}

UserData contains the parameters needed for user

type UserPermission

type UserPermission struct {
	MetaData      UPMetaDataList `json:"metadata"`
	Specification UPSpec         `json:"spec"`
}

UserPermission contains the parameters needed for a user permission

type UserPermissionClient

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

UserPermissionClient implements the UserPermissionManager It will also be used to maintain some localized state

func NewUserPermissionClient

func NewUserPermissionClient() *UserPermissionClient

UserPermissionClient returns an instance of the UserPermissionClient which implements the UserPermissionManager

func (*UserPermissionClient) CreateUserPerm

func (v *UserPermissionClient) CreateUserPerm(project, logicalCloud string, c UserPermission) (UserPermission, error)

Create entry for the User Permission resource in the database

func (*UserPermissionClient) DeleteUserPerm

func (v *UserPermissionClient) DeleteUserPerm(project, logicalCloud, userPermName string) error

Delete the User Permission entry from database

func (*UserPermissionClient) GetAllUserPerms

func (v *UserPermissionClient) GetAllUserPerms(project, logicalCloud string) ([]UserPermission, error)

GetAll lists all user permissions

func (*UserPermissionClient) GetUserPerm

func (v *UserPermissionClient) GetUserPerm(project, logicalCloud, userPermName string) (UserPermission, error)

Get returns User Permission for corresponding name

func (*UserPermissionClient) UpdateUserPerm

func (v *UserPermissionClient) UpdateUserPerm(project, logicalCloud, userPermName string, c UserPermission) (
	UserPermission, error)

Update an entry for the User Permission in the database

type UserPermissionKey

type UserPermissionKey struct {
	Project            string `json:"project"`
	LogicalCloudName   string `json:"logical-cloud-name"`
	UserPermissionName string `json:"upname"`
}

UserPermissionKey is the key structure that is used in the database

type UserPermissionManager

type UserPermissionManager interface {
	CreateUserPerm(project, logicalCloud string, c UserPermission) (UserPermission, error)
	GetUserPerm(project, logicalCloud, name string) (UserPermission, error)
	GetAllUserPerms(project, logicalCloud string) ([]UserPermission, error)
	DeleteUserPerm(project, logicalCloud, name string) error
	UpdateUserPerm(project, logicalCloud, name string, c UserPermission) (UserPermission, error)
}

UserPermissionManager is an interface that exposes the connection functionality

Jump to

Keyboard shortcuts

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