internal

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvBase      = "base"
	EnvStaging   = "staging"
	EnvPreActive = "pre-active"
	EnvActive    = "active"
	EnvDeActive  = "de-active"
)
View Source
const (
	// URIHealthz represents URI for health check
	URIHealthz = "/healthz"
	URIVersion = "/version"

	//SamsahaiCtrlName           = "samsahai-ctrl"
	SamsahaiAuthHeader  = "x-samsahai-auth"
	SamsahaiDefaultPort = "8080"

	StagingCtrlName    = "s2h-staging-ctrl"
	StagingDefaultPort = 8090

	// Viper keys
	VKDebug                           = "debug"
	VKServerHTTPPort                  = "port"
	VKMetricHTTPPort                  = "metric-port"
	VKPodNamespace                    = "pod-namespace"
	VKS2HConfigPath                   = "s2h-config-path"
	VKClusterDomain                   = "cluster-domain"
	VKS2HTeamName                     = "s2h-team-name"
	VKS2HAuthToken                    = "s2h-auth-token"
	VKS2HServerURL                    = "s2h-server-url"
	VKS2HServiceName                  = "s2h-service-name"
	VKS2HServiceScheme                = "s2h-service-scheme"
	VKS2HImage                        = "s2h-image"
	VKS2HHTTPProxy                    = "http-proxy"
	VKS2HHTTPSProxy                   = "https-proxy"
	VKS2HNoProxy                      = "no-proxy"
	VKS2HExternalURL                  = "s2h-external-url"
	VKTeamcityURL                     = "teamcity-url"
	VKTeamcityUsername                = "teamcity-username"
	VKTeamcityPassword                = "teamcity-password"
	VKSlackToken                      = "slack-token"
	VKActivePromotionConcurrences     = "active-promotion-concurrences"
	VKActivePromotionTimeout          = "active-promotion-timeout"
	VKActivePromotionDemotionTimeout  = "active-demotion-timeout"
	VKActivePromotionRollbackTimeout  = "active-promotion-rollback-timeout"
	VKActivePromotionTearDownDuration = "active-promotion-teardown-duration"
	VKActivePromotionMaxHistories     = "active-promotion-max-histories"
	VKQueueMaxHistoryDays             = "queue-max-history-days"
)
View Source
const AbbreviationName = "s2h"
View Source
const AppName = "samsahai"
View Source
const AppPrefix = AbbreviationName + "-"
View Source
const (
	MaxReleaseNameLength = 200
)

Variables

View Source
var GitCommit string

GitCommit defines commit hash of git during built

View Source
var Version string

Version defines the version of application

Functions

func GenReleaseName

func GenReleaseName(teamName, namespace, compName string) string

GenReleaseName returns the release name for deploying components

func GenStagingNamespace

func GenStagingNamespace(teamName string) string

GenStagingNamespace returns the name of staging namespace by team name

func GetDefaultLabels

func GetDefaultLabels(teamName string) map[string]string

GetDefaultLabels returns default labels for kubernetes resources

func GetTeamLabelKey

func GetTeamLabelKey() string

GetTeamLabelKey returns team label key

Types

type ActivePromotionConfig

type ActivePromotionConfig struct {
	// Concurrences defines number of active promotion concurrences
	Concurrences int `json:"concurrences" yaml:"concurrences"`

	// Timeout defines timeout duration of active promotion process
	Timeout metav1.Duration `json:"timeout" yaml:"timeout"`

	// DemotionTimeout defines timeout duration of active demotion process
	DemotionTimeout metav1.Duration `json:"demotionTimeout" yaml:"demotionTimeout"`

	// RollbackTimeout defines timeout duration of rollback process
	RollbackTimeout metav1.Duration `json:"rollbackTimeout" yaml:"rollbackTimeout"`

	// TearDownDuration defines tear down duration of previous active environment
	TearDownDuration metav1.Duration `json:"teardownDuration" yaml:"teardownDuration"`

	// MaxHistories defines max stored histories of active promotion
	MaxHistories int `json:"maxHistories" yaml:"maxHistories"`
}

