types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DependencyContains

func DependencyContains(d []DependsOn, str string) bool

DependencyContains checks if a string is present in a dependencies slice as name

func NewDeployment

func NewDeployment(config *Configuration, tier *Datacenter, stage, organization string) *appsv1.Deployment

NewDeployment return kubernetes Deployment object with default values

func NewDeploymentStrategy

func NewDeploymentStrategy(s *DeployStrategy) appsv1.DeploymentStrategy

NewDeploymentStrategy return kubernetes Strategy for deployment

func NewService

func NewService(application, stage, namespace string, ports []Port) *apiv1.Service

NewService return kubernetes Service object with default values

func NewServiceAccount

func NewServiceAccount(application, stage, namespace, imagePullSecretName string) *apiv1.ServiceAccount

NewServiceAccount return kubernetes ServiceAccount object with default values

Types

type Application

type Application struct {
	Accounts       string                  `json:"accounts,omitempty"`
	CloudProviders string                  `json:"cloudProviders"`
	CreateTs       string                  `json:"createTs,omitempty"`
	CustomBanners  []*CustomBanner         `json:"customBanners,omitempty"`
	DataSources    *DataSources            `json:"dataSources,omitempty"`
	Description    string                  `json:"description,omitempty"`
	Email          string                  `json:"email,omitempty"`
	LastModifiedBy string                  `json:"lastModifiedBy,omitempty"`
	Name           string                  `json:"name"`
	Permissions    *ApplicationPermissions `json:"permissions,omitempty"`
	TrafficGuards  []string                `json:"trafficGuards,omitempty"`
	UpdateTs       string                  `json:"updateTs,omitempty"`
	User           string                  `json:"user,omitempty"`
}

Application represents full config for spinnaker application

func NewApplication

func NewApplication(app *Configuration) *Application

type ApplicationPermissions

type ApplicationPermissions struct {
	Execute []string `json:"EXECUTE"`
	Read    []string `json:"READ"`
	Write   []string `json:"WRITE"`
}

ApplicationPermissions application permissions

func AppendApplicationPermissions

func AppendApplicationPermissions(teamOwner string) *ApplicationPermissions

AppendApplicationPermissions appends team owner permissions to defaults one

type Assignees

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

Assignees has GitHub users.

func (*Assignees) Add

func (a *Assignees) Add(assignees ...string)

Add adds users into the list.

func (*Assignees) List

func (a *Assignees) List() []string

List returns the list of users.

func (*Assignees) RemoveFromList

func (a *Assignees) RemoveFromList(names ...string)

RemoveFromList removes users from the list.

type ChaosMonkey

type ChaosMonkey struct {
	Enabled   bool   `json:"enabled"`
	MTBF      string `json:"mtbf"`
	KillMode  string `json:"killMode"`
	KillValue string `json:"killValue"`
}

type Configuration

type Configuration struct {
	Application                       string          `json:"application"`
	DockerImage                       string          `json:"image,omitempty"`
	Profiles                          *[]*Profile     `json:"profiles,omitempty"`
	EnvFrom                           []string        `json:"envFrom,omitempty"`
	DependsOn                         []DependsOn     `json:"dependsOn,omitempty"`
	Type                              string          `json:"type"`
	Owners                            string          `json:"owners,omitempty"`
	OwnerEmail                        string          `json:"ownerEmail,omitempty"`
	NodePool                          string          `json:"nodePool,omitempty"`
	Namespace                         string          `json:"namespace,omitempty"`
	SlackChannel                      string          `json:"slackChannel,omitempty"`
	JenkinsJobName                    string          `json:"jenkinsJobName,omitempty"`
	Ports                             []Port          `json:"ports,omitempty"`
	Strategy                          *DeployStrategy `json:"strategy,omitempty"`
	ChaosMonkey                       *ChaosMonkey    `json:"chaosMonkey,omitempty"`
	Version                           string          `json:"version,omitempty"`
	RestrictExecutionDuringTimeWindow bool            `json:"restrictExecutionDuringTimeWindow,omitempty"`
	SkipAutogeneration                bool            `json:"skipAutogeneration,omitempty"`
}

type CustomBanner

type CustomBanner struct {
	BackgroundColor string `json:"backgroundColor"`
	Enabled         bool   `json:"enabled"`
	Text            string `json:"text"`
	TextColor       string `json:"textColor"`
}

CustomBanner represents custom banners config for application

type DataSources

type DataSources struct {
	Disabled []string `json:"disabled"`
	Enabled  []string `json:"enabled"`
}

DataSources represents data sources config for application

type Datacenter

