cluster

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package cluster is a generated GoMock package.

Index

Constants

View Source
const (
	ClusterfilterFileName = "clusterignorerule"
)

Variables

This section is empty.

Functions

func AddIfNotExists

func AddIfNotExists(list []string, item string) []string

func DeleteSpecifyDir

func DeleteSpecifyDir(dir string) error

func DeleteSpecifyFile

func DeleteSpecifyFile(filename string) error

func GenerateNodePort

func GenerateNodePort(usedPorts []int) int

func GetApplicationSetElements

func GetApplicationSetElements(data []byte) ([]string, error)

func GetArgoCDHost added in v0.3.0

func GetArgoCDHost(param *ClusterRegistrationParam, apiServer string) (string, error)

func GetHostClusterFromTenantConfigFile added in v0.3.0

func GetHostClusterFromTenantConfigFile(tenantConfigRepoLocalPath, hostClusterName, tenantName string) (*resourcev1alpha1.Cluster, error)

func GetHostClusterNames

func GetHostClusterNames(filePath string) (hostClusterNames []string, err error)

func GetTektonHost added in v0.3.0

func GetTektonHost(param *ClusterRegistrationParam, apiServer string) (string, error)

func GetVclusterNames

func GetVclusterNames(filePath string) (vclusterNames []string, err error)

func IsHostCluser

func IsHostCluser(cluster *resourcev1alpha1.Cluster) bool

func IsPhysical added in v0.3.0

func IsPhysical(cluster *resourcev1alpha1.Cluster) bool

func IsPhysicalDeploymentRuntime added in v0.3.0

func IsPhysicalDeploymentRuntime(cluster *resourcev1alpha1.Cluster) bool

func IsPhysicalProjectPipelineRuntime added in v0.3.0

func IsPhysicalProjectPipelineRuntime(cluster *resourcev1alpha1.Cluster) bool

func IsValidRuntimeAppSetFilename

func IsValidRuntimeAppSetFilename(filename string) bool

func IsVirtual added in v0.3.0

func IsVirtual(cluster *resourcev1alpha1.Cluster) bool

func IsVirtualDeploymentRuntime added in v0.3.0

func IsVirtualDeploymentRuntime(cluster *resourcev1alpha1.Cluster) bool

func IsVirtualProjectPipelineRuntime added in v0.3.0

func IsVirtualProjectPipelineRuntime(cluster *resourcev1alpha1.Cluster) bool

func OverlayTemplateDirectoryPlaceholder added in v0.3.0

func OverlayTemplateDirectoryPlaceholder(nodes *nodestree.Node, placeholder string, replaceValue string)

func RemoveStringFromArray

func RemoveStringFromArray(arr []string, target string) []string

func ReplacePlaceholders

func ReplacePlaceholders(data string, placeholder, value string) string

func ReplaceTemplatePathWithTenantRepositoryPath added in v0.3.0

func ReplaceTemplatePathWithTenantRepositoryPath(filePath, oldDir, newDir string) (newPath string)

func WriteConfigFile

func WriteConfigFile(filePath, content string) error

Types

type ArgocdConfig added in v0.3.0

type ArgocdConfig struct {
	Host    string
	URL     string
	Project string
}

func GetArgocdConfig added in v0.3.0

type CaBundleList added in v0.3.5

type CaBundleList struct {
	Default string
	Gitlab  string
}

type ClusterFileIgnoreConfig added in v0.3.0

type ClusterFileIgnoreConfig struct {
	Save   Save         `yaml:"save"`
	Remove Remove       `yaml:"remove"`
	Common CommonConfig `yaml:"common"`
}

func NewClusterFileIgnoreConfig added in v0.3.0

func NewClusterFileIgnoreConfig(dir string) (*ClusterFileIgnoreConfig, error)