ActivePromotionConfig represents configuration of active promotion

type ActivePromotionController

type ActivePromotionController interface {
}

type ActivePromotionOption

type ActivePromotionOption func(*ActivePromotionReporter)

ActivePromotionOption allows specifying various configuration

func WithCredential

func WithCredential(creds s2hv1beta1.Credential) ActivePromotionOption

WithCredential specifies credential to override when create active promotion reporter object

type ActivePromotionReporter

type ActivePromotionReporter struct {
	TeamName               string                `json:"teamName,omitempty"`
	CurrentActiveNamespace string                `json:"currentActiveNamespace,omitempty"`
	Credential             s2hv1beta1.Credential `json:"credential,omitempty"`
	s2hv1beta1.ActivePromotionStatus
	SamsahaiConfig
}

ActivePromotionReporter manages active promotion report

func NewActivePromotionReporter

func NewActivePromotionReporter(status *s2hv1beta1.ActivePromotionStatus, s2hConfig SamsahaiConfig, teamName, currentNs string, opts ...ActivePromotionOption) *ActivePromotionReporter

NewActivePromotionReporter creates active promotion reporter object

type CommandAndArgs

type CommandAndArgs struct {
	Command []string `json:"command" yaml:"command"`
	Args    []string `json:"args" yaml:"args"`
}

CommandAndArgs defines commands and args

type Component

