core

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const KeyAllApplications = `AllApplications`

Variables

This section is empty.

Functions

func DeleteJob

func DeleteJob(c *gin.Context)

DeleteJob is not implemented for the Kubernetes provider V2. See https://github.com/spinnaker/spinnaker/issues/4644#issuecomment-627287782.

func ListSecurityGroups

func ListSecurityGroups(c *gin.Context)

I'm not sure what this endpoint is supposed to do or what Spinnaker does with it, but here is an example of the response. I found that returning an empty object "{}" satisfies Deck.

{
  "label": "securityGroups",
  "name": "applications",
  "profiles": [
    "smoketests"
  ],
  "propertySources": [
    {
      "name": "vault:spinnaker",
      "source": {
        "kubernetes.accounts[0].cacheIntervalSeconds": 3600,
        "kubernetes.accounts[0].cacheThreads": 4,
        "kubernetes.accounts[0].cachingPolicies": "",
        "kubernetes.accounts[0].checkPermissionsOnStartup": false,
        "kubernetes.accounts[0].configureImagePullSecrets": true,
        "kubernetes.accounts[0].context": "gke_github-replication-sandbox_us-central1-c_test-1-dev",
        "kubernetes.accounts[0].dockerRegistries[0].accountName": "docker-registry",
        "kubernetes.accounts[0].dockerRegistries[0].namespaces": "",
        "kubernetes.accounts[0].kubeconfigContents": "apiVersion: v1\nclusters:\n- cluster:\n\n    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURDekNDQWZPZ0F3SUJBZ0lRSlJTSGZTc3N2SHdnZ2laTVNWbG1MakFOQmdrcWhraUc5dzBCQVFzRkFEQXYKTVMwd0t3WURWUVFERXlSbU5qaG1NMk5tWVMwMU5EazJMVFF5TkdVdFlUQTBaaTA1WmpVMVlUWTVaR001TmpJdwpIaGNOTWpBd05qRTNNakl4TnpFeVdoY05NalV3TmpFMk1qTXhOekV5V2pBdk1TMHdLd1lEVlFRREV5Um1OamhtCk0yTm1ZUzAxTkRrMkxUUXlOR1V0WVRBMFppMDVaalUxWVRZNV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2hHV1lxK1NqcUp2NzAKUWQwRjBqUm9vYWRCa0NJaWRpQUkKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=\n\n    insecure-skip-tls-verify: false\n    server: https://35.238.191.231\n  name: gke_github-replication-sandbox_us-central1-c_test-1-dev\ncontexts:\n- context:\n    cluster: gke_github-replication-sandbox_us-central1-c_test-1-dev\n    namespace: default\n    user: gke_github-replication-sandbox_us-central1-c_test-1-dev\n  name: gke_github-replication-sandbox_us-central1-c_test-1-dev\ncurrent-context: gke_github-replication-sandbox_us-central1-c_test-1-dev\nkind: Config\npreferences: {}\nusers:\n- name: gke_github-replication-sandbox_us-central1-c_test-1-dev\n  user:\n    exec:\n      apiVersion: client.authentication.k8s.io/v1beta1\n      args:\n      - /tmp/gcloud/auth_token\n      command: /bin/cat",
        "kubernetes.accounts[0].liveManifestCalls": true,
        "kubernetes.accounts[0].metrics": false,
        "kubernetes.accounts[0].name": "gke_github-replication-sandbox_us-central1-c_test-1-dev",
        "kubernetes.accounts[0].namespaces": "",
        "kubernetes.accounts[0].oAuthScopes": "",
        "kubernetes.accounts[0].omitKinds[0]": "podPreset",
        "kubernetes.accounts[0].omitNamespaces[0]": "kube-public",
        "kubernetes.accounts[0].omitNamespaces[1]": "kube-node-lease",
        "kubernetes.accounts[0].onlySpinnakerManaged": true,
        "kubernetes.accounts[0].permissions.READ[0]": "gg_spinnaker_admins",
        "kubernetes.accounts[0].permissions.READ[1]": "gg_cloud_gcp_spinnaker_admins",
        "kubernetes.accounts[0].permissions.WRITE[0]": "gg_cloud_gcp_spinnaker_admins",
        "kubernetes.accounts[0].providerVersion": "V2",
        "kubernetes.accounts[0].requiredGroupMembership": "",
      }
    }
  ]
}

func ListStages

func ListStages(c *gin.Context)

