interfaces

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CODE_REPO_NAME_PREFIX = "repo"
	PRODUCT_NAME_PREFIX   = "product"
)
View Source
const (
	SECRET_TYPE_GIT      = 1
	SECRET_TYPE_ARTIFACT = 2
	SECRET_TYPE_CLUSTER  = 3
	SECRET_TYPE_TENANT   = 4
)
View Source
const (
	CodeRepoPermissionReadOnly    = "readonly"
	CodeRepoPermissionReadWrite   = "readwrite"
	CodeRepoPermissionAccessToken = "accesstoken-api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessInfo

type AccessInfo struct {
	Name string
	Type AccessType
	// TODO ssh type should replace to  go package structure in the future
	SSH        []*string
	Kubernetes *rest.Config
}

type AccessType

type AccessType string
const (
	ACCESS_TYPE_K8S AccessType = "kubernetes"
)

type AdditionalResource

type AdditionalResource struct {
	Type  string
	Name  string
	Error error
}

type ArifactRepo

type ArifactRepo struct {
	ProviderName string
	RepoType     string
	ID           string
	User         string
	Permission   string
}

type Auth

type Auth interface {
	GetRole(ctx context.Context, authName string, role Role) (*Role, error)
	CreateRole(ctx context.Context, authName string, role Role) error
	DeleteRole(ctx context.Context, authName string, role Role) error
}

type Cluster

type Cluster interface {
	GetAccessInfo(ctx context.Context, clusterName string) (string, error)
}

type CodeRepo

type CodeRepo struct {
	ProviderType string
	ID           string
	User         string
	Permission   CodeRepoPermission
}

type CodeRepoPermission added in v0.3.0

type CodeRepoPermission string

type Deployment

type Deployment interface {
	Deploy(ctx context.Context, task RuntimeSyncTask) (*DeploymentDeploymentResult, error)
	UnDeploy(ctx context.Context, task RuntimeSyncTask) error
}

type DeploymentDeploymentResult added in v0.3.1

type DeploymentDeploymentResult struct {
	Source string
}

type EnvManager

type EnvManager interface {
	GetAccessInfo(ctx context.Context, cluster nautescrd.Cluster) (*AccessInfo, error)
	Sync(ctx context.Context, task RuntimeSyncTask) (*EnvironmentDeploymentResult, error)
	Remove(ctx context.Context, task RuntimeSyncTask) error
}

type EnvironmentDeploymentResult added in v0.3.1

type EnvironmentDeploymentResult struct {
	AdditionalResources []AdditionalResource
	Error               error
}

type EventBus added in v0.3.0

type EventBus interface {
	SyncEvents(ctx context.Context, task RuntimeSyncTask) (*EventBusDeploymentResult, error)
	RemoveEvents(ctx context.Context, task RuntimeSyncTask) error
}

type EventBusDeploymentResult added in v0.3.1

type EventBusDeploymentResult struct{}

type Pipeline added in v0.3.0

type Pipeline interface {
	DeployPipelineRuntime(ctx context.Context, task RuntimeSyncTask) error
	UnDeployPipelineRuntime(ctx context.Context, task RuntimeSyncTask) error
}

type Role

type Role struct {
	Name   string
	Users  []string
	Groups []string
}

type Runtime

type Runtime interface {
	GetProduct() string
	GetName() string
	GetDestination() string
}

type RuntimeDeploymentResult added in v0.3.1

type RuntimeDeploymentResult struct {
	Cluster                     string
	App                         SelectedApp
	DeploymentDeploymentResult  *DeploymentDeploymentResult
	EnvironmentDeploymentResult *EnvironmentDeploymentResult
	EventBusDeploymentResult    *EventBusDeploymentResult
}

type RuntimeSyncTask added in v0.3.0

type RuntimeSyncTask struct {
	// AccessInfo use to connect dest environment, like kubeconfig of kubernetes.
	AccessInfo AccessInfo
	// Product store the runtime's product resource.
	Product nautescrd.Product
	// Cluster store runtime's cluster resource.
	Cluster     nautescrd.Cluster
	HostCluster *nautescrd.Cluster
	NautesCfg   nautescfg.Config
	// Runtime is the runtime resource of this sync, it chould be pipeline runtime or deployment runtime.
	Runtime     Runtime
	RuntimeType RuntimeType
	// ServiceAccountName is the authorized account name in k8s, it can get secrets from secret store, create resource in runtime namespace, etc.
	ServiceAccountName string
}

RuntimeSyncTask stores all the information needed during the deployment processe.

func (*RuntimeSyncTask) GetLabel added in v0.3.0

func (t *RuntimeSyncTask) GetLabel() map[string]string

type RuntimeSyncer added in v0.3.0

type RuntimeSyncer interface {
	Sync(ctx context.Context, runtime Runtime) (*RuntimeDeploymentResult, error)
	Delete(ctx context.Context, runtime Runtime) error
}

RuntimeSyncer is use to deploy or clean up runtime in dest environment. It can handle any type of runtime.

type RuntimeType

type RuntimeType string
const (
	RUNTIME_TYPE_DEPLOYMENT RuntimeType = "deployment"
	RUNTIME_TYPE_PIPELINE   RuntimeType = "pipeline"
)

type Secret

type Secret interface {
	// find out secret database name by giving secret info
	GetSecretDatabaseName(ctx context.Context, repo SecretInfo) (string, error)
	GetSecretKey(ctx context.Context, repo SecretInfo) (string, error)
	GrantPermission(ctx context.Context, repo SecretInfo, destUser, destEnv string) error
	RevokePermission(ctx context.Context, repo SecretInfo, destUser, destEnv string) error
}

type SecretClient

type SecretClient interface {
	Cluster
	Secret
	Auth
	// GetCABundle should return the cacert information of the server. If the server does not use TLS, it should return empty.
	GetCABundle(ctx context.Context) (string, error)
	Logout() error
}

type SecretInfo

type SecretInfo struct {
	Type          SecretType
	CodeRepo      *CodeRepo
	AritifaceRepo *ArifactRepo
}

type SecretType

type SecretType int32

type SelectedApp added in v0.3.1

type SelectedApp struct {
	Pipeline    string
	Deploy      string
	EventBus    string
	Environment string
}

SelectedApp records the specific app name used during deployment.

Jump to

Keyboard shortcuts

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