config

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright paskal.maksim@gmail.com Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	TemporaryTokenRandLength    = 5
	TemporaryTokenDurationHours = 10

	StaledNewNamespaceDurationDays = 3

	HoursInDay     = 24
	KeyValueLength = 2

	TrueValue = "true"

	LabelScaleDownDelayShort = "scaleDownDelay"

	Namespace             = "kubernetes-manager"
	AnnotationPrefix      = Namespace + "/"
	FilterLabels          = Namespace + "=true"
	LabelType             = Namespace + "/type"
	LabelScaleDownDelay   = Namespace + "/" + LabelScaleDownDelayShort
	LabelLastScaleDate    = Namespace + "/lastScaleDate"
	LabelGitBranch        = Namespace + "/git-branch"
	LabelGitProjectID     = Namespace + "/git-project-id"
	LabelGitProjectOrigin = Namespace + "/git-project-origin"
	LabelRegistryTag      = Namespace + "/registry-tag"
	LabelSystemNamespace  = Namespace + "/system-namespace"
	TagNamespace          = Namespace + "/namespace"
	TagCluster            = Namespace + "/cluster"
	LabelNamespaceCreator = Namespace + "/user-creator"
	LabelProjectProfile   = Namespace + "/profile"
	LabelInstalledProject = Namespace + "/project"
	LabelEnvironmentName  = Namespace + "/environment-name"
	LabelUserLiked        = Namespace + "/user-liked"
	LabelGitSyncOrigin    = Namespace + "/git-sync-origin"
	LabelGitSyncBranch    = Namespace + "/git-sync-branch"
	LabelDescription      = Namespace + "/description"

	HeaderOwner = "X-Owner"
)

Variables

This section is empty.

Functions

func CheckConfig added in v0.2.7

func CheckConfig() error

func GetEnvDefault added in v0.2.7

func GetEnvDefault(name string, defaultValue string) string

func GetVersion

func GetVersion() string

func Load

func Load() error

Types

type Autotest added in v0.4.4

type Autotest struct {
	Pattern           string
	ProjectID         int
	ReportURL         string
	ProgressURL       string
	Actions           []*AutotestAction
	CustomAction      *AutotestCustomAction
	FilterByNamespace bool
}

func (*Autotest) GetActionByTest added in v0.4.4

func (a *Autotest) GetActionByTest(test string) *AutotestAction

type AutotestAction added in v0.4.4

type AutotestAction struct {
	Name    string
	Test    string
	Release string
	Ref     string
}

type AutotestCustomAction added in v0.4.5

type AutotestCustomAction struct {
	ProjectID int
	Tests     []string
	Env       []*AutotestCustomActionEnv
}

func (*AutotestCustomAction) DeepCopy added in v0.4.5

type AutotestCustomActionEnv added in v0.4.5

type AutotestCustomActionEnv struct {
	Name        string
	Default     string
	Description string
	Type        AutotestCustomActionEnvType
}

type AutotestCustomActionEnvType added in v0.4.5

type AutotestCustomActionEnvType string
const (
	AutotestCustomActionEnvList AutotestCustomActionEnvType = "list"
	AutotestCustomActionEnvText AutotestCustomActionEnvType = "text"
)

type Cache added in v0.4.6

type Cache struct {
	Type   string
	Config interface{}
}

type KubernetesEndpoint added in v0.2.7

type KubernetesEndpoint struct {
	Disabled bool
	// set maintenance mode if cluster has some problems
	Maintenance       bool
	Name              string
	KubeConfigPath    string
	KubeConfigServer  string
	Links             *Links
	PipelineVariables map[string]string
}
type Links struct {
	SentryURL     string
	SlackURL      string
	LogsURL       string
	LogsPodURL    string
	PhpMyAdminURL string
	MetricsURL    string
	TracingURL    string
	JiraURL       string
	Others        []OtherLink
}
func (l *Links) FormatedLinks(namespace string) (*Links, error)

type LocalProxy added in v0.4.7

type LocalProxy struct {
	Templates []*LocalProxyTemplate
}

type LocalProxyTemplate added in v0.4.7

type LocalProxyTemplate struct {
	Title    string
	Template string
}

type NamespaceMeta added in v0.4.0

type NamespaceMeta struct {
	Pattern     string
	Labels      map[string]string
	Annotations map[string]string
}

func GetNamespaceMeta added in v0.4.5

func GetNamespaceMeta(ctx context.Context, namespace string) *NamespaceMeta

func (*NamespaceMeta) GetTemplatedValue added in v0.4.6

func (n *NamespaceMeta) GetTemplatedValue(ctx context.Context) *NamespaceMeta
type OtherLink struct {
	Name        string
	URL         string
	Description string
}

type ProjectProfile added in v0.4.1

type ProjectProfile struct {
	Name              string
	NamespaceNameType ProjectProfileNameType
	NamespacePrefix   string
	DefaultPriority   int
	SortPriorities    string // sort priority (comma separated format projectId=number)
	DefaultBranch     string // use default branch for project (comma separated format projectId=main)
	Required          string // project ids to be required (comma separated)
	Exclude           string // project ids to exclude (comma separated) or * for all
	Include           string // project ids to include (comma separated)
	IncludeNamespaced string // project ids to include (comma separated) for namespaced
	PipelineVariables map[string]string
}