type Datacenter struct {
	TierName         string                `json:"tierName"`
	Replicas         int32                 `json:"replicas"`
	NodePool         string                `json:"nodePool,omitempty"`
	Env              *[]EnvVar             `json:"env"`
	EnvFrom          []string              `json:"envFrom,omitempty"`
	Command          []string              `json:"command,omitempty"`
	Resources        *ResourceRequirements `json:"resources"`
	ProgressDeadline int32                 `json:"progressDeadline,omitempty"`
	LivenessProbe    *Probe                `json:"livenessProbe,omitempty"`
	ReadinessProbe   *Probe                `json:"readinessProbe,omitempty"`
	StartupProbe     *Probe                `json:"startupProbe,omitempty"`
	PodPriority      string                `json:"podPriority,omitempty"`
	ChaosMonkey      *ChaosMonkey          `json:"chaosMonkey,omitempty"`
	Version          string                `json:"version,omitempty"`
}

type DependsOn

type DependsOn struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

type DeployStrategy

type DeployStrategy struct {
	// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
	Type string `json:"type,omitempty"`

	// Rolling update config params. Present only if DeployStrategyType = RollingUpdate.
	RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty"`
}

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Moniker

type Moniker struct {
	App      string `json:"app"`
	Cluster  string `json:"cluster,omitempty"`
	Detail   string `json:"detail,omitempty"`
	Stack    string `json:"stack,omitempty"`
	Sequence string `json:"sequence,omitempty"`
}

Moniker represents moniker config - component of the V2 Spinnaker Manifest Stage that allows users to label assets created by the Spinnaker v2 provider

type Notification

type Notification struct {
	ID      string                         `json:"id,omitempty"`
	Address string                         `json:"address"`
	Level   string                         `json:"level"`
	Message map[string]NotificationMessage `json:"message"`
	Type    string                         `json:"type"`
	When    []string                       `json:"when"`
}

Notifications represents full notifications config

func NewNotification

func NewNotification() *Notification

NewNotification new notification

type NotificationMessage

type NotificationMessage struct {
	Text string `json:"text"`
}

NotificationMessage represents text of a stage state

type Option

type Option struct {
	Value string `json:"value,omitempty"`
}

Option contains the value of the option in a given pipeline parameter

type Parameter

type Parameter struct {
	ID          string   `json:"id"`
	Default     string   `json:"default"`
	Description string   `json:"description"`
	HasOptions  bool     `json:"hasOptions,omitempty"`
	Label       string   `json:"label"`
	Name        string   `json:"name"`
	Options     []Option `json:"options,omitempty"`
	Pinned      bool     `json:"pinned"`
	Required    bool     `json:"required"`
}

Parameter is a parameter declaration for a pipeline config

type Pipeline

type Pipeline struct {
	AppConfig            map[string]interface{}      `json:"appConfig,omitempty"`
	Application          string                      `json:"application"`
	Disabled             bool                        `json:"disabled,omitempty"`
	ExpectedArtifacts    []*PipelineExpectedArtifact `json:"expectedArtifacts,omitempty"`
	ID                   string                      `json:"id,omitempty"`
	Index                int                         `json:"index,omitempty"`
	KeepWaitingPipelines bool                        `json:"keepWaitingPipelines"`
	LastModifiedBy       string                      `json:"lastModifiedBy"`
	LimitConcurrent      bool                        `json:"limitConcurrent"`
	Name                 string                      `json:"name"`
	Notifications        []Notification              `json:"notifications,omitempty"`
	ParameterConfig      *[]*Parameter               `json:"parameterConfig,omitempty"`
	Roles                []string                    `json:"roles,omitempty"`
	SpelEvaluator        string                      `json:"spelEvaluator,omitempty"`
	Stages               []*Stage                    `json:"stages,omitempty"`
	Triggers             []*Trigger                  `json:"triggers,omitempty"`
	UpdateTs             string                      `json:"updateTs,omitempty"`
}

PipelineConfig represents full pipeline config - fields for the top level object of a spinnaker pipeline. Mostly used for constructing JSON

func NewBuildPipeline

func NewBuildPipeline(pipe *Configuration) *Pipeline

NewBuildPipeline return build pipeline with default values

func NewDeployPipeline

func NewDeployPipeline(pipe *Configuration, pipeValues map[string]interface{}) *Pipeline

NewDeployPipeline return deploy to DC pipeline with default values

func NewPromotePipeline

func NewPromotePipeline(pipe *Configuration, pipeValues map[string]interface{}) *Pipeline

NewPromotePipeline return promote to stage pipeline with default values

type PipelineArtifact