func (*ClusterFileIgnoreConfig) GetRemoveHostClusterConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetRemoveHostClusterConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetRemovePhysicalDeploymentRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetRemovePhysicalDeploymentRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetRemovePhysicalProjectPipelineRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetRemovePhysicalProjectPipelineRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetRemoveVirtualDeploymentRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetRemoveVirtualDeploymentRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetRemoveVirtualProjectPipelineRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetRemoveVirtualProjectPipelineRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetSaveHostClusterConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetSaveHostClusterConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetSavePhysicalDeploymentRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetSavePhysicalDeploymentRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetSavePhysicalProjectPipelineRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetSavePhysicalProjectPipelineRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetSaveVirtualDeploymentRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetSaveVirtualDeploymentRuntimeConfig() (ignorePath, ignoreFile []string)

func (*ClusterFileIgnoreConfig) GetSaveVirtualProjectPipelineRuntimeConfig added in v0.3.0

func (c *ClusterFileIgnoreConfig) GetSaveVirtualProjectPipelineRuntimeConfig() (ignorePath, ignoreFile []string)

type ClusterRegistration

type ClusterRegistration struct {
	Cluster                      *resourcev1alpha1.Cluster
	ClusterResouceFiles          []string
	ClusterTemplateRepoLocalPath string
	TenantConfigRepoLocalPath    string
	RepoURL                      string
	Usage                        ClusterUsage
	HostCluster                  *HostCluster
	HostClusterNames             []string
	VclusterNames                []string
	Vcluster                     *Vcluster
	Runtime                      *Runtime
	Traefik                      *Traefik
	NautesConfigs                nautesconfigs.Nautes
	GitConfigs                   nautesconfigs.GitRepo
	SecretConfigs                nautesconfigs.SecretRepo
	OauthConfigs                 nautesconfigs.OAuth
	CaBundleList                 CaBundleList
}

func (*ClusterRegistration) AddProjectPipelineItem added in v0.3.0

func (cr *ClusterRegistration) AddProjectPipelineItem()

func (*ClusterRegistration) CheckHostClusterDirExists

func (cr *ClusterRegistration) CheckHostClusterDirExists() error

func (*ClusterRegistration) CleanHostClusterAppSet added in v0.3.0

func (cr *ClusterRegistration) CleanHostClusterAppSet() error

func (*ClusterRegistration) CleanVclusterAppSet added in v0.3.0

func (cr *ClusterRegistration) CleanVclusterAppSet() error

func (*ClusterRegistration) CleanupAppSetIfEmpty added in v0.3.0

func (cr *ClusterRegistration) CleanupAppSetIfEmpty() error

func (*ClusterRegistration) DeleteClusterByType

func (cr *ClusterRegistration) DeleteClusterByType() (*nodestree.Node, error)

func (*ClusterRegistration) DeleteClusterToKustomization

func (cr *ClusterRegistration) DeleteClusterToKustomization() (err error)

func (*ClusterRegistration) DeleteClusterToNautes added in v0.3.0

func (cr *ClusterRegistration) DeleteClusterToNautes() error

func (*ClusterRegistration) DeleteHostCluster

func (cr *ClusterRegistration) DeleteHostCluster(nodes *nodestree.Node) error

func (*ClusterRegistration) DeleteRuntime

func (cr *ClusterRegistration) DeleteRuntime(nodes *nodestree.Node) error

func (*ClusterRegistration) DeleteRuntimeAppSet

func (cr *ClusterRegistration) DeleteRuntimeAppSet() error

func (*ClusterRegistration) Execute

func (cr *ClusterRegistration) Execute(nodes *nodestree.Node) error

func (*ClusterRegistration) FilterDeletedClusters added in v0.3.0

func (cr *ClusterRegistration) FilterDeletedClusters() error

FilterDeletedClusters filter deleted clusters from vclusters and return new ones

func (*ClusterRegistration) FilterDeletedProjectPipelineItem added in v0.3.0

func (cr *ClusterRegistration) FilterDeletedProjectPipelineItem() error

func (*ClusterRegistration) GetAndDeleteHostClusterNames

func (cr *ClusterRegistration) GetAndDeleteHostClusterNames() error

func (*ClusterRegistration) GetAndMergeHostClusterNames

func (cr *ClusterRegistration) GetAndMergeHostClusterNames() error