func GetProjectProfileByName added in v0.4.1

func GetProjectProfileByName(name string) *ProjectProfile

func GetProjectProfileByNamespace added in v0.4.1

func GetProjectProfileByNamespace(namespace string) *ProjectProfile

func (*ProjectProfile) GetExclude added in v0.4.1

func (p *ProjectProfile) GetExclude() []string

func (*ProjectProfile) GetInclude added in v0.4.1

func (p *ProjectProfile) GetInclude() []string

func (*ProjectProfile) GetIncludeNamespaced added in v0.4.7

func (p *ProjectProfile) GetIncludeNamespaced() []string

func (*ProjectProfile) GetProjectSelectedBranch added in v0.4.3

func (p *ProjectProfile) GetProjectSelectedBranch(projectID int) string

func (*ProjectProfile) GetProjectSortPriority added in v0.4.6

func (p *ProjectProfile) GetProjectSortPriority(projectID int) int

func (*ProjectProfile) GetRequired added in v0.4.1

func (p *ProjectProfile) GetRequired() []string

func (*ProjectProfile) IsProjectRequired added in v0.4.1

func (p *ProjectProfile) IsProjectRequired(projectID int) bool

func (*ProjectProfile) Validate added in v0.4.6

func (p *ProjectProfile) Validate() error

type ProjectProfileNameType added in v0.4.6

type ProjectProfileNameType string
const (
	ProjectProfileNameTypeSimple    ProjectProfileNameType = "simple"
	ProjectProfileNameTypeService   ProjectProfileNameType = "service-name"
	ProjectProfileNameTypeJiraIssue ProjectProfileNameType = "jira-issue"
)

type ProjectSetting added in v0.4.6

type ProjectSetting struct {
	ProjectID   string
	ImagePrefix string
}

type RemoteServer added in v0.4.3

type RemoteServer struct {
	HetznerToken string
	Links        []*OtherLink
}

type Sentry added in v0.4.6

type Sentry struct {
	Endpoint     string
	Token        string
	Organization string
}

type Snapshot added in v0.4.1

type Snapshot struct {
	ProjectID string
	Ref       string
}

type Template added in v0.3.1

type Template struct {
	NamespacePattern string // display template on some namespace
	Display          string
	Data             string
}

type Type

type Type struct {
	GracefulShutdownSeconds *int

	ConfigPath                 *string
	LogLevel                   *string
	Links                      *Links
	BatchEnabled               *bool
	NamespaceMeta              []*NamespaceMeta
	DebugTemplates             []*Template
	ProjectProfiles            []*ProjectProfile
	ProjectSettings            []*ProjectSetting
	KubernetesEndpoints        []*KubernetesEndpoint
	WebListen                  *string
	FrontDist                  *string
	RemoveBranchDaysInactive   *int
	GitlabToken                *string
	GitlabTokenUser            *string
	GitlabURL                  *string
	IngressHostDefaultProtocol *string
	RemoveBranchLastScaleDate  *int
	ExternalServicesTopic      *string
	BatchShedulePeriodSeconds  *int
	PodName                    *string
	PodNamespace               *string
	WebHooks                   []WebHook
	Snapshots                  Snapshot
	RemoteServer               RemoteServer
	Autotests                  []*Autotest
	DelayHours                 *int
	WikiPages                  []*WikiPage
	Cache                      *Cache
	Sentry                     *Sentry
	LocalProxy                 *LocalProxy
}

func Get

func Get() *Type

func (*Type) DeepCopy added in v0.4.0

func (t *Type) DeepCopy() *Type

func (*Type) GetAutotestByID added in v0.4.4

func (t *Type) GetAutotestByID(id string) *Autotest

func (*Type) GetBatchShedulePeriod added in v0.4.5

func (t *Type) GetBatchShedulePeriod() time.Duration

func (*Type) GetDefaultDelay added in v0.4.5

func (t *Type) GetDefaultDelay() string

func (*Type) GetGracefulShutdown added in v0.4.5

func (t *Type) GetGracefulShutdown() time.Duration

func (*Type) GetKubernetesEndpointByName added in v0.4.5

func (t *Type) GetKubernetesEndpointByName(name string) *KubernetesEndpoint

func (*Type) GetKubernetesEndpoints added in v0.4.5

func (t *Type) GetKubernetesEndpoints() []*KubernetesEndpoint

func (*Type) GetProjectSetting added in v0.4.6

func (t *Type) GetProjectSetting(projectID string) *ProjectSetting

func (*Type) String added in v0.4.5

func (t *Type) String() string

type WebHook added in v0.4.0

type WebHook struct {
	Provider string
	Config   interface{}
	IDs      []string
	Events   []types.Event
}

type WikiPage added in v0.4.6

type WikiPage struct {
	Title     string
	ProjectID int
	Slug      string
	Size      int
}

Jump to

Keyboard shortcuts

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