kubernetes

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ClientTypeCLI = "cli"

ClientTypeCLI is the client_type a session opened from this CLI declares.

Variables

This section is empty.

Functions

func CloseSession added in v1.16.0

func CloseSession(ac *client.AlpaconClient, sessionID string) error

CloseSession ends a proxy session.

func GetClusterDetailRaw

func GetClusterDetailRaw(ac *client.AlpaconClient, clusterID string) ([]byte, error)

GetClusterDetailRaw fetches one cluster by ID and returns the body as the server sent it.

func GetClusterIDByName

func GetClusterIDByName(ac *client.AlpaconClient, clusterName string) (string, error)

GetClusterIDByName resolves a cluster name to its ID through the server's exact-match name filter.

func ResolveGroupNames

func ResolveGroupNames(ac *client.AlpaconClient, groupIDs []string) []string

ResolveGroupNames maps group UUIDs to names in one batched lookup. A UUID with no match, or every UUID when the lookup fails, is shown as-is so the caller's output is never blocked on the group list.

Types

type ClusterAttributes

type ClusterAttributes struct {
	Name         string           `json:"name"`
	Provider     string           `json:"provider"`
	KubeVersion  Optional[string] `json:"kube_version" table:"Kube Version"`
	NodeCount    Optional[int]    `json:"node_count" table:"Nodes"`
	Connected    bool             `json:"connected"`
	Enabled      bool             `json:"enabled"`
	AgentVersion string           `json:"agent_version" table:"Agent Version"`
}

ClusterAttributes is the 'kube ls' row. Its version and node count keep the server's names and types, so a script reading --output json sees node_count as a number and a value the agent has not reported yet as null; the table shows that as blank. Connected follows ServerAttributes, not is_connected.

func GetClusterList

func GetClusterList(ac *client.AlpaconClient) ([]ClusterAttributes, error)

GetClusterList returns every cluster the caller can see, projected for 'kube ls'. A service token sees none: the server answers it with an empty list.

type ClusterDetail

type ClusterDetail struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	Provider         string          `json:"provider"`
	KubeVersion      *string         `json:"kube_version"`
	AgentVersion     string          `json:"agent_version"`
	NodeCount        *int            `json:"node_count"`
	Status           json.RawMessage `json:"status"`
	Enabled          bool            `json:"enabled"`
	Groups           []string        `json:"groups"`
	Tags             json.RawMessage `json:"tags"`
	IsConnected      bool            `json:"is_connected"`
	LastConnectivity *time.Time      `json:"last_connectivity"`
	LastSyncedAt     *time.Time      `json:"last_synced_at"`
	AddedAt          time.Time       `json:"added_at"`
	UpdatedAt        time.Time       `json:"updated_at"`
}

ClusterDetail decodes one entry of /api/kubernetes/clusters/. Status and Tags stay raw: the server stores both as free-form JSON, and status has no enum. KubeVersion and NodeCount are nil until the agent has measured them, which is not the same as an empty version or zero nodes.

func GetClusterDetail

func GetClusterDetail(ac *client.AlpaconClient, clusterID string) (*ClusterDetail, error)

GetClusterDetail fetches one cluster by ID.

type KubeSessionCreateRequest added in v1.16.0

type KubeSessionCreateRequest struct {
	Cluster     string `json:"cluster"`
	WorkSession string `json:"work_session,omitempty"`
	ClientType  string `json:"client_type"`
}

KubeSessionCreateRequest opens a proxy session to one cluster. Cluster and WorkSession are UUIDs; WorkSession is left out when no session is active.

type KubeSessionResponse added in v1.16.0

type KubeSessionResponse struct {
	ID             string    `json:"id"`
	Cluster        string    `json:"cluster"`
	ChannelID      string    `json:"channel_id"`
	ChannelToken   string    `json:"channel_token"`
	TokenExpiredAt time.Time `json:"token_expired_at"`
	ProxyURL       string    `json:"proxy_url"`
}

KubeSessionResponse is the session the server opened. ChannelToken is the credential kubectl presents to ProxyURL until TokenExpiredAt.

func CreateSession added in v1.16.0

CreateSession opens a proxy session to a cluster. The channel token appears only in this response—the server never returns it again—so the caller must persist it at once.

type Optional

type Optional[T any] struct {
	Value *T
}

Optional is a value the server may send as null. PrintTable formats a cell with %v, which would print a bare pointer's address, so the pointer is wrapped: String renders null as blank and MarshalJSON keeps it null.

func (Optional[T]) MarshalJSON

func (o Optional[T]) MarshalJSON() ([]byte, error)

func (Optional[T]) String

func (o Optional[T]) String() string

Jump to

Keyboard shortcuts

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