type PipelineArtifact struct {
	ArtifactAccount string            `json:"artifactAccount,omitempty"`
	CustomKind      bool              `json:"customKind,omitempty"`
	ID              string            `json:"id,omitempty"`
	Location        string            `json:"location,omitempty"`
	Metadata        map[string]string `json:"metadata,omitempty"`
	Name            string            `json:"name,omitempty"`
	Reference       string            `json:"reference,omitempty"`
	Type            string            `json:"type,omitempty"`
	Version         string            `json:"version,omitempty"`
}

PipelineArtifact represents default artifact config

type PipelineExpectedArtifact

type PipelineExpectedArtifact struct {
	DefaultArtifact    *PipelineArtifact `json:"defaultArtifact"`
	DisplayName        string            `json:"displayName"`
	ID                 string            `json:"id"`
	MatchArtifact      *PipelineArtifact `json:"matchArtifact"`
	UseDefaultArtifact bool              `json:"useDefaultArtifact"`
	UsePriorArtifact   bool              `json:"usePriorArtifact"`
}

PipelineExpectedArtifact represents expected artifact config

type PipelineTrafficManagement

type PipelineTrafficManagement struct {
	Enabled bool                              `json:"enabled"`
	Options *PipelineTrafficManagementOptions `json:"options,omitempty"`
}

PipelineTrafficManagement represents pipeline traffic management config

type PipelineTrafficManagementOptions

type PipelineTrafficManagementOptions struct {
	EnableTraffic bool     `json:"enableTraffic"`
	Namespace     string   `json:"namespace,omitempty"`
	Services      []string `json:"services"`
	Strategy      string   `json:"strategy,omitempty"`
}

PipelineTrafficManagementOptions represents pipeline traffic management options config

type Port

type Port struct {
	Name          string `json:"name"`
	ContainerPort int32  `json:"containerPort"`
}

type Probe

type Probe struct {
	Type             string `json:"type"`
	Path             string `json:"path"`
	Delay            int32  `json:"delay"`
	TimeoutSeconds   int32  `json:"timeoutSeconds"`
	PeriodSeconds    int32  `json:"periodSeconds"`
	SuccessThreshold int32  `json:"successThreshold"`
	FailureThreshold int32  `json:"failureThreshold"`
}

type Profile

type Profile struct {
	ProfileName string         `json:"profileName"`
	Datacenters *[]*Datacenter `json:"datacenters"`
}

type PullRequestOptions

type PullRequestOptions struct {
	// Name of the owner (user or org) of the repo to create the commit in
	Organization string
	// Name of repository to create the commit in
	RepositoryName string
	// Name of the author of the commit
	AuthorName string
	// Email of the author of the commit
	AuthorEmail string
	// Name of branch to create the commit in. If it does not already exists, it will be created using the `master` branch
	CommitBranch string
	// Content of the commit message
	CommitMessage string
	// Title of the pull request. If not specified, no pull request will be created
	PRSubject string
	// Text to put in the description of the pull request
	PRDescription string

	Entries   []*github.TreeEntry
	Reference *github.Reference
	Tree      *github.Tree
}

PullRequestOptions stores additional GitHub specific data for creating PR

type ResourceList

type ResourceList struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
}

type ResourceRequirements

type ResourceRequirements struct {
	Limits   *ResourceList `json:"limits"`
	Requests *ResourceList `json:"requests"`
}

type RollingUpdateDeployment

type RollingUpdateDeployment struct {
	// The maximum number of pods that can be unavailable during the update.
	// Value can be ONLY a percentage of desired pods (ex: 10%).
	// Absolute number is calculated from percentage by rounding down.
	// This can not be 0 if MaxSurge is 0.
	// Defaults to 25%.
	// Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods
	// immediately when the rolling update starts. Once new pods are ready, old ReplicaSet
	// can be scaled down further, followed by scaling up the new ReplicaSet, ensuring
	// that the total number of pods available at all times during the update is at
	// least 70% of desired pods.
	MaxUnavailable string `json:"maxUnavailable,omitempty"`

	// The maximum number of pods that can be scheduled above the desired number of
	// pods.
	// Value can be ONLY a percentage of desired pods (ex: 10%).
	// This can not be 0 if MaxUnavailable is 0.
	// Absolute number is calculated from percentage by rounding up.
	// Defaults to 25%.
	// Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when
	// the rolling update starts, such that the total number of old and new pods do not exceed
	// 130% of desired pods. Once old pods have been killed,
	// new ReplicaSet can be scaled up further, ensuring that total number of pods running
	// at any time during the update is at most 130% of desired pods.
	MaxSurge string `json:"maxSurge,omitempty"`
}

type Stage