Expected response:

[

{
  "enabled": true,
  "name": "resizeServerGroup"
},
{
  "enabled": true,
  "name": "runJob"
},
{
  "enabled": true,
  "name": "undoRolloutManifest"
},
{
  "enabled": true,
  "name": "rollingRestartManifest"
},
{
  "enabled": true,
  "name": "pauseRolloutManifest"
},
{
  "enabled": true,
  "name": "enableManifest"
},
{
  "enabled": true,
  "name": "scaleManifest"
},
{
  "enabled": true,
  "name": "disableManifest"
},
{
  "enabled": true,
  "name": "patchManifest"
},
{
  "enabled": true,
  "name": "resumeRolloutManifest"
},
{
  "enabled": true,
  "name": "deleteManifest"
},
{
  "enabled": true,
  "name": "deployManifest"
},
{
  "enabled": true,
  "name": "cleanupArtifacts"
},
{
  "enabled": true,
  "name": "upsertLoadBalancer"
},
{
  "enabled": true,
  "name": "enableServerGroup"
},
{
  "enabled": true,
  "name": "createServerGroup"
},
{
  "enabled": true,
  "name": "deleteLoadBalancer"
},
{
  "enabled": true,
  "name": "upsertScalingPolicy"
},
{
  "enabled": true,
  "name": "terminateInstances"
},
{
  "enabled": true,
  "name": "stopServerGroup"
},
{
  "enabled": true,
  "name": "disableServerGroup"
},
{
  "enabled": true,
  "name": "startServerGroup"
},
{
  "enabled": true,
  "name": "destroyServerGroup"
}

]

func OK

func OK(*gin.Context)

Types

type AccountNamespaces

type AccountNamespaces struct {
	Name       string
	Namespaces []string
}

type Application

type Application struct {
	Attributes   ApplicationAttributes `json:"attributes"`
	ClusterNames map[string][]string   `json:"clusterNames"`
	Name         string                `json:"name"`
}

type ApplicationAttributes

type ApplicationAttributes struct {
	Name string `json:"name"`
}

type Applications

type Applications []Application

type Artifact

type Artifact struct {
	Type            artifact.Type `json:"type"`
	CustomKind      bool          `json:"customKind"`
	Name            string        `json:"name"`
	Version         string        `json:"version"`
	Location        string        `json:"location"`
	Reference       string        `json:"reference"`
	Metadata        Metadata      `json:"metadata"`
	ArtifactAccount string        `json:"artifactAccount"`
}

type BuildInfo

type BuildInfo struct {
	Images []string `json:"images"`
}

type Capacity

type Capacity struct {
	Desired int32 `json:"desired"`
	Pinned  bool  `json:"pinned"`
}

type Clusters

type Clusters map[string][]string

type Controller

type Controller struct {
	*internal.Controller
}

Controller holds all non request-scoped objects.

func (*Controller) CreateKubernetesOperation

func (cc *Controller) CreateKubernetesOperation(c *gin.Context)

CreateKubernetesOperation is the main function that starts a kubernetes operation.

Kubernetes operations are things like deploy/delete manifest or perform a rolling restart. Spinnaker sends *all* of these types of events to the same endpoint (/kubernetes/ops), so we have to unmarshal and check which kind of operation we are performing.

The actual actions have been moved to the kubernetes subfolder to make this function a bit more readable.

func (*Controller) GetAccountCredentials

func (cc *Controller) GetAccountCredentials(c *gin.Context)

func (*Controller) GetArtifact

func (cc *Controller) GetArtifact(c *gin.Context)

This is actually a PUT request to /artifacts/fetch/, but I named it "GetArtifact" since that's what it's doing.

func (*Controller) GetInstance

func (cc *Controller) GetInstance(c *gin.Context)

GetInstance grabs an instance by account, location, and name. It builds the instance response and calculates health status of the instance.

func (*Controller) GetInstanceConsole

func (cc *Controller) GetInstanceConsole(c *gin.Context)

GetInstanceConsole returns the "console" of an instance. In the case for Kubernetes, a "console" is the logs of a given Pod.

func (*Controller) GetJob

func (cc *Controller) GetJob(c *gin.Context)

GetJob retrieves a given Kubernetes job from a given cluster given a namespace and name.

func (*Controller) GetManifest

func (cc *Controller) GetManifest(c *gin.Context)

GetManifest returns a manifest for a given account (cluster), namespace, kind, and name.