func (*ClusterRegistration) GetAndMergeVclusterNames

func (cr *ClusterRegistration) GetAndMergeVclusterNames() error

func (*ClusterRegistration) GetArgocdURL

func (cr *ClusterRegistration) GetArgocdURL() (string, error)

func (*ClusterRegistration) GetClsuter added in v0.3.1

func (cr *ClusterRegistration) GetClsuter(tenantLocalPath, clusterName string) (*resourcev1alpha1.Cluster, error)

func (*ClusterRegistration) GetClsuters added in v0.3.1

func (cr *ClusterRegistration) GetClsuters(tenantLocalPath string) ([]*resourcev1alpha1.Cluster, error)

func (*ClusterRegistration) GetTektonOAuthURL added in v0.3.0

func (cr *ClusterRegistration) GetTektonOAuthURL() (string, error)

func (*ClusterRegistration) GetTraefikNodePortToHostCluster

func (cr *ClusterRegistration) GetTraefikNodePortToHostCluster(tenantLocalPath, hostClusterName string) (int, error)

func (*ClusterRegistration) GetTraefikNodePortToRuntime added in v0.3.0

func (cr *ClusterRegistration) GetTraefikNodePortToRuntime(tenantLocalPath, clusterName string) (int, error)

func (*ClusterRegistration) InitializeClusterConfig added in v0.3.0

func (cr *ClusterRegistration) InitializeClusterConfig(param *ClusterRegistrationParam) error

InitializeClusterConfig Initialize the configuration information of the cluster, mainly including the host cluster, virtual cluster and runtime configuration information.

func (*ClusterRegistration) LoadTemplateNodesTree

func (cr *ClusterRegistration) LoadTemplateNodesTree(ignorePath, ignoreFile []string) (nodes nodestree.Node, err error)

func (*ClusterRegistration) Remove

func (cr *ClusterRegistration) Remove() error

Remove this function remove cluster configuration based on cluster type

func (*ClusterRegistration) ReplaceTemplatePathWithTenantRepositoryPath added in v0.3.0

func (cr *ClusterRegistration) ReplaceTemplatePathWithTenantRepositoryPath(nodes *nodestree.Node)

func (*ClusterRegistration) Save

func (cr *ClusterRegistration) Save() error

Save this function Create/Update cluster configuration based on cluster type

func (*ClusterRegistration) SaveClusterByType

func (cr *ClusterRegistration) SaveClusterByType() (*nodestree.Node, error)

func (*ClusterRegistration) SaveClusterConfig added in v0.3.0

func (cr *ClusterRegistration) SaveClusterConfig(nodes *nodestree.Node) error

func (*ClusterRegistration) SaveClusterToKustomization

func (cr *ClusterRegistration) SaveClusterToKustomization() (err error)

func (*ClusterRegistration) SaveClusterToNautes added in v0.3.0

func (cr *ClusterRegistration) SaveClusterToNautes() error

func (*ClusterRegistration) SaveHostCluster

func (cr *ClusterRegistration) SaveHostCluster(nodes *nodestree.Node) error

func (*ClusterRegistration) SaveRuntime

func (cr *ClusterRegistration) SaveRuntime(nodes *nodestree.Node) error

type ClusterRegistrationOperator

type ClusterRegistrationOperator interface {
	InitializeClusterConfig(param *ClusterRegistrationParam) error
	Save() error
	Remove() error
	GetArgocdURL() (string, error)
	GetTektonOAuthURL() (string, error)
	GetClsuter(tenantLocalPath, clusterName string) (*resourcev1alpha1.Cluster, error)
	GetClsuters(tenantLocalPath string) ([]*resourcev1alpha1.Cluster, error)
}

func NewClusterRegistration

func NewClusterRegistration() ClusterRegistrationOperator

type ClusterRegistrationParam

type ClusterRegistrationParam struct {
	RepoURL                      string
	ClusterTemplateRepoLocalPath string
	TenantConfigRepoLocalPath    string
	GitRepoHTTPSURL              string
	Vcluster                     *Vcluster
	Cluster                      *resourcev1alpha1.Cluster
	ArgocdHost                   string
	TektonHost                   string
	Traefik                      *Traefik
	Configs                      *nautesconfigs.Config
	CaBundleList                 CaBundleList
}

