Documentation
¶
Index ¶
- Constants
- func DeleteJob(c *gin.Context)
- func ListSecurityGroups(c *gin.Context)
- func ListStages(c *gin.Context)
- func OK(*gin.Context)
- type AccountNamespaces
- type Application
- type ApplicationAttributes
- type Applications
- type Artifact
- type BuildInfo
- type Capacity
- type ClusterServerGroups
- type ClusterServerGroupsServerGroup
- type ClusterServerGroupsServerGroupManager
- type Clusters
- type Controller
- func (cc *Controller) CreateKubernetesOperation(c *gin.Context)
- func (cc *Controller) GetAccountCredentials(c *gin.Context)
- func (cc *Controller) GetArtifact(c *gin.Context)
- func (cc *Controller) GetInstance(c *gin.Context)
- func (cc *Controller) GetInstanceConsole(c *gin.Context)
- func (cc *Controller) GetJob(c *gin.Context)
- func (cc *Controller) GetManifest(c *gin.Context)
- func (cc *Controller) GetManifestByCriteria(c *gin.Context)
- func (cc *Controller) GetServerGroup(c *gin.Context)
- func (cc *Controller) GetTask(c *gin.Context)
- func (cc *Controller) ListApplications(c *gin.Context)
- func (cc *Controller) ListArtifactCredentials(c *gin.Context)
- func (cc *Controller) ListClusters(c *gin.Context)
- func (cc *Controller) ListClustersByName(c *gin.Context)
- func (cc *Controller) ListCredentials(c *gin.Context)
- func (cc *Controller) ListHelmArtifactAccountNames(c *gin.Context)
- func (cc *Controller) ListHelmArtifactAccountVersions(c *gin.Context)
- func (cc *Controller) ListLoadBalancers(c *gin.Context)
- func (cc *Controller) ListManifestsByCluster(c *gin.Context)
- func (cc *Controller) ListProjectClusters(c *gin.Context)
- func (cc *Controller) ListServerGroupManagers(c *gin.Context)
- func (cc *Controller) ListServerGroups(c *gin.Context)
- func (cc *Controller) Search(c *gin.Context)
- type Instance
- type InstanceCounts
- type InstanceHealth
- type InstanceResponse
- type InstanceResponseHealth
- type Job
- type JobCompletionDetails
- type Key
- type LoadBalancer
- type LoadBalancerInstance
- type LoadBalancerInstanceHealth
- type LoadBalancerServerGroup
- type LoadBalancers
- type Metadata
- type Moniker
- type Page
- type PageResult
- type Project
- type ProjectApplication
- type ProjectCluster
- type ProjectClusterBuild
- type SearchResponse
- type ServerGroup
- type ServerGroupManager
- type ServerGroupManagerServerGroup
- type ServerGroupManagerServerGroupMoniker
- type ServerGroupManagers
- type ServerGroupMoniker
- type ServerGroupServerGroupManager
- type ServerGroups
- type Stage
- type Stages
Constants ¶
const KeyAllApplications = `AllApplications`
Variables ¶
This section is empty.
Functions ¶
func DeleteJob ¶
DeleteJob is not implemented for the Kubernetes provider V2. See https://github.com/spinnaker/spinnaker/issues/4644#issuecomment-627287782.
func ListSecurityGroups ¶
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": "...",
"kubernetes.accounts[0].dockerRegistries[0].accountName": "docker-registry",
"kubernetes.accounts[0].dockerRegistries[0].namespaces": "",
"kubernetes.accounts[0].kubeconfigContents": "...",
"kubernetes.accounts[0].liveManifestCalls": true,
"kubernetes.accounts[0].metrics": false,
"kubernetes.accounts[0].name": "...",
"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]": "...",
"kubernetes.accounts[0].permissions.READ[1]": "...",
"kubernetes.accounts[0].permissions.WRITE[0]": "...",
"kubernetes.accounts[0].providerVersion": "V2",
"kubernetes.accounts[0].requiredGroupMembership": "",
}
}
]
}
func ListStages ¶
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"
}
]
Types ¶
type AccountNamespaces ¶
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 ClusterServerGroups ¶
type ClusterServerGroups struct {
AccountName string `json:"accountName"`
Application string `json:"application"`
LoadBalancers []string `json:"loadBalancers"`
Moniker Moniker `json:"moniker"`
Name string `json:"name"`
ServerGroups []ClusterServerGroupsServerGroup `json:"serverGroups"`
Type string `json:"type"`
}
type ClusterServerGroupsServerGroup ¶
type ClusterServerGroupsServerGroup struct {
Account string `json:"account"`
APIVersion string `json:"apiVersion"`
// Buildinfo struct {
// Images []string `json:"images"`
// } `json:"buildInfo"`
// Capacity struct {
// Desired int `json:"desired"`
// Pinned bool `json:"pinned"`
// } `json:"capacity"`
CloudProvider string `json:"cloudProvider"`
// CreatedTime int64 `json:"createdTime"`
// Disabled bool `json:"disabled"`
DisplayName string `json:"displayName"`
// Instancecounts struct {
// Down int `json:"down"`
// Outofservice int `json:"outOfService"`
// Starting int `json:"starting"`
// Total int `json:"total"`
// Unknown int `json:"unknown"`
// Up int `json:"up"`
// } `json:"instanceCounts"`
// Instances []struct {
// Account string `json:"account"`
// Apiversion string `json:"apiVersion"`
// Cloudprovider string `json:"cloudProvider"`
// Createdtime int64 `json:"createdTime"`
// Displayname string `json:"displayName"`
// Health []struct {
// Platform string `json:"platform"`
// Source string `json:"source"`
// State string `json:"state"`
// Type string `json:"type"`
// } `json:"health"`
// Healthstate string `json:"healthState"`
// Humanreadablename string `json:"humanReadableName"`
// Kind string `json:"kind"`
// Labels struct {
// AppKubernetesIoManagedBy string `json:"app.kubernetes.io/managed-by"`
// AppKubernetesIoName string `json:"app.kubernetes.io/name"`
// MonikerSpinnakerIoSequence string `json:"moniker.spinnaker.io/sequence"`
// PodTemplateHash string `json:"pod-template-hash"`
// Run string `json:"run"`
// } `json:"labels"`
// Moniker struct {
// App string `json:"app"`
// Cluster string `json:"cluster"`
// Sequence int `json:"sequence"`
// } `json:"moniker"`
// Name string `json:"name"`
// Namespace string `json:"namespace"`
// Providertype string `json:"providerType"`
// Zone string `json:"zone"`
// } `json:"instances"`
Kind string `json:"kind"`
Labels map[string]string `json:"labels"`
// Launchconfig struct {
// } `json:"launchConfig"`
// Loadbalancers []string{} `json:"loadBalancers"`
Moniker ServerGroupMoniker `json:"moniker"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Region string `json:"region"`
// Securitygroups []interface{} `json:"securityGroups"`
ServerGroupManagers []ClusterServerGroupsServerGroupManager `json:"serverGroupManagers"`
Type string `json:"type"`
Zones []interface{} `json:"zones"`
}
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) GetManifestByCriteria ¶
func (cc *Controller) GetManifestByCriteria(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) ListClustersByName ¶
func (cc *Controller) ListClustersByName(c *gin.Context)
ListClustersByName returns a list of clusters for a given application, account, and name, where name is something like "deployment my-deployment".
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) ListManifestsByCluster ¶
func (cc *Controller) ListManifestsByCluster(c *gin.Context)
ListManifestsByCluster returns a list of manifest coordinates for a given account, namespace, location, kind, and cluster.
func (*Controller) ListProjectClusters ¶
func (cc *Controller) ListProjectClusters(c *gin.Context)
ListProjectClusters retrieves the cluster details for a Spinnaker project.
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 ignores the `pageSize` query parameter and lists resources for a kind and namespace across all accounts the user has access to concurrently.
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 Kubernetes kind "Pod".
type InstanceCounts ¶
type InstanceHealth ¶
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 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 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 Project ¶
type Project struct {
Account string `json:"account"`
Applications []ProjectApplication `json:"applications"`
Detail string `json:"detail"`
InstanceCounts InstanceCounts `json:"instanceCounts"`
Stack string `json:"stack"`
}
type ProjectApplication ¶
type ProjectApplication struct {
Application string `json:"application"`
Clusters []ProjectCluster `json:"clusters"`
LastPush int64 `json:"lastPush"`
}
type ProjectCluster ¶
type ProjectCluster struct {
Builds []ProjectClusterBuild `json:"builds"`
InstanceCounts InstanceCounts `json:"instanceCounts"`
LastPush int64 `json:"lastPush"`
Region string `json:"region"`
}
type ProjectClusterBuild ¶
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 ServerGroupManagers ¶
type ServerGroupManagers []ServerGroupManager
type ServerGroupMoniker ¶
type ServerGroups ¶
type ServerGroups []ServerGroup