type Stage struct {
	Account                           string                     `json:"account,omitempty"`
	CloudProvider                     string                     `json:"cloudProvider,omitempty"`
	Comments                          string                     `json:"comments,omitempty"`
	ContinuePipeline                  bool                       `json:"continuePipeline,omitempty"`
	FailOnFailedExpressions           bool                       `json:"failOnFailedExpressions,omitempty"`
	FailPipeline                      bool                       `json:"failPipeline,omitempty"`
	Instructions                      string                     `json:"instructions,omitempty"`
	Job                               string                     `json:"job,omitempty"`
	JudgmentInputs                    []string                   `json:"judgmentInputs,omitempty"`
	Master                            string                     `json:"master,omitempty"`
	ManifestArtifactAccount           string                     `json:"manifestArtifactAccount,omitempty"`
	ManifestArtifactID                string                     `json:"manifestArtifactId,omitempty"`
	Manifests                         []appsv1.Deployment        `json:"manifests,omitempty"`
	Moniker                           *Moniker                   `json:"moniker,omitempty"`
	Name                              string                     `json:"name"`
	NamespaceOverride                 string                     `json:"namespaceOverride,omitempty"`
	Notifications                     []Notification             `json:"notifications,omitempty"`
	OverrideTimeout                   bool                       `json:"overrideTimeout,omitempty"`
	Parameters                        map[string]string          `json:"parameters,omitempty"`
	PropagateAuthenticationContext    bool                       `json:"propagateAuthenticationContext,omitempty"`
	RefID                             string                     `json:"refId"`
	RequiredArtifactIds               []string                   `json:"requiredArtifactIds,omitempty"`
	RequisiteStageRefIds              []string                   `json:"requisiteStageRefIds"`
	RestrictExecutionDuringTimeWindow bool                       `json:"restrictExecutionDuringTimeWindow,omitempty"`
	RestrictedExecutionWindow         *StageExecutionWindow      `json:"restrictedExecutionWindow,omitempty"`
	SkipExpressionEvaluation          bool                       `json:"skipExpressionEvaluation,omitempty"`
	Source                            string                     `json:"source,omitempty"`
	SendNotifications                 bool                       `json:"sendNotifications,omitempty"`
	StageEnabled                      *StageEnabled              `json:"stageEnabled,omitempty"`
	StageTimeoutMs                    int                        `json:"stageTimeoutMs,omitempty"`
	TrafficManagement                 *PipelineTrafficManagement `json:"trafficManagement,omitempty"`
	Type                              string                     `json:"type"`
}

Stages represents full stages config

type StageEnabled

type StageEnabled struct {
	Expression string `json:"expression"`
	Type       string `json:"type"`
}

StageEnabled represents stage enabled config

type StageExecutionWindow

type StageExecutionWindow struct {
	Days      []int                             `json:"days"`
	Jitter    *StageExecutionWindowJitter       `json:"jitter,omitempty"`
	Whitelist *[]*StageExecutionWindowWhitelist `json:"whitelist"`
}

StageExecutionWindow when to execute pipeline stage

type StageExecutionWindowJitter

type StageExecutionWindowJitter struct {
	Enabled    bool `json:"enabled"`
	MaxDelay   int  `json:"maxDelay"`
	MinDelay   int  `json:"minDelay"`
	SkipManual bool `json:"skipManual"`
}

StageExecutionWindowJitter random jitter to add to execution window

type StageExecutionWindowWhitelist

type StageExecutionWindowWhitelist struct {
	EndHour   int `json:"endHour"`
	EndMin    int `json:"endMin"`
	StartHour int `json:"startHour"`
	StartMin  int `json:"startMin"`
}

StageExecutionWindowWhitelist which hours to deploy

type Trigger

type Trigger struct {
	Account             string   `json:"account,omitempty"`
	Application         string   `json:"application,omitempty"`
	Branch              string   `json:"branch,omitempty"`
	Enabled             bool     `json:"enabled"`
	ExpectedArtifactIds []string `json:"expectedArtifactIds"`
	Organization        string   `json:"organization,omitempty"`
	Pipeline            string   `json:"pipeline,omitempty"`
	Project             string   `json:"project,omitempty"`
	Registry            string   `json:"registry,omitempty"`
	Repository          string   `json:"repository,omitempty"`
	RunAsUser           string   `json:"runAsUser"`
	Secret              string   `json:"secret,omitempty"`
	Slug                string   `json:"slug,omitempty"`
	Source              string   `json:"source,omitempty"`
	Status              []string `json:"status,omitempty"`
	Tag                 string   `json:"tag,omitempty"`
	Type                string   `json:"type"`
}

Triggers represents full trigers config

Jump to

Keyboard shortcuts

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