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: 34 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Testvars _testvars

Functions

func GetGitOpsType

func GetGitOpsType(ctx context.Context, clustername string) (string, error)

func Instantiate

func Instantiate(ctx context.Context, project string, logicalcloud common.LogicalCloud, clusterList []common.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(ctx context.Context, 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 IsGitOpsCluster

func IsGitOpsCluster(ctx context.Context, clustername string) (bool, error)

func Stop

func Stop(ctx context.Context, project string, logicalcloud common.LogicalCloud) error

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

func Terminate

func Terminate(ctx context.Context, project string, logicalcloud common.LogicalCloud, clusterList []common.Cluster,
	quotaList []Quota) error

Terminate asks rsync to terminate the logical cloud

Types

type AnthosGit

type AnthosGit struct {
	Repo        string `yaml:"repo"`
	Revision    string `yaml:"revision"`
	Branch      string `yaml:"branch"`
	Dir         string `yaml:"dir"`
	Auth        string `yaml:"auth"`
	NoSSLVerify bool   `yaml:"noSSLVerify"`
}

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 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(ctx context.Context, project, logicalCloud string, clusterReference common.Cluster) (common.Cluster, error)

Create entry for the cluster reference resource in the database

func (*ClusterClient) DeleteCluster

func (v *ClusterClient) DeleteCluster(ctx context.Context, project, logicalCloud, clusterReference string) error

Delete the Cluster reference entry from database

func (*ClusterClient) GetAllClusters

func (v *ClusterClient) GetAllClusters(ctx context.Context, project, logicalCloud string) ([]common.Cluster, error)

GetAll returns all cluster references in the logical cloud

func (*ClusterClient) GetCluster

func (v *ClusterClient) GetCluster(ctx context.Context, project, logicalCloud, clusterReference string) (common.Cluster, error)

Get returns Cluster for corresponding cluster reference

func (*ClusterClient) GetClusterConfig

func (v *ClusterClient) GetClusterConfig(ctx context.Context, project, logicalCloud, clusterReference string) (string, error)

Get returns Cluster's kubeconfig for corresponding cluster reference

func (*ClusterClient) UpdateCluster

func (v *ClusterClient) UpdateCluster(ctx context.Context, project, logicalCloud, clusterReference string, c common.Cluster) (common.Cluster, error)

Update an entry for the Cluster reference in the database

type ClusterManager

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

ClusterManager is an interface that exposes the connection functionality

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(ctx context.Context, project, logicalCloud string, c KeyValue) (KeyValue, error)

Create entry for the key value resource in the database

func (*KeyValueClient) DeleteKVPair

func (v *KeyValueClient) DeleteKVPair(ctx context.Context, project, logicalCloud, kvPairName string) error

Delete the Key Value entry from database

func (*KeyValueClient) GetAllKVPairs

func (v *KeyValueClient) GetAllKVPairs(ctx context.Context, project, logicalCloud string) ([]KeyValue, error)

Get All lists all key value pairs

func (*KeyValueClient) GetKVPair

func (v *KeyValueClient) GetKVPair(ctx context.Context, project, logicalCloud, kvPairName string) (KeyValue, error)

Get returns Key Value for correspondin name

func (*KeyValueClient) UpdateKVPair

func (v *KeyValueClient) UpdateKVPair(ctx context.Context, 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:"logicalCloud"`
	KeyValueName     string `json:"logicalCloudKv"`
}

KeyValueKey is the key structure that is used in the database

type KeyValueManager

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

KeyValueManager is an interface that exposes the connection functionality

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

Create entry for the logical cloud resource in the database

func (*LogicalCloudClient) Delete

func (v *LogicalCloudClient) Delete(ctx context.Context, project, logicalCloudName string) error

Delete the Logical Cloud entry from database

func (*LogicalCloudClient) GenericStatus

func (v *LogicalCloudClient) GenericStatus(ctx context.Context, p, lc, qStatusInstance, qType, qOutput string, fClusters, fResources []string) (status.StatusResult, error)

func (*LogicalCloudClient) Get

func (v *LogicalCloudClient) Get(ctx context.Context, project, logicalCloudName string) (common.LogicalCloud, error)

Get returns Logical Cloud corresponding to logical cloud name

func (*LogicalCloudClient) GetAll

func (v *LogicalCloudClient) GetAll(ctx context.Context, project string) ([]common.LogicalCloud, error)

GetAll returns Logical Clouds in the project

func (*LogicalCloudClient) GetState

func (v *LogicalCloudClient) GetState(ctx context.Context, p string, lc string) (state.StateInfo, error)

GetState returns the LogicalCloud StateInfo with a given logical cloud name and project

func (*LogicalCloudClient) Status

func (v *LogicalCloudClient) Status(ctx context.Context, p, lc, qStatusInstance, qType, qOutput string, fClusters, fResources []string) (status.LogicalCloudStatus, error)

func (*LogicalCloudClient) StatusClusters

func (v *LogicalCloudClient) StatusClusters(ctx context.Context, p, lc, qStatusInstance string) (status.LogicalCloudClustersStatus, error)

func (*LogicalCloudClient) StatusResources

func (v *LogicalCloudClient) StatusResources(ctx context.Context, p, lc, qStatusInstance, qType string, fClusters []string) (status.LogicalCloudResourcesStatus, error)

func (*LogicalCloudClient) UpdateInstantiation

func (v *LogicalCloudClient) UpdateInstantiation(ctx context.Context, project, logicalCloudName string, c common.LogicalCloud) (common.LogicalCloud, error)

Update an entry for the Logical Cloud in the database

func (*LogicalCloudClient) UpdateLogicalCloud

func (v *LogicalCloudClient) UpdateLogicalCloud(ctx context.Context, project, logicalCloudName string, c common.LogicalCloud) (common.LogicalCloud, error)

Update an entry for the Logical Cloud in the database

type LogicalCloudManager

type LogicalCloudManager interface {
	Create(ctx context.Context, project string, c common.LogicalCloud) (common.LogicalCloud, error)
	Get(ctx context.Context, project, name string) (common.LogicalCloud, error)
	GetAll(ctx context.Context, project string) ([]common.LogicalCloud, error)
	GetState(ctx context.Context, p string, lc string) (state.StateInfo, error)
	Delete(ctx context.Context, project, name string) error
	GenericStatus(ctx context.Context, project, name, qStatusInstance, qType, qOutput string, fClusters, fResources []string) (status.StatusResult, error)
	StatusClusters(ctx context.Context, p, lc, qStatusInstance string) (status.LogicalCloudClustersStatus, error)
	StatusResources(ctx context.Context, p, lc, qStatusInstance, qType string, fClusters []string) (status.LogicalCloudResourcesStatus, error)
	Status(ctx context.Context, p, lc, qStatusInstance, qType, qOutput string, fClusters, fResources []string) (status.LogicalCloudStatus, error)
	UpdateLogicalCloud(ctx context.Context, project, name string, c common.LogicalCloud) (common.LogicalCloud, error)
	UpdateInstantiation(ctx context.Context, project, name string, c common.LogicalCloud) (common.LogicalCloud, error)
}

LogicalCloudManager is an interface that exposes the connection functionality

type MetaDatas

type MetaDatas struct {
	Name      string            `yaml:"name"`
	Namespace string            `yaml:"namespace,omitempty"`
	Labels    map[string]string `yaml:"labels,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(ctx context.Context, project, logicalCloud string, c Quota) (Quota, error)

Create entry for the quota resource in the database

func (*QuotaClient) DeleteQuota

func (v *QuotaClient) DeleteQuota(ctx context.Context, project, logicalCloud, quotaName string) error

Delete the Quota entry from database

func (*QuotaClient) GetAllQuotas

func (v *QuotaClient) GetAllQuotas(ctx context.Context, project, logicalCloud string) ([]Quota, error)

GetAll returns all cluster quotas in the logical cloud

func (*QuotaClient) GetQuota

func (v *QuotaClient) GetQuota(ctx context.Context, project, logicalCloud, quotaName string) (Quota, error)

Get returns Quota for corresponding quota name

func (*QuotaClient) UpdateQuota

func (v *QuotaClient) UpdateQuota(ctx context.Context, 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:"logicalCloud"`
	QuotaName        string `json:"clusterQuota"`
}

QuotaKey is the key structure that is used in the database

type QuotaManager

type QuotaManager interface {
	CreateQuota(ctx context.Context, project, logicalCloud string, c Quota) (Quota, error)
	GetQuota(ctx context.Context, project, logicalCloud, name string) (Quota, error)
	GetAllQuotas(ctx context.Context, project, logicalCloud string) ([]Quota, error)
	DeleteQuota(ctx context.Context, project, logicalCloud, name string) error
	UpdateQuota(ctx context.Context, 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"`
	NameSpace string `yaml:"namespace,omitempty"`
}

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 Specs

type Specs struct {
	Request    string   `yaml:"request,omitempty"`    // for CSR
	Usages     []string `yaml:"usages,omitempty"`     // for CSR
	SignerName string   `yaml:"signerName,omitempty"` // for CSR
	// TODO: validate quota keys
	// //Hard           logicalcloud.QSpec    `yaml:"hard,omitempty"`
	// Hard QSpec `yaml:"hard,omitempty"`
	Hard map[string]string `yaml:"hard,omitempty"` // for Quotas
	Git  AnthosGit         `yaml:"git,omitempty"`  // for Anthos RepoSync
}

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 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(ctx context.Context, project, logicalCloud string, c UserPermission) (UserPermission, error)

Create entry for the User Permission resource in the database

func (*UserPermissionClient) DeleteUserPerm

func (v *UserPermissionClient) DeleteUserPerm(ctx context.Context, project, logicalCloud, userPermName string) error

Delete the User Permission entry from database

func (*UserPermissionClient) GetAllUserPerms

func (v *UserPermissionClient) GetAllUserPerms(ctx context.Context, project, logicalCloud string) ([]UserPermission, error)

GetAll lists all user permissions

func (*UserPermissionClient) GetUserPerm

func (v *UserPermissionClient) GetUserPerm(ctx context.Context, project, logicalCloud, userPermName string) (UserPermission, error)

Get returns User Permission for corresponding name

func (*UserPermissionClient) UpdateUserPerm

func (v *UserPermissionClient) UpdateUserPerm(ctx context.Context, 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:"logicalCloud"`
	UserPermissionName string `json:"userPermission"`
}

UserPermissionKey is the key structure that is used in the database

type UserPermissionManager

type UserPermissionManager interface {
	CreateUserPerm(ctx context.Context, project, logicalCloud string, c UserPermission) (UserPermission, error)
	GetUserPerm(ctx context.Context, project, logicalCloud, name string) (UserPermission, error)
	GetAllUserPerms(ctx context.Context, project, logicalCloud string) ([]UserPermission, error)
	DeleteUserPerm(ctx context.Context, project, logicalCloud, name string) error
	UpdateUserPerm(ctx context.Context, 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