config

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 15 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"
	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
	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 KubernetesEndpoint added in v0.2.7

type KubernetesEndpoint struct {
	Disabled         bool
	Name             string
	KubeConfigPath   string
	KubeConfigServer string
	Links            *Links
}
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 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(namespace string) *NamespaceMeta
type OtherLink struct {
	Name        string
	URL         string
	Description string
}

type ProjectProfile added in v0.4.1

type ProjectProfile struct {
	Name            string
	NamespacePrefix string
	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)
	Include         string // project ids to include (comma separated)
}

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) GetProjectSelectedBranch added in v0.4.3

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

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

type RemoteServer added in v0.4.3

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

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
	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
}

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) 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
}

Jump to

Keyboard shortcuts

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