Help us shape the future of Go! Take the 2026 Go Developer Survey

k8s

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindNamespace             = "Namespace"
	KindNode                  = "Node"
	KindPod                   = "Pod"
	KindJob                   = "Job"
	KindCronJob               = "CronJob"
	KindReplicaSet            = "ReplicaSet"
	KindReplicationController = "ReplicationController"
	KindStatefulSet           = "StatefulSet"
	KindDaemonSet             = "DaemonSet"
	KindDeployment            = "Deployment"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Image string `json:"image"`
	//ImagePullPolicy string `json:"imagePullPolicy"`
	Name string `json:"name"`
}

type ContainerStatus

type ContainerStatus struct {
	ContainerID string `json:"containerID"`
	Image       string `json:"image"`
	ImageID     string `json:"imageID"`
	Name        string `json:"name"`
}

type Image

type Image struct {
	Name          string
	Tag           string
	Digest        string
	RepositoryURL string
	ImageID       string
	Arch          string
}

type ImageReference

type ImageReference struct {
	Reference string
	Name      string
	Tag       string
	Digest    string
	Registry  string
}

func ParseImageReference

func ParseImageReference(image string) (ImageReference, error)

func (ImageReference) Identifier

func (ir ImageReference) Identifier() string

func (ImageReference) String

func (ir ImageReference) String() string

type Item

type Item struct {
	ApiVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Metadata   struct {
		CreationTimestamp time.Time         `json:"creationTimestamp"`
		Labels            map[string]string `json:"labels,omitempty"`
		Name              string            `json:"name"`
		Namespace         string            `json:"namespace,omitempty"`
		ResourceVersion   string            `json:"resourceVersion"`
		Uid               string            `json:"uid"`
		//GenerateName    string `json:"generateName,omitempty"`
		OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
	} `json:"metadata"`
	Spec struct {
		Type                string      `json:"type,omitempty"`
		Containers          []Container `json:"containers,omitempty"`
		EphemeralContainers []Container `json:"ephemeralContainers,omitempty"`
		InitContainers      []Container `json:"initContainers,omitempty"`
		NodeName            string      `json:"nodeName,omitempty"`
	} `json:"spec"`
	Status struct {
		ContainerStatuses          []ContainerStatus `json:"containerStatuses,omitempty"`
		EphemeralContainerStatuses []ContainerStatus `json:"ephemeralContainerStatuses,omitempty"`
		InitContainerStatuses      []ContainerStatus `json:"initContainerStatuses,omitempty"`

		NodeInfo NodeInfo `json:"nodeInfo,omitempty"`
		Images   []struct {
			Names []string `json:"names,omitempty"`
		} `json:"images,omitempty"`
	} `json:"status"`
}

type KubectlSnapshot

type KubectlSnapshot struct {
	ApiVersion string `json:"apiVersion"`
	Items      []Item `json:"items"`
}

type NodeInfo

type NodeInfo struct {
	Architecture            string `json:"architecture"`
	BootID                  string `json:"bootID"`
	ContainerRuntimeVersion string `json:"containerRuntimeVersion"`
	KernelVersion           string `json:"kernelVersion"`
	KubeProxyVersion        string `json:"kubeProxyVersion"`
	KubeletVersion          string `json:"kubeletVersion"`
	MachineID               string `json:"machineID"`
	OperatingSystem         string `json:"operatingSystem"`
	OsImage                 string `json:"osImage"`
	SystemUUID              string `json:"systemUUID"`
}

type OwnerReference

type OwnerReference struct {
	ApiVersion         string `json:"apiVersion"`
	BlockOwnerDeletion bool   `json:"blockOwnerDeletion,omitempty"`
	Controller         bool   `json:"controller"`
	Kind               string `json:"kind"`
	Name               string `json:"name"`
	Uid                string `json:"uid"`
}

type Resource

type Resource struct {
	Id                      string
	Namespace               string
	Kind                    string
	Labels                  map[string]string
	Name                    string
	Images                  []Image
	Arch                    string // nodes
	NodeName                string // name is unique in namespace
	OsImage                 string
	ContainerRuntimeVersion string
}

type Snapshot

type Snapshot struct {
	Resources []Resource
}

func ParseKubetclSnapshot

func ParseKubetclSnapshot(bs []byte) (*Snapshot, error)

Jump to

Keyboard shortcuts

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