func (*Controller) GetManifestByTarget

func (cc *Controller) GetManifestByTarget(c *gin.Context)

func (*Controller) GetServerGroup

func (cc *Controller) GetServerGroup(c *gin.Context)

GetServerGroup returns a specific server group (Kubernetes kind ReplicaSet, DaemonSet, or StatefulSet) for a given cluster, namespace, name and Spinnaker application. This endpoint is called when clicking on a given resource in the "Clusters" tab in Deck.

func (*Controller) GetTask

func (cc *Controller) GetTask(c *gin.Context)

GetTask gets a task - currently only associated with kubernetes 'tasks'.

func (*Controller) ListApplications

func (cc *Controller) ListApplications(c *gin.Context)

ListApplications returns a list of applications and their associated accounts and clusters.

func (*Controller) ListArtifactCredentials

func (cc *Controller) ListArtifactCredentials(c *gin.Context)

func (*Controller) ListClusters

func (cc *Controller) ListClusters(c *gin.Context)

ListClusters returns a list of clusters for a given application, which for kubernetes is a map of provider names to kubernetes deployment kinds and names.

Clusters are kinds deployment, statefulSet, replicaSet, ingress, service, and daemonSet.

func (*Controller) ListCredentials

func (cc *Controller) ListCredentials(c *gin.Context)

List credentials for providers.

func (*Controller) ListHelmArtifactAccountNames

func (cc *Controller) ListHelmArtifactAccountNames(c *gin.Context)

func (*Controller) ListHelmArtifactAccountVersions

func (cc *Controller) ListHelmArtifactAccountVersions(c *gin.Context)

func (*Controller) ListLoadBalancers

func (cc *Controller) ListLoadBalancers(c *gin.Context)

ListLoadBalancers lists kubernetes "ingresses" and "services".

func (*Controller) ListServerGroupManagers

func (cc *Controller) ListServerGroupManagers(c *gin.Context)

ListServerGroupManagers returns a list of Kubernetes Deployments and their associated ReplicaSets for a given Spinnaker application.

func (*Controller) ListServerGroups

func (cc *Controller) ListServerGroups(c *gin.Context)

ListServerGroups returns a list of Kubernetes kinds ReplicaSets, DaemonSets, StatefulSets and their associated Pods.

func (*Controller) Search

func (cc *Controller) Search(c *gin.Context)

Search is the generic search endpoint. It currently just handles searching previously deployed Kubernetes resources. It queries the clouddriver DB and does NOT reach out to clusters for live data.

type Instance

type Instance struct {
	Account           string                 `json:"account,omitempty"`
	AccountName       string                 `json:"accountName,omitempty"`
	AvailabilityZone  string                 `json:"availabilityZone,omitempty"`
	CloudProvider     string                 `json:"cloudProvider,omitempty"`
	CreatedTime       int64                  `json:"createdTime,omitempty"`
	Health            []InstanceHealth       `json:"health,omitempty"`
	HealthState       string                 `json:"healthState,omitempty"`
	HumanReadableName string                 `json:"humanReadableName,omitempty"`
	ID                string                 `json:"id,omitempty"`
	Key               Key                    `json:"key,omitempty"`
	Kind              string                 `json:"kind,omitempty"`
	Labels            map[string]string      `json:"labels,omitempty"`
	Manifest          map[string]interface{} `json:"manifest,omitempty"`
	Moniker           Moniker                `json:"moniker,omitempty"`
	Name              string                 `json:"name,omitempty"`
	ProviderType      string                 `json:"providerType,omitempty"`
	Region            string                 `json:"region,omitempty"`
	Type              string                 `json:"type,omitempty"`
	UID               string                 `json:"uid,omitempty"`
	Zone              string                 `json:"zone,omitempty"`
}

Instance if a Kuberntes kind "Pod".

type InstanceCounts

type InstanceCounts struct {
	Down         int   `json:"down"`
	OutOfService int   `json:"outOfService"`
	Starting     int   `json:"starting"`
	Total        int32 `json:"total"`
	Unknown      int   `json:"unknown"`
	Up           int32 `json:"up"`
}

type InstanceHealth

type InstanceHealth struct {
	Platform string `json:"platform,omitempty"`
	Source   string `json:"source,omitempty"`
	State    string `json:"state"`
	Type     string `json:"type"`
}

type InstanceResponse