type ClusterUsage

type ClusterUsage string

type CommonConfig

type CommonConfig struct {
	IgnorePath []string `yaml:"ignorePath"`
	IgnoreFile []string `yaml:"ignoreFile"`
}

type HostCluster

type HostCluster struct {
	Name                 string
	ApiServer            string
	ArgocdProject        string
	PrimaryDomain        string
	Host                 string
	OAuthURL             string
	ProjectPipelineItems []*ProjectPipelineItem
}

type HostClusterConfig

type HostClusterConfig struct {
	IgnorePath []string `yaml:"ignorePath"`
	IgnoreFile []string `yaml:"ignoreFile"`
}

type Ingress added in v0.3.0

type Ingress struct {
	ApiVersion string `yaml:"apiVersion"`
	Kind       string `yaml:"kind"`
	Metadata   struct {
		Name        string `yaml:"name"`
		Namespace   string `yaml:"namespace"`
		Annotations struct {
			IngressClass string `yaml:"kubernetes.io/ingress.class"`
		} `yaml:"annotations"`
	} `yaml:"metadata"`
	Spec struct {
		TLS []struct {
			Hosts []string `yaml:"hosts"`
		} `yaml:"tls"`
		Rules []struct {
			Host string `yaml:"host"`
			HTTP struct {
				Paths []struct {
					Path     string `yaml:"path"`
					PathType string `yaml:"pathType"`
					Backend  struct {
						Service struct {
							Name string `yaml:"name"`
							Port struct {
								Number int `yaml:"number"`
							} `yaml:"port"`
						} `yaml:"service"`
					} `yaml:"backend"`
				} `yaml:"paths"`
			} `yaml:"http"`
		} `yaml:"rules"`
	} `yaml:"spec"`
}

type MockClusterRegistrationOperator

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

MockClusterRegistrationOperator is a mock of ClusterRegistrationOperator interface.

func NewMockClusterRegistrationOperator

func NewMockClusterRegistrationOperator(ctrl *gomock.Controller) *MockClusterRegistrationOperator

NewMockClusterRegistrationOperator creates a new mock instance.

func (*MockClusterRegistrationOperator) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClusterRegistrationOperator) GetArgocdURL

func (m *MockClusterRegistrationOperator) GetArgocdURL() (string, error)

GetArgocdURL mocks base method.

func (*MockClusterRegistrationOperator) GetClsuter added in v0.3.1

func (m *MockClusterRegistrationOperator) GetClsuter(tenantLocalPath, clusterName string) (*v1alpha1.Cluster, error)

GetClsuter mocks base method.

func (*MockClusterRegistrationOperator) GetClsuters added in v0.3.1

func (m *MockClusterRegistrationOperator) GetClsuters(tenantLocalPath string) ([]*v1alpha1.Cluster, error)

GetClsuters mocks base method.

func (*MockClusterRegistrationOperator) GetTektonOAuthURL added in v0.3.0

func (m *MockClusterRegistrationOperator) GetTektonOAuthURL() (string, error)

GetTektonOAuthURL mocks base method.

func (*MockClusterRegistrationOperator) InitializeClusterConfig added in v0.3.0

func (m *MockClusterRegistrationOperator) InitializeClusterConfig(param *ClusterRegistrationParam) error

InitializeClusterConfig mocks base method.

func (*MockClusterRegistrationOperator) Remove

Remove mocks base method.

func (*MockClusterRegistrationOperator) Save

Save mocks base method.

type MockClusterRegistrationOperatorMockRecorder

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

MockClusterRegistrationOperatorMockRecorder is the mock recorder for MockClusterRegistrationOperator.

func (*MockClusterRegistrationOperatorMockRecorder) GetArgocdURL

GetArgocdURL indicates an expected call of GetArgocdURL.

func (*MockClusterRegistrationOperatorMockRecorder) GetClsuter added in v0.3.1

func (mr *MockClusterRegistrationOperatorMockRecorder) GetClsuter(tenantLocalPath, clusterName interface{}) *gomock.Call

GetClsuter indicates an expected call of GetClsuter.

func (*MockClusterRegistrationOperatorMockRecorder) GetClsuters added in v0.3.1

func (mr *MockClusterRegistrationOperatorMockRecorder) GetClsuters(tenantLocalPath interface{}) *gomock.Call

GetClsuters indicates an expected call of GetClsuters.

func (*MockClusterRegistrationOperatorMockRecorder) GetTektonOAuthURL added in v0.3.0

func (mr *MockClusterRegistrationOperatorMockRecorder) GetTektonOAuthURL() *gomock.Call

GetTektonOAuthURL indicates an expected call of GetTektonOAuthURL.

func (*MockClusterRegistrationOperatorMockRecorder) InitializeClusterConfig added in v0.3.0

func (mr *MockClusterRegistrationOperatorMockRecorder) InitializeClusterConfig(param interface{}) *gomock.Call

InitializeClusterConfig indicates an expected call of InitializeClusterConfig.

func (*MockClusterRegistrationOperatorMockRecorder) Remove

Remove indicates an expected call of Remove.

func (*MockClusterRegistrationOperatorMockRecorder) Save

Save indicates an expected call of Save.

type ProjectPipelineItem added in v0.3.0

type ProjectPipelineItem struct {
	Name            string
	HostClusterName string
	TektonConfig    *TektonConfig
}

func ConvertProjectPipeline added in v0.3.0

func ConvertProjectPipeline(ingresses []Ingress, hostClusterName string, httpsNodePort int) []*ProjectPipelineItem

func DeleteProjectPipelineItems added in v0.3.0

func DeleteProjectPipelineItems(itmes []*ProjectPipelineItem, clustrName string) []*ProjectPipelineItem

type Remove

type Remove struct {
	HostCluster                    HostClusterConfig `yaml:"hostCluster"`
	PhysicalDeploymentRuntime      RuntimeConfig     `yaml:"physicalDeploymentRuntime"`
	PhysicalProjectPipelineRuntime RuntimeConfig     `yaml:"physicalProjectPipelineRuntime"`
	VirtualDeploymentRuntime       RuntimeConfig     `yaml:"virtualDeploymentRuntime"`
	VirtualProjectPipelineRuntime  RuntimeConfig     `yaml:"virtualDeploymentRuntime"`
}

type Runtime

type Runtime struct {
	Name                string
	ClusterName         string
	Type                string
	PrimaryDomain       string
	MountPath           string
	ApiServer           string
	OAuthURL            string
	ArgocdConfig        *ArgocdConfig
	TektonConfig        *TektonConfig
	ProjectPipelineItem *ProjectPipelineItem
}

type RuntimeConfig

type RuntimeConfig struct {
	IgnorePath []string `yaml:"ignorePath"`
	IgnoreFile []string `yaml:"ignoreFile"`
}

type Save

type Save struct {
	HostCluster                    HostClusterConfig `yaml:"hostCluster"`
	PhysicalDeploymentRuntime      RuntimeConfig     `yaml:"physicalDeploymentRuntime"`
	PhysicalProjectPipelineRuntime RuntimeConfig     `yaml:"physicalProjectPipelineRuntime"`
	VirtualDeploymentRuntime       RuntimeConfig     `yaml:"virtualDeploymentRuntime"`
	VirtualProjectPipelineRuntime  RuntimeConfig     `yaml:"virtualDeploymentRuntime"`
}

type TektonConfig added in v0.3.0

type TektonConfig struct {
	Host          string
	HttpsNodePort int
	URL           string
}

func GetTektonConfig added in v0.3.0

type Traefik

type Traefik struct {
	HttpNodePort  string
	HttpsNodePort string
}

type Vcluster

type Vcluster struct {
	Name          string
	Namespace     string
	ApiServer     string
	HttpsNodePort string
	TLSSan        string
	HostCluster   *HostCluster
}

Jump to

Keyboard shortcuts

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