Documentation
¶
Index ¶
- Constants
- func CreateKubernetesOperation(c *gin.Context)
- func DeleteJob(c *gin.Context)
- func GetAccountCredentials(c *gin.Context)
- func GetArtifact(c *gin.Context)
- func GetInstance(c *gin.Context)
- func GetInstanceConsole(c *gin.Context)
- func GetJob(c *gin.Context)
- func GetManifest(c *gin.Context)
- func GetManifestByTarget(c *gin.Context)
- func GetServerGroup(c *gin.Context)
- func GetTask(c *gin.Context)
- func ListApplications(c *gin.Context)
- func ListArtifactCredentials(c *gin.Context)
- func ListClusters(c *gin.Context)
- func ListCredentials(c *gin.Context)
- func ListHelmArtifactAccountNames(c *gin.Context)
- func ListHelmArtifactAccountVersions(c *gin.Context)
- func ListLoadBalancers(c *gin.Context)
- func ListSecurityGroups(c *gin.Context)
- func ListServerGroupManagers(c *gin.Context)
- func ListServerGroups(c *gin.Context)
- func ListStages(c *gin.Context)
- func OK(*gin.Context)
- func Search(c *gin.Context)
- type AccountNamespaces
- type Application
- type ApplicationAttributes
- type Applications
- type Artifact
- type BuildInfo
- type Capacity
- type Clusters
- 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 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 CreateKubernetesOperation ¶
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 DeleteJob ¶ added in v0.17.0
DeleteJob is not implemented for the Kubernetes provider V2. See https://github.com/spinnaker/spinnaker/issues/4644#issuecomment-627287782.
func GetAccountCredentials ¶
func GetArtifact ¶
This is actually a PUT request to /artifacts/fetch/, but I named it "GetArtifact" since that's what it's doing.
func GetInstance ¶
GetInstance grabs an instance by account, location, and name. It builds the instance response and calculates health status of the instance.
func GetInstanceConsole ¶
GetInstanceConsole returns the "console" of an instance. In the case for Kubernetes, a "console" is the logs of a given Pod.
func GetJob ¶
GetJob retrieves a given Kubernetes job from a given cluster given a namespace and name.
func GetManifest ¶
func GetManifestByTarget ¶
func GetServerGroup ¶
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 ListApplications ¶
ListApplications returns a list of applications and their associated accounts and clusters.
func ListArtifactCredentials ¶
func ListClusters ¶
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 ListLoadBalancers ¶
ListLoadBalancers lists kubernetes "ingresses" and "services".
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": "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].k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LaTkra1A2VXplNVpUejdiRlFZTjg3Ty9IYmxWMnlPNU9PdU0yQ1BLbGU2CktFZTZ2d2ZhcjhmMy93cUlTR25OaUtmRTdpZ0JuYzJOa1ZuY2ZMSUNXUHU4N0dQci81UEl1NHpPMmhaWnlDY00KY29Jblh6T2hSSWFQRVNmU0RQV2ErQS9vWnRiTnBlaTlKdmR3aXlGUFVndHhTS1ZFUmlHYjdXSUhpMEUwV3A4ZApaWGx3M2NQM2NETDhBQ0FlSDRXenhQS01TaVo0R3IrWHZRMzBmOWxOSHdPWngzYjF2WUJSNHZBZjllVTkwTlJ4CllKWVN4UzREeDNwejVRN0o1cWtuUVhKRUFUSyswZUI4NWt5NXcvTFVUbSticE9nMm9hK2hHV1lxK1NqcUp2NzAKUWQwRjBqUm9vYWRCa0NJaWRpQUkKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=\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 ListServerGroupManagers ¶
ListServerGroupManagers returns a list of Kubernetes Deployments and their associated ReplicaSets for a given Spinnaker application.
func ListServerGroups ¶
ListServerGroups returns a list of Kubernetes kinds ReplicaSets, DaemonSets, StatefulSets and their associated Pods.
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 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 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 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 ServerGroupManagers ¶
type ServerGroupManagers []ServerGroupManager
type ServerGroupMoniker ¶
type ServerGroups ¶
type ServerGroups []ServerGroup