type InstanceResponse struct {
	Account           string                   `json:"account"`
	Apiversion        string                   `json:"apiVersion"`
	Cloudprovider     string                   `json:"cloudProvider"`
	Createdtime       int64                    `json:"createdTime"`
	Displayname       string                   `json:"displayName"`
	Health            []InstanceResponseHealth `json:"health"`
	Healthstate       string                   `json:"healthState"`
	Humanreadablename string                   `json:"humanReadableName"`
	Kind              string                   `json:"kind"`
	Labels            map[string]string        `json:"labels"`
	Moniker           Moniker                  `json:"moniker"`
	Name              string                   `json:"name"`
	Namespace         string                   `json:"namespace"`
	Providertype      string                   `json:"providerType"`
	Zone              string                   `json:"zone"`
}

InstanceRepsponse represents the HTTP response when requesting instance information. For Kubernetes, an "instance" is Pod.

type InstanceResponseHealth

type InstanceResponseHealth struct {
	Platform string `json:"platform"`
	Source   string `json:"source"`
	State    string `json:"state"`
	Type     string `json:"type"`
}

InstanceResponseHealth represents health of an instance, which is Kubernetes is a Pod.

type Job

type Job struct {
	Account           string                   `json:"account"`
	CompletionDetails JobCompletionDetails     `json:"completionDetails"`
	CreatedTime       int64                    `json:"createdTime"`
	JobState          string                   `json:"jobState"`
	Location          string                   `json:"location"`
	Name              string                   `json:"name"`
	Pods              []map[string]interface{} `json:"pods"`
	Provider          string                   `json:"provider"`
}

type JobCompletionDetails

type JobCompletionDetails struct {
	ExitCode string `json:"exitCode"`
	Message  string `json:"message"`
	Reason   string `json:"reason"`
	Signal   string `json:"signal"`
}

type Key

type Key struct {
	Account        string `json:"account"`
	Group          string `json:"group"`
	KubernetesKind string `json:"kubernetesKind"`
	Name           string `json:"name"`
	Namespace      string `json:"namespace"`
	Provider       string `json:"provider"`
}

type LoadBalancer

type LoadBalancer struct {
	Account       string                    `json:"account"`
	Apiversion    string                    `json:"apiVersion"`
	CloudProvider string                    `json:"cloudProvider"`
	CreatedTime   int64                     `json:"createdTime,omitempty"`
	DisplayName   string                    `json:"displayName"`
	Kind          string                    `json:"kind,omitempty"`
	Labels        map[string]string         `json:"labels,omitempty"`
	Moniker       Moniker                   `json:"moniker"`
	Name          string                    `json:"name"`
	Namespace     string                    `json:"namespace"`
	Region        string                    `json:"region"`
	ServerGroups  []LoadBalancerServerGroup `json:"serverGroups"`
	Type          string                    `json:"type"`
}

LoadBalancer represents Kubernetes kinds Service and Ingress.

type LoadBalancerInstance

type LoadBalancerInstance struct {
	Health LoadBalancerInstanceHealth `json:"health"`
	ID     string                     `json:"id"`
	Name   string                     `json:"name"`
	Zone   string                     `json:"zone"`
}

LoadBalancerInstance represents Pods in a ReplicaSet fronted by a LoadBalancer.

type LoadBalancerInstanceHealth

type LoadBalancerInstanceHealth struct {
	Platform string `json:"platform"`
	Source   string `json:"source"`
	State    string `json:"state"`
	Type     string `json:"type"`
}

LoadBalancerInstanceHealth is the health of a Pod.

type LoadBalancerServerGroup

type LoadBalancerServerGroup struct {
	Account           string                 `json:"account"`
	Cloudprovider     string                 `json:"cloudProvider"`
	Detachedinstances []LoadBalancerInstance `json:"detachedInstances"`
	Instances         []LoadBalancerInstance `json:"instances"`
	Isdisabled        bool                   `json:"isDisabled"`
	Name              string                 `json:"name"`
	Region            string                 `json:"region"`
}

LoadBalancerServer groups are ReplicaSets that are fronted by the LoadBalancer.

type LoadBalancers

type LoadBalancers []LoadBalancer

LoadBalancers is a slice of LoadBalancer.

type Metadata

type Metadata struct {
	ID string `json:"id"`
}

type Moniker

type Moniker struct {
	App     string `json:"app"`
	Cluster string `json:"cluster"`
}