type Component struct {
	Parent       string                 `json:"parent,omitempty"`
	Name         string                 `json:"name" yaml:"name"`
	Chart        ComponentChart         `json:"chart" yaml:"chart"`
	Image        ComponentImage         `json:"image" yaml:"image"`
	Values       map[string]interface{} `json:"values,omitempty" yaml:"values,omitempty"`
	Source       *UpdatingSource        `json:"source,omitempty" yaml:"source,omitempty"`
	Dependencies []*Component           `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
}

Component represents a unit in Samsahai

type ComponentChart

type ComponentChart struct {
	Repository string `json:"repository" yaml:"repository"`
	Name       string `json:"name" yaml:"name"`
	Version    string `json:"version,omitempty" yaml:"version,omitempty"`
}

ComponentChart

type ComponentImage

type ComponentImage struct {
	Repository string `json:"repository" yaml:"repository"`
	Tag        string `json:"tag" yaml:"tag"`
	Pattern    string `json:"pattern,omitempty" yaml:"pattern"`
}

ComponentImage

type ComponentUpgradeOption

type ComponentUpgradeOption func(*ComponentUpgradeReporter)

ComponentUpgradeOption allows specifying various configuration

func WithQueueHistoryName

func WithQueueHistoryName(qHist string) ComponentUpgradeOption

WithQueueHistoryName specifies queuehistory name to override when create component upgrade reporter object QueueHistoryName will be the latest failure of component upgrade if reverification is success, QueueHistoryName will be the history of queue before running reverification

func WithTestRunner

func WithTestRunner(tr s2hv1beta1.TestRunner) ComponentUpgradeOption

WithTestRunner specifies test runner to override when create component upgrade reporter object

type ComponentUpgradeReporter

type ComponentUpgradeReporter struct {
	IssueTypeStr IssueType             `json:"issueTypeStr,omitempty"`
	StatusStr    StatusType            `json:"statusStr,omitempty"`
	StatusInt    int32                 `json:"statusInt,omitempty"`
	TestRunner   s2hv1beta1.TestRunner `json:"testRunner,omitempty"`
	Credential   s2hv1beta1.Credential `json:"credential,omitempty"`
	rpc.ComponentUpgrade
	SamsahaiConfig
}

ComponentUpgradeReporter manages component upgrade report

func NewComponentUpgradeReporter

func NewComponentUpgradeReporter(comp *rpc.ComponentUpgrade, s2hConfig SamsahaiConfig, opts ...ComponentUpgradeOption) *ComponentUpgradeReporter

NewComponentUpgradeReporter creates component upgrade reporter from rpc object

type ComponentValues

type ComponentValues map[string]interface{}

ComponentValues

type ComponentsValues

type ComponentsValues map[string]ComponentValues

ComponentsValues

type ConfigActivePromotion

type ConfigActivePromotion struct {
	// Timeout defines maximum duration for doing active promotion
	Timeout metav1.Duration `json:"timeout,omitempty" yaml:"timeout"`

	// DemotionTimeout defines maximum duration for doing active demotion
	DemotionTimeout metav1.Duration `json:"demotionTimeout,omitempty" yaml:"demotionTimeout"`

	// RollbackTimeout defines maximum duration for rolling back active promotion
	RollbackTimeout metav1.Duration `json:"rollbackTimeout,omitempty" yaml:"rollbackTimeout"`

	// MaxHistories defines maximum length of ActivePromotionHistory stored per team
	MaxHistories int `json:"maxHistories,omitempty" yaml:"maxHistories"`

	// TearDownDuration defines duration before teardown the previous active namespace
	TearDownDuration metav1.Duration `json:"tearDownDuration,omitempty" yaml:"tearDownDuration"`

	OutdatedNotification *OutdatedNotification `json:"outdatedNotification,omitempty" yaml:"outdatedNotification"`

	// Deployment represents configuration about deploy
	Deployment *ConfigDeploy `json:"deployment" yaml:"deployment"`
}

ConfigActivePromotion represents configuration about active promotion

type ConfigDeploy

type ConfigDeploy struct {
	// Timeout defines maximum duration for deploying environment
	Timeout metav1.Duration `json:"timeout,omitempty" yaml:"timeout"`

	// ComponentCleanupTimeout defines timeout duration of component cleaning up
	ComponentCleanupTimeout metav1.Duration `json:"componentCleanupTimeout"`

	// Engine defines method of deploying
	//
	// mock - for test only, always return success
	//
	// flux-helm - create HelmRelease for Helm Operator from Flux
	Engine *string `json:"engine,omitempty" yaml:"engine"`

	// TestRunner represents configuration about test
	TestRunner *ConfigTestRunner `json:"testRunner" yaml:"testRunner"`
}

type ConfigManager

type ConfigManager interface {
	// Sync keeps config synchronized with storage layer
	Sync() error

	// Get returns configuration from memory
	Get() *Configuration

	// GetComponents returns all components from `Configuration` that has valid `Source`
	GetComponents() map[string]*Component

	// GetParentComponents returns components that doesn't have parent (nil Parent)
	GetParentComponents() map[string]*Component

	// GetGitLatestRevision returns a git revision of HEAD commit
	GetGitLatestRevision() string

	// GetGitInfo returns git information of current config
	GetGitInfo() GitInfo

	// HasGitChanges verifies changes on git storage configuration in team
	HasGitChanges(gitStorage s2hv1beta1.GitStorage) bool

	// GetGitConfigPath return git config path
	GetGitConfigPath() string

	// Load loads configuration into ConfigManager
	Load(config *Configuration, gitRev string)

	// Clean cleans up config manager e.g. delete a directory
	Clean() error
}

type ConfigReporter

type ConfigReporter struct {
	Optional   []ReportOption `json:"optionals,omitempty" yaml:"optionals"`
	Slack      *Slack         `json:"slack,omitempty" yaml:"slack"`
	Email      *Email         `json:"email,omitempty" yaml:"email"`
	Rest       *Rest          `json:"rest,omitempty" yaml:"rest"`
	Shell      *Shell         `json:"cmd,omitempty" yaml:"cmd"`
	ReportMock bool           `json:"reportMock,omitempty" yaml:"reportMock"`
}

ConfigReporter represents configuration about sending notification

type ConfigStaging

type ConfigStaging struct {
	// Deployment represents configuration about deploy
	Deployment *ConfigDeploy `json:"deployment" yaml:"deployment"`

	// MaxRetry defines max retry counts of component upgrade
	MaxRetry int `json:"maxRetry,omitempty" yaml:"maxRetry"`

	// MaxHistoryDays defines maximum days of QueueHistory stored
	MaxHistoryDays int `json:"maxHistoryDays,omitempty" yaml:"maxHistoryDays"`
}

ConfigStaging represents configuration about staging

type ConfigTestRunner

type ConfigTestRunner struct {
	Timeout     metav1.Duration `json:"timeout,omitempty" yaml:"timeout"`
	PollingTime metav1.Duration `json:"pollingTime,omitempty" yaml:"pollingTime"`
	Teamcity    *Teamcity       `json:"teamcity,omitempty" yaml:"teamcity"`
	TestMock    *TestMock       `json:"testMock,omitempty" yaml:"testMock"`
}

ConfigTestRunner represents configuration about how to test the environment

type Configuration

type Configuration struct {
	// Components defines all components that are managed
	Components []*Component `json:"components" yaml:"components"`

	// Staging represents configuration about staging
	Staging *ConfigStaging `json:"staging"  yaml:"staging"`

	// ActivePromotion represents configuration about active promotion
	ActivePromotion *ConfigActivePromotion `json:"activePromotion"  yaml:"activePromotion"`

	// Envs represents environment specific configuration
	Envs map[string]ComponentsValues `json:"envs,omitempty" yaml:"envs,omitempty"`

	// Reporter represents configuration about reporter
	Reporter *ConfigReporter `json:"report" yaml:"report"`
}

type ConfigurationJSON

type ConfigurationJSON struct {
	GitRevision   string         `json:"gitRevision"`
	Configuration *Configuration `json:"config"`
}

type Connection

type Connection struct {
	Name          string `json:"name"`
	URL           string `json:"url"`
	IP            string `json:"ip"`
	Port          string `json:"port"`
	ServicePort   string `json:"servicePort"`
	Type          string `json:"type"`
	ContainerPort string `json:"containerPort"`
}

type DeployEngine

type DeployEngine interface {
	// GetName returns name of deploy engine
	GetName() string

	// GetValues returns yaml values of release deployment
	GetValues() (map[string][]byte, error)

	// Create creates environment
	Create(refName string, comp *Component, parentComp *Component, values map[string]interface{}) error

	// Delete deletes environment
	Delete(refName string) error

	// ForceDelete deletes environment when timeout
	ForceDelete(refName string) error

	// IsReady checks the environment is ready to use or not
	IsReady(queue *v1beta1.Queue) (bool, error)

	// GetLabelSelector returns map of label for select the components that created by the engine
	GetLabelSelectors(refName string) map[string]string

	// IsMocked uses for skip some functions due to mock deploy
	//
	// Skipped function: WaitForComponentsCleaned
	IsMocked() bool
}

type DesiredComponentChecker

type DesiredComponentChecker interface {
	// GetName returns name of checker
	GetName() string

	// GetVersion returns version from defined pattern
	GetVersion(repository string, name string, pattern string) (string, error)

	//EnsureVersion ensures the defined version is exist on repository
	EnsureVersion(repository string, name string, version string) error
}

DesiredComponentChecker represents standard interface for checking component version

type DesiredComponentController

type DesiredComponentController interface {
}

type Email

type Email struct {
	Server string   `json:"server" yaml:"server"`
	Port   int      `json:"port" yaml:"port"`
	From   string   `json:"from" yaml:"from"`
	To     []string `json:"to" yaml:"to"`
}

Email defines a configuration of email

type Endpoint

type Endpoint struct {
	URL      string `json:"url" yaml:"url"`
	Template string `json:"template" yaml:"template"`
}

Endpoint defines a configuration of rest endpoint

type EventType

type EventType string

EventType represents an event type of reporter

const (
	ComponentUpgradeType EventType = "ComponentUpgrade"
	ActivePromotionType  EventType = "ActivePromotion"
	ImageMissingType     EventType = "ImageMissing"
)

type GitInfo

type GitInfo struct {
	Name         string
	FullName     string
	BranchName   string
	HeadRevision string
}

GitInfo represents git repo, branch info. for process the update

type HTTPHeader

type HTTPHeader string

type HelmReleaseClient

type HelmReleaseClient interface {
	// Get takes name of the helmrelease, and returns the corresponding helmrelease object, and an error if there is any.
	Get(name string, opts metav1.GetOptions) (*v1beta1.HelmRelease, error)

	// List takes label and field selectors, and returns the list of HelmRelease that match those selectors.
	List(options metav1.ListOptions) (result *v1beta1.HelmReleaseList, err error)

	// Create takes the representation of a HelmRelease and creates it.
	// Returns the server's representation of the HelmRelease, and an error, if there is any.
	Create(release *v1beta1.HelmRelease) (result *v1beta1.HelmRelease, err error)

	// Update takes the representation of a HelmRelease and updates it.
	// Returns the server's representation of the HelmRelease, and an error, if there is any.
	Update(release *v1beta1.HelmRelease) (result *v1beta1.HelmRelease, err error)

	// Delete takes name of the HelmRelease and deletes it. Returns an error if one occurs.
	Delete(name string, options *metav1.DeleteOptions) error

	// DeleteCollection deletes a collection of objects
	DeleteCollection(options *metav1.DeleteOptions, listOpts metav1.ListOptions) error
}

type IssueType

type IssueType string

IssueType represents an issue type of component upgrade failure

const (
	IssueUnknown              IssueType = "Unknown issue"
	IssueDesiredVersionFailed IssueType = "Desired component failed - Please check your test"
	IssueImageMissing         IssueType = "Image missing"
	IssueEnvironment          IssueType = "Environment issue - Verification failed"
)

type OutdatedNotification

type OutdatedNotification struct {
	ExceedDuration            metav1.Duration `json:"exceedDuration" yaml:"exceedDuration"`
	ExcludeWeekendCalculation bool            `json:"excludeWeekendCalculation" yaml:"excludeWeekendCalculation"`
}

OutdatedNotification defines a configuration of outdated notification

type Plugin

type Plugin interface {
	DesiredComponentChecker

	// GetComponentName returns component name when incoming webhook matched with plugin name.
	// Useful for converting incoming component name to matched with the internal one.
	GetComponentName(name string) string
}

type PostNamespaceCreation

type PostNamespaceCreation struct {
	// Namespace defines a creating namespace
	Namespace string          `json:"namespace"`
	Team      s2hv1beta1.Team `json:"team"`
	SamsahaiConfig
}

PostNamespaceCreation represents a struct for running post namespace creation

type QueueController

type QueueController interface {
	// Add adds Queue
	Add(q *v1beta1.Queue) error

	// AddTop adds Queue to the top
	AddTop(q *v1beta1.Queue) error

	// First returns first component in Queue or current running Queue
	First() (*v1beta1.Queue, error)

	// Remove removes Queue
	Remove(q *v1beta1.Queue) error

	// Size returns no of queues
	Size() int

	// SetLastOrder sets queue order to the last
	SetLastOrder(q *v1beta1.Queue) error

	// SetReverifyQueueAtFirst sets queue to reverify type
	SetReverifyQueueAtFirst(q *v1beta1.Queue) error

	// SetRetryQueue sets Queue to retry one time
	SetRetryQueue(q *v1beta1.Queue, noOfRetry int, nextAt time.Time) error

	// RemoveAllQueues removes all queues
	RemoveAllQueues() error
}

QueueController manages updating component queue through CRD

type ReportOption

type ReportOption struct {
	Key   string `json:"key" yaml:"key"`
	Value string `json:"value" yaml:"value"`
}

ReportOption defines an optional configuration of slack

type Reporter

type Reporter interface {
	// GetName returns type of reporter
	GetName() string

	// SendComponentUpgrade sends details of component upgrade
	SendComponentUpgrade(configMgr ConfigManager, comp *ComponentUpgradeReporter) error

	// SendActivePromotionStatus sends active promotion status
	SendActivePromotionStatus(configMgr ConfigManager, atpRpt *ActivePromotionReporter) error

	// SendImageMissing sends image missing
	SendImageMissing(configMgr ConfigManager, images *rpc.Image) error
}

Reporter is the interface of reporter

type Rest

type Rest struct {
	ComponentUpgrade *struct {
		Endpoints []*Endpoint `json:"endpoints" yaml:"endpoints"`
	} `json:"componentUpgrade" yaml:"componentUpgrade"`
	ActivePromotion *struct {
		Endpoints []*Endpoint `json:"endpoints" yaml:"endpoints"`
	} `json:"activePromotion" yaml:"activePromotion"`
	ImageMissing *struct {
		Endpoints []*Endpoint `json:"endpoints" yaml:"endpoints"`
	} `json:"imageMissing" yaml:"imageMissing"`
}

Rest defines a configuration of http rest

type SamsahaiConfig

type SamsahaiConfig struct {
	// ConfigDirPath defines a directory path of Samsahai configuration
	ConfigDirPath string `json:"-" yaml:"-"`

	// PluginsDir defines a plugins directory path
	PluginsDir string `json:"pluginsDir" yaml:"pluginsDir"`

	// SamsahaiImage defines a Samsahai image name and tag
	SamsahaiImage string `json:"s2hImage" yaml:"s2hImage"`

	// SamsahaiExternalURL defines a Samsahai external url
	SamsahaiExternalURL string `json:"s2hExternalURL" yaml:"s2hExternalURL"`

	// SamsahaiHTTPProxy defines a Samsahai http proxy
	SamsahaiHTTPProxy string `json:"s2hHTTPProxy" yaml:"s2hHTTPProxy"`

	// SamsahaiHTTPSProxy defines a Samsahai https proxy
	SamsahaiHTTPSProxy string `json:"s2hHTTPSProxy" yaml:"s2hHTTPSProxy"`

	// SamsahaiNoProxy defines a Samsahai no proxy
	SamsahaiNoProxy string `json:"s2hNoProxy" yaml:"s2hNoProxy"`

	// TeamcityURL defines a Teamcity url
	TeamcityURL string `json:"teamcityURL" yaml:"teamcityURL"`

	// ClusterDomain defines a cluster domain name
	ClusterDomain string `json:"clusterDomain" yaml:"clusterDomain"`

	// ActivePromotion defines an active promotion configuration
	ActivePromotion ActivePromotionConfig `json:"activePromotion,omitempty" yaml:"activePromotion,omitempty"`

	// PostNamespaceCreation defines commands executing after creating s2h namespace
	PostNamespaceCreation *struct {
		CommandAndArgs
	} `json:"postNamespaceCreation,omitempty" yaml:"postNamespaceCreation,omitempty"`

	SamsahaiURL        string             `json:"-" yaml:"-"`
	SamsahaiCredential SamsahaiCredential `json:"-" yaml:"-"`
}

SamsahaiConfig represents configuration of Samsahai itself

type SamsahaiController

type SamsahaiController interface {
	s2hrpc.RPC

	http.Handler

	PathPrefix() string

	// Start runs internal worker
	Start(stop <-chan struct{})

	// QueueLen returns no. of internal queue
	QueueLen() int

	// GetTeam returns Team CRD
	GetTeam(teamName string, teamComp *s2hv1beta1.Team) error

	// GetTeamConfigManagers returns Samsahai configuration from all teams
	GetTeamConfigManagers() map[string]ConfigManager

	// GetTeamConfigManager returns samsahai configuration from team's github
	GetTeamConfigManager(teamName string) (ConfigManager, bool)

	// GetPlugins returns samsahai plugins
	GetPlugins() map[string]Plugin

	// LoadTeamSecret loads team secret from main namespace
	LoadTeamSecret(teamComp *s2hv1beta1.Team) error

	// CreateStagingEnvironment creates staging environment
	CreateStagingEnvironment(teamName, namespaceName string) error

	// CreatePreActiveEnvironment creates pre-active environment
	CreatePreActiveEnvironment(teamName, namespace string) error

	// PromoteActiveEnvironment switches environment from pre-active to active and stores current active components
	PromoteActiveEnvironment(teamComp *s2hv1beta1.Team, namespace string, comps []s2hv1beta1.StableComponent) error

	// DestroyActiveEnvironment destroys active environment when active demotion is failure.
	DestroyActiveEnvironment(teamName, namespace string) error

	// DestroyPreActiveEnvironment destroys pre-active environment when active promotion is failure.
	DestroyPreActiveEnvironment(teamName, namespace string) error

	// DestroyPreviousActiveEnvironment destroys previous active environment when active promotion is success.
	DestroyPreviousActiveEnvironment(teamName, namespace string) error

	// SetPreviousActiveNamespace updates previous active namespace to team status
	SetPreviousActiveNamespace(teamComp *s2hv1beta1.Team, namespace string) error

	// SetPreActiveNamespace updates pre-active namespace to team status
	SetPreActiveNamespace(teamComp *s2hv1beta1.Team, namespace string) error

	// SetActiveNamespace updates active namespace to team status
	SetActiveNamespace(teamComp *s2hv1beta1.Team, namespace string) error

	// NotifyGitChanged adds GitInfo to channel for process
	NotifyGitChanged(updated GitInfo)

	// NotifyComponentChanged adds Component to queue for checking new version
	NotifyComponentChanged(name, repository string)

	// NotifyActivePromotion sends active promotion status report
	NotifyActivePromotion(atpRpt *ActivePromotionReporter) error

	// GetConnections returns Services in NodePort type and Ingresses that exist in the namespace
	GetConnections(namespace string) (map[string][]Connection, error)

	// GetTeams returns list of teams in Samsahai
	GetTeams() (*s2hv1beta1.TeamList, error)

	// GetTeamNames returns map of team names in Samsahai
	GetTeamNames() map[string]struct{}

	// GetQueueHistories returns QueueHistoryList of the namespace
	GetQueueHistories(namespace string) (*s2hv1beta1.QueueHistoryList, error)

	// GetQueueHistory returns Queue by name and namespace
	GetQueueHistory(name, namespace string) (*s2hv1beta1.QueueHistory, error)

	// GetQueues returns QueueList of the namespace
	GetQueues(namespace string) (*s2hv1beta1.QueueList, error)

	// GetStableValues returns Stable Values of parent component in team
	GetStableValues(team *s2hv1beta1.Team, comp *Component) (ComponentValues, error)

	// GetActivePromotions returns ActivePromotionList by labels
	GetActivePromotions() (*s2hv1beta1.ActivePromotionList, error)

	// GetActivePromotion returns ActivePromotion by name
	GetActivePromotion(name string) (v *s2hv1beta1.ActivePromotion, err error)

	// GetActivePromotionHistories returns ActivePromotionList by labels
	GetActivePromotionHistories(selectors map[string]string) (*s2hv1beta1.ActivePromotionHistoryList, error)

	// GetActivePromotionHistory returns ActivePromotion by name
	GetActivePromotionHistory(name string) (*s2hv1beta1.ActivePromotionHistory, error)
}

SamsahaiController

type SamsahaiCredential

type SamsahaiCredential struct {
	InternalAuthToken string
	SlackToken        string
	TeamcityUsername  string
	TeamcityPassword  string
}

type Shell

type Shell struct {
	ComponentUpgrade *CommandAndArgs `json:"componentUpgrade" yaml:"componentUpgrade"`
	ActivePromotion  *CommandAndArgs `json:"activePromotion" yaml:"activePromotion"`
	ImageMissing     *CommandAndArgs `json:"imageMissing" yaml:"imageMissing"`
}

Shell defines a configuration of shell command

type Slack

type Slack struct {
	Channels         []string `json:"channels" yaml:"channels"`
	ComponentUpgrade *struct {
		Interval SlackInterval `json:"interval" yaml:"interval"`
		Criteria SlackCriteria `json:"criteria" yaml:"criteria"`
	} `json:"componentUpgrade" yaml:"componentUpgrade"`
}

Slack defines a configuration of slack

type SlackCriteria

type SlackCriteria string

SlackCriteria represents a criteria of sending component upgrade notification

const (
	// CriteriaSuccess means sending slack notification when component upgrade is success only
	CriteriaSuccess SlackCriteria = "success"
	// CriteriaFailure means sending slack notification when component upgrade is failure only
	CriteriaFailure SlackCriteria = "failure"
	// CriteriaBoth means sending slack notification whether component upgrade is success or failure
	CriteriaBoth SlackCriteria = "both"
)

type SlackInterval

type SlackInterval string

SlackInterval represents how often of sending component upgrade notification within a retry cycle

const (
	// IntervalEveryTime means sending slack notification in every component upgrade runs
	IntervalEveryTime SlackInterval = "everytime"
	// IntervalRetry means sending slack notification after retry only
	IntervalRetry SlackInterval = "retry"
)

type SortableVersion

type SortableVersion []string

func (SortableVersion) Len

func (v SortableVersion) Len() int

func (SortableVersion) Less

func (v SortableVersion) Less(i, j int) bool

func (SortableVersion) Swap

func (v SortableVersion) Swap(i, j int)

type StableComponentController

type StableComponentController interface {
}

type StagingConfig

type StagingConfig struct {
	// MaxHistoryDays defines maximum days of QueueHistory stored
	MaxHistoryDays int `json:"maxHistoryDays" yaml:"maxHistoryDays"`
}

StagingConfig represents configuration of Staging

type StagingController

type StagingController interface {
	// should implement RPC
	stagingrpc.RPC

	// should be able to serve http
	http.Handler

	// Start runs internal worker
	Start(stop <-chan struct{})

	// IsBusy returns true if controller still processing queue
	IsBusy() bool

	// LoadTestRunner loads single test runner to controller
	LoadTestRunner(runner StagingTestRunner)

	// LoadDeployEngine loads single deploy engine to controller
	LoadDeployEngine(engine DeployEngine)
}

type StagingTestRunner

type StagingTestRunner interface {
	// GetName returns type of test runner
	GetName() string

	// Trigger makes http request to run the test build
	Trigger(testConfig *ConfigTestRunner, currentQueue *v1beta1.Queue) error

	// GetResult makes http request to get result of test build [FAILURE/SUCCESS/UNKNOWN]
	// It returns bool results of is build success and is build finished
	GetResult(testConfig *ConfigTestRunner, currentQueue *v1beta1.Queue) (bool, bool, error)
}

type StatusType

type StatusType string

StatusType represents an active promotion type

const (
	StatusSuccess StatusType = "Success"
	StatusFailure StatusType = "Failure"
)

type Teamcity

type Teamcity struct {
	BuildTypeID string `json:"buildTypeID" yaml:"buildTypeID"`
	Branch      string `json:"branch" yaml:"branch"`
}

Teamcity defines a http rest configuration of teamcity

type TestMock

type TestMock struct {
	Result bool `json:"result" yaml:"result"`
}

TestMock defines a result of testmock

type UpdatingSource

type UpdatingSource string

UpdatingSource represents source for checking desired version of components

const (
	PublicRegistry UpdatingSource = "publicRegistry"
	PublicHarbor   UpdatingSource = "publicHarbor"
)

Directories

Path Synopsis
git
k8s
reporter
third_party
cmd
protostruct
Package protostruct supports operations on the protocol buffer Struct message.
Package protostruct supports operations on the protocol buffer Struct message.

Jump to

Keyboard shortcuts

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