Help us shape the future of Go! Take the 2026 Go Developer Survey

cluster

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: Apache-2.0 Imports: 15 Imported by: 28

Documentation

Index

Constants

View Source
const ClusterName = "default_cluster"
View Source
const TokenFilePath = "/var/run/secrets/kubernetes.io/serviceaccount/token"

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterAccountsBean

type ClusterAccountsBean struct {
	Id      int             `json:"id"`
	Account string          `json:"account"`
	Config  json.RawMessage `json:"config"`
	//Environment string          `json:"environment, omitempty"`
	//ClusterName string          `json:"cluster_name, omitempty"`
	//Namespace   string          `json:"namespace, omitempty"`
	Default   bool `json:"default, omitempty"`
	ClusterId int  `json:"cluster_id"`
}

type ClusterAccountsService

type ClusterAccountsService interface {
	Save(account *ClusterAccountsBean, userId int32) error
	FindOne(clusterName string) (*ClusterAccountsBean, error)
	FindOneByEnvironment(environment string) (*ClusterAccountsBean, error)
	Update(account *ClusterAccountsBean, userId int32) error

	FindById(id int) (*ClusterAccountsBean, error)
	FindAll() ([]ClusterAccountsBean, error)
}

type ClusterAccountsServiceImpl

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

func NewClusterAccountsServiceImpl

func NewClusterAccountsServiceImpl(repository cluster.ClusterAccountsRepository,
	environmentClusterMappingsRepository cluster.EnvironmentRepository,
	clusterService ClusterService, logger *zap.SugaredLogger) *ClusterAccountsServiceImpl

func (ClusterAccountsServiceImpl) FindAll

func (ClusterAccountsServiceImpl) FindById

func (ClusterAccountsServiceImpl) FindOne

func (impl ClusterAccountsServiceImpl) FindOne(clusterName string) (*ClusterAccountsBean, error)

func (ClusterAccountsServiceImpl) FindOneByEnvironment

func (impl ClusterAccountsServiceImpl) FindOneByEnvironment(environment string) (*ClusterAccountsBean, error)

func (ClusterAccountsServiceImpl) Save

func (impl ClusterAccountsServiceImpl) Save(request *ClusterAccountsBean, userId int32) error

func (ClusterAccountsServiceImpl) Update

func (impl ClusterAccountsServiceImpl) Update(request *ClusterAccountsBean, userId int32) error

type ClusterBean

type ClusterBean struct {
	Id                      int                        `json:"id,omitempty" validate:"number"`
	ClusterName             string                     `json:"cluster_name,omitempty" validate:"required"`
	ServerUrl               string                     `json:"server_url,omitempty" validate:"url,required"`
	PrometheusUrl           string                     `json:"prometheus_url,omitempty" validate:"url,required"`
	Active                  bool                       `json:"active"`
	Config                  map[string]string          `json:"config,omitempty" validate:"required"`
	PrometheusAuth          *PrometheusAuth            `json:"prometheusAuth,omitempty"`
	DefaultClusterComponent []*DefaultClusterComponent `json:"defaultClusterComponent"`
	AgentInstallationStage  int                        `json:"agentInstallationStage,notnull"` // -1=external, 0=not triggered, 1=progressing, 2=success, 3=fails
	K8sVersion              string                     `json:"k8sVersion"`
}

type ClusterHelmConfigBean

type ClusterHelmConfigBean struct {
	ClusterName string `json:"cluster_name"`
	Environment string `json:"environment"`
	TillerUrl   string `json:"tiller_url"`
	TillerCert  string `json:"tiller_cert"`
	TillerKey   string `json:"tiller_key"`
	Active      bool   `json:"active"`
}

type ClusterHelmConfigService

type ClusterHelmConfigService interface {
	Save(clusterHelmConfigBean *ClusterHelmConfigBean, userId int32) error
	FindOneByEnvironment(environment string) (*ClusterHelmConfigBean, error)
}

type ClusterHelmConfigServiceImpl

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

func NewClusterHelmConfigServiceImpl

func NewClusterHelmConfigServiceImpl(repository cluster.ClusterHelmConfigRepository, clusterService ClusterService, logger *zap.SugaredLogger) *ClusterHelmConfigServiceImpl

func (ClusterHelmConfigServiceImpl) FindOneByEnvironment

func (impl ClusterHelmConfigServiceImpl) FindOneByEnvironment(environment string) (*ClusterHelmConfigBean, error)

func (ClusterHelmConfigServiceImpl) Save

type ClusterService

type ClusterService interface {
	Save(bean *ClusterBean, userId int32) (*ClusterBean, error)
	FindOne(clusterName string) (*ClusterBean, error)
	FindOneActive(clusterName string) (*ClusterBean, error)
	FindAll() ([]*ClusterBean, error)
	FindAllActive() ([]ClusterBean, error)

	FindById(id int) (*ClusterBean, error)
	FindByIds(id []int) ([]ClusterBean, error)
	Update(bean *ClusterBean, userId int32) (*ClusterBean, error)
	Delete(bean *ClusterBean, userId int32) error

	FindAllForAutoComplete() ([]ClusterBean, error)
	CreateGrafanaDataSource(clusterBean *ClusterBean, env *cluster.Environment) (int, error)
	GetClusterConfig(cluster *ClusterBean) (*util.ClusterConfig, error)
}

type ClusterServiceImpl

type ClusterServiceImpl struct {
	K8sUtil *util.K8sUtil
	// contains filtered or unexported fields
}

func NewClusterServiceImpl

func NewClusterServiceImpl(repository cluster.ClusterRepository, environmentRepository cluster.EnvironmentRepository,
	grafanaClient grafana.GrafanaClient, logger *zap.SugaredLogger, installedAppRepository appstore.InstalledAppRepository,
	clusterInstalledAppsRepository appstore.ClusterInstalledAppsRepository, K8sUtil *util.K8sUtil) *ClusterServiceImpl

func (ClusterServiceImpl) CreateGrafanaDataSource

func (impl ClusterServiceImpl) CreateGrafanaDataSource(clusterBean *ClusterBean, env *cluster.Environment) (int, error)

func (ClusterServiceImpl) Delete

func (impl ClusterServiceImpl) Delete(bean *ClusterBean, userId int32) error

func (ClusterServiceImpl) FindAll

func (impl ClusterServiceImpl) FindAll() ([]*ClusterBean, error)

func (ClusterServiceImpl) FindAllActive

func (impl ClusterServiceImpl) FindAllActive() ([]ClusterBean, error)

func (ClusterServiceImpl) FindAllForAutoComplete

func (impl ClusterServiceImpl) FindAllForAutoComplete() ([]ClusterBean, error)

func (ClusterServiceImpl) FindById

func (impl ClusterServiceImpl) FindById(id int) (*ClusterBean, error)

func (ClusterServiceImpl) FindByIds

func (impl ClusterServiceImpl) FindByIds(ids []int) ([]ClusterBean, error)

func (ClusterServiceImpl) FindOne

func (impl ClusterServiceImpl) FindOne(clusterName string) (*ClusterBean, error)

func (ClusterServiceImpl) FindOneActive

func (impl ClusterServiceImpl) FindOneActive(clusterName string) (*ClusterBean, error)

func (ClusterServiceImpl) GetClusterConfig added in v0.2.8

func (impl ClusterServiceImpl) GetClusterConfig(cluster *ClusterBean) (*util.ClusterConfig, error)

func (ClusterServiceImpl) Save

func (impl ClusterServiceImpl) Save(bean *ClusterBean, userId int32) (*ClusterBean, error)

func (ClusterServiceImpl) Update

func (impl ClusterServiceImpl) Update(bean *ClusterBean, userId int32) (*ClusterBean, error)

type DefaultClusterComponent

type DefaultClusterComponent struct {
	ComponentName  string `json:"name"`
	AppId          int    `json:"appId"`
	InstalledAppId int    `json:"installedAppId,omitempty"`
	EnvId          int    `json:"envId"`
	EnvName        string `json:"envName"`
	Status         string `json:"status"`
}

type EnvironmentBean

type EnvironmentBean struct {
	Id                 int    `json:"id,omitempty" validate:"number"`
	Environment        string `json:"environment_name,omitempty" validate:"required,max=50"`
	ClusterId          int    `json:"cluster_id,omitempty" validate:"number,required"`
	ClusterName        string `json:"cluster_name,omitempty"`
	Active             bool   `json:"active"`
	Default            bool   `json:"default"`
	PrometheusEndpoint string `json:"prometheus_endpoint,omitempty"`
	Namespace          string `json:"namespace,omitempty" validate:"max=50"`
	CdArgoSetup        bool   `json:"isClusterCdActive"`
}

type EnvironmentService

type EnvironmentService interface {
	FindOne(environment string) (*EnvironmentBean, error)
	Create(mappings *EnvironmentBean, userId int32) (*EnvironmentBean, error)
	GetAll() ([]EnvironmentBean, error)
	GetAllActive() ([]EnvironmentBean, error)

	FindById(id int) (*EnvironmentBean, error)
	Update(mappings *EnvironmentBean, userId int32) (*EnvironmentBean, error)
	FindClusterByEnvId(id int) (*ClusterBean, error)
	GetEnvironmentListForAutocomplete() ([]EnvironmentBean, error)
	FindByIds(ids []*int) ([]*EnvironmentBean, error)
	FindByNamespaceAndClusterName(namespaces string, clusterName string) (*cluster.Environment, error)
	GetByClusterId(id int) ([]*EnvironmentBean, error)
}

type EnvironmentServiceImpl

type EnvironmentServiceImpl struct {
	K8sUtil *util.K8sUtil
	// contains filtered or unexported fields
}

func NewEnvironmentServiceImpl

func NewEnvironmentServiceImpl(environmentRepository cluster.EnvironmentRepository,
	clusterService ClusterService, logger *zap.SugaredLogger,
	K8sUtil *util.K8sUtil,
	propertiesConfigService pipeline.PropertiesConfigService,
	grafanaClient grafana.GrafanaClient,
) *EnvironmentServiceImpl

func (EnvironmentServiceImpl) Create

func (impl EnvironmentServiceImpl) Create(mappings *EnvironmentBean, userId int32) (*EnvironmentBean, error)

func (EnvironmentServiceImpl) FindById

func (impl EnvironmentServiceImpl) FindById(id int) (*EnvironmentBean, error)

func (EnvironmentServiceImpl) FindByIds

func (impl EnvironmentServiceImpl) FindByIds(ids []*int) ([]*EnvironmentBean, error)

func (EnvironmentServiceImpl) FindByNamespaceAndClusterName

func (impl EnvironmentServiceImpl) FindByNamespaceAndClusterName(namespaces string, clusterName string) (*cluster.Environment, error)

func (EnvironmentServiceImpl) FindClusterByEnvId

func (impl EnvironmentServiceImpl) FindClusterByEnvId(id int) (*ClusterBean, error)

func (EnvironmentServiceImpl) FindOne

func (impl EnvironmentServiceImpl) FindOne(environment string) (*EnvironmentBean, error)

func (EnvironmentServiceImpl) GetAll

func (impl EnvironmentServiceImpl) GetAll() ([]EnvironmentBean, error)

func (EnvironmentServiceImpl) GetAllActive

func (impl EnvironmentServiceImpl) GetAllActive() ([]EnvironmentBean, error)

func (EnvironmentServiceImpl) GetByClusterId

func (impl EnvironmentServiceImpl) GetByClusterId(id int) ([]*EnvironmentBean, error)

func (EnvironmentServiceImpl) GetEnvironmentListForAutocomplete

func (impl EnvironmentServiceImpl) GetEnvironmentListForAutocomplete() ([]EnvironmentBean, error)

func (EnvironmentServiceImpl) Update

func (impl EnvironmentServiceImpl) Update(mappings *EnvironmentBean, userId int32) (*EnvironmentBean, error)

type PrometheusAuth

type PrometheusAuth struct {
	UserName      string `json:"userName,omitempty"`
	Password      string `json:"password,omitempty"`
	TlsClientCert string `json:"tlsClientCert,omitempty"`
	TlsClientKey  string `json:"tlsClientKey,omitempty"`
}

Jump to

Keyboard shortcuts

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