type Page

type Page struct {
	PageNumber   int          `json:"pageNumber"`
	PageSize     int          `json:"pageSize"`
	Query        string       `json:"query"`
	Results      []PageResult `json:"results"`
	TotalMatches int          `json:"totalMatches"`
}

type PageResult

type PageResult struct {
	Account        string `json:"account"`
	Group          string `json:"group"`
	KubernetesKind string `json:"kubernetesKind"`
	Name           string `json:"name"`
	Namespace      string `json:"namespace"`
	Provider       string `json:"provider"`
	Region         string `json:"region"`
	Type           string `json:"type"`
	Application    string `json:"application,omitempty"`
	Cluster        string `json:"cluster,omitempty"`
}

type SearchResponse

type SearchResponse []Page

type ServerGroup

type ServerGroup struct {
	Account        string            `json:"account"`
	AccountName    string            `json:"accountName"`
	BuildInfo      BuildInfo         `json:"buildInfo"`
	Capacity       Capacity          `json:"capacity"`
	CloudProvider  string            `json:"cloudProvider"`
	Cluster        string            `json:"cluster,omitempty"`
	CreatedTime    int64             `json:"createdTime"`
	Disabled       bool              `json:"disabled"`
	DisplayName    string            `json:"displayName"`
	InstanceCounts InstanceCounts    `json:"instanceCounts"`
	Instances      []Instance        `json:"instances"`
	IsDisabled     bool              `json:"isDisabled"`
	Key            Key               `json:"key"`
	Kind           string            `json:"kind"`
	Labels         map[string]string `json:"labels"`
	// LaunchConfig struct {} `json:"launchConfig"`
	LoadBalancers       []string                        `json:"loadBalancers"`
	Manifest            map[string]interface{}          `json:"manifest"`
	Moniker             ServerGroupMoniker              `json:"moniker"`
	Name                string                          `json:"name"`
	Namespace           string                          `json:"namespace"`
	ProviderType        string                          `json:"providerType"`
	Region              string                          `json:"region"`
	SecurityGroups      []interface{}                   `json:"securityGroups"`
	ServerGroupManagers []ServerGroupServerGroupManager `json:"serverGroupManagers"`
	Type                string                          `json:"type"`
	UID                 string                          `json:"uid"`
	Zone                string                          `json:"zone"`
	Zones               []interface{}                   `json:"zones"`
	InsightActions      []interface{}                   `json:"insightActions"`
}

type ServerGroupManager

type ServerGroupManager struct {
	Account       string                          `json:"account"`
	APIVersion    string                          `json:"apiVersion"`
	CloudProvider string                          `json:"cloudProvider"`
	CreatedTime   int64                           `json:"createdTime"`
	Kind          string                          `json:"kind"`
	Labels        map[string]string               `json:"labels"`
	Moniker       Moniker                         `json:"moniker"`
	Name          string                          `json:"name"`
	DisplayName   string                          `json:"displayName"`
	Namespace     string                          `json:"namespace"`
	Region        string                          `json:"region"`
	ServerGroups  []ServerGroupManagerServerGroup `json:"serverGroups"`
}

ServerGroupManager is a Kubernetes kind "Deployment".

type ServerGroupManagerServerGroup

type ServerGroupManagerServerGroup struct {
	Account   string                               `json:"account"`
	Moniker   ServerGroupManagerServerGroupMoniker `json:"moniker"`
	Name      string                               `json:"name"`
	Namespace string                               `json:"namespace"`
	Region    string                               `json:"region"`
}

type ServerGroupManagerServerGroupMoniker

type ServerGroupManagerServerGroupMoniker struct {
	App      string `json:"app"`
	Cluster  string `json:"cluster"`
	Sequence int    `json:"sequence"`
}

type ServerGroupManagers

type ServerGroupManagers []ServerGroupManager

type ServerGroupMoniker

type ServerGroupMoniker struct {
	App      string `json:"app"`
	Cluster  string `json:"cluster"`
	Sequence int    `json:"sequence"`
}

type ServerGroupServerGroupManager

type ServerGroupServerGroupManager struct {
	Account  string `json:"account"`
	Location string `json:"location"`
	Name     string `json:"name"`
}

type ServerGroups

type ServerGroups []ServerGroup

type Stage

type Stage struct {
	Enabled bool   `json:"enabled"`
	Name    string `json:"name"`
}

type Stages

type Stages []Stage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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