cluster

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 19 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 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:"validate-non-empty-url"`
	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 ClusterService

type ClusterService interface {
	Save(parent context.Context, 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(ctx context.Context, bean *ClusterBean, userId int32) (*ClusterBean, error)
	Delete(bean *ClusterBean, userId int32) error

	FindAllForAutoComplete() ([]ClusterBean, error)
	CreateGrafanaDataSource(clusterBean *ClusterBean, env *repository.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 repository.ClusterRepository, logger *zap.SugaredLogger,
	K8sUtil *util.K8sUtil) *ClusterServiceImpl

func (*ClusterServiceImpl) CreateGrafanaDataSource

func (impl *ClusterServiceImpl) CreateGrafanaDataSource(clusterBean *ClusterBean, env *repository.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(parent context.Context, bean *ClusterBean, userId int32) (*ClusterBean, error)

func (*ClusterServiceImpl) Update

func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *ClusterBean, userId int32) (*ClusterBean, error)

type ClusterServiceImplExtended added in v0.3.9

type ClusterServiceImplExtended struct {
	*ClusterServiceImpl
	// contains filtered or unexported fields
}

extends ClusterServiceImpl and enhances method of ClusterService with full mode specific errors

func NewClusterServiceImplExtended added in v0.3.9

func NewClusterServiceImplExtended(repository repository.ClusterRepository, environmentRepository repository.EnvironmentRepository,
	grafanaClient grafana.GrafanaClient, logger *zap.SugaredLogger, installedAppRepository appstore.InstalledAppRepository,
	K8sUtil *util.K8sUtil,
	clusterServiceCD cluster2.ServiceClient) *ClusterServiceImplExtended

func (*ClusterServiceImplExtended) CreateGrafanaDataSource added in v0.3.9

func (impl *ClusterServiceImplExtended) CreateGrafanaDataSource(clusterBean *ClusterBean, env *repository.Environment) (int, error)

func (*ClusterServiceImplExtended) FindAll added in v0.3.9

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

func (*ClusterServiceImplExtended) Save added in v0.3.9

func (impl *ClusterServiceImplExtended) Save(ctx context.Context, bean *ClusterBean, userId int32) (*ClusterBean, error)

func (*ClusterServiceImplExtended) Update added in v0.3.9

func (impl *ClusterServiceImplExtended) Update(ctx context.Context, 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) (*repository.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 repository.EnvironmentRepository,
	clusterService ClusterService, logger *zap.SugaredLogger,
	K8sUtil *util.K8sUtil,
	propertiesConfigService pipeline.PropertiesConfigService,
) *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) (*repository.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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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