kubernetes

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomAuthorizationHeader = HeaderKey("kubernetes-authorization")
	OAuthAuthorizationHeader  = HeaderKey("Authorization")

	CustomUserAgent = "kubernetes-mcp-server/bearer-token-auth"
)
View Source
const (
	AppKubernetesComponent = "app.kubernetes.io/component"
	AppKubernetesManagedBy = "app.kubernetes.io/managed-by"
	AppKubernetesName      = "app.kubernetes.io/name"
	AppKubernetesPartOf    = "app.kubernetes.io/part-of"
)

Variables

View Source
var InClusterConfig = func() (*rest.Config, error) {

	inClusterConfig, err := rest.InClusterConfig()
	if inClusterConfig != nil {
		inClusterConfig.Host = "https://kubernetes.default.svc"
	}
	return inClusterConfig, err
}

InClusterConfig is a variable that holds the function to get the in-cluster config Exposed for testing

View Source
var Scheme = scheme.Scheme

Functions

This section is empty.

Types

type AccessControlClientset added in v0.0.44

type AccessControlClientset struct {
	// contains filtered or unexported fields
}

AccessControlClientset is a limited clientset delegating interface to the standard kubernetes.Clientset Only a limited set of functions are implemented with a single point of access to the kubernetes API where apiVersion and kinds are checked for allowed access

func NewAccessControlClientset added in v0.0.44

func NewAccessControlClientset(cfg *rest.Config, staticConfig *config.StaticConfig) (*AccessControlClientset, error)

func (*AccessControlClientset) DiscoveryClient added in v0.0.44

func (*AccessControlClientset) Pods added in v0.0.44

func (a *AccessControlClientset) Pods(namespace string) (corev1.PodInterface, error)

func (*AccessControlClientset) PodsExec added in v0.0.44

func (a *AccessControlClientset) PodsExec(namespace, name string, podExecOptions *v1.PodExecOptions) (remotecommand.Executor, error)

func (*AccessControlClientset) PodsMetricses added in v0.0.44

func (a *AccessControlClientset) PodsMetricses(ctx context.Context, namespace, name string, listOptions metav1.ListOptions) (*metrics.PodMetricsList, error)

func (*AccessControlClientset) SelfSubjectAccessReviews added in v0.0.44

func (*AccessControlClientset) Services added in v0.0.44

func (a *AccessControlClientset) Services(namespace string) (corev1.ServiceInterface, error)

func (*AccessControlClientset) TokenReview added in v0.0.45

TokenReview returns TokenReviewInterface

type AccessControlRESTMapper added in v0.0.44

type AccessControlRESTMapper struct {
	// contains filtered or unexported fields
}

func NewAccessControlRESTMapper added in v0.0.44

func NewAccessControlRESTMapper(delegate *restmapper.DeferredDiscoveryRESTMapper, staticConfig *config.StaticConfig) *AccessControlRESTMapper

func (AccessControlRESTMapper) KindFor added in v0.0.44

func (AccessControlRESTMapper) KindsFor added in v0.0.44

func (AccessControlRESTMapper) RESTMapping added in v0.0.44

func (a AccessControlRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)

func (AccessControlRESTMapper) RESTMappings added in v0.0.44

func (a AccessControlRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)

func (AccessControlRESTMapper) Reset added in v0.0.44

func (a AccessControlRESTMapper) Reset()

func (AccessControlRESTMapper) ResourceFor added in v0.0.44

func (AccessControlRESTMapper) ResourceSingularizer added in v0.0.44

func (a AccessControlRESTMapper) ResourceSingularizer(resource string) (singular string, err error)

func (AccessControlRESTMapper) ResourcesFor added in v0.0.44

type CloseWatchKubeConfig added in v0.0.19

type CloseWatchKubeConfig func() error

type HeaderKey added in v0.0.46

type HeaderKey string

type Kubernetes

type Kubernetes struct {
	// contains filtered or unexported fields
}

func (*Kubernetes) EventsList added in v0.0.18

func (k *Kubernetes) EventsList(ctx context.Context, namespace string) ([]map[string]any, error)

func (*Kubernetes) NamespaceOrDefault added in v0.0.31

func (k *Kubernetes) NamespaceOrDefault(namespace string) string

func (*Kubernetes) NamespacesList added in v0.0.21

func (k *Kubernetes) NamespacesList(ctx context.Context, options ResourceListOptions) (runtime.Unstructured, error)

func (*Kubernetes) NewHelm added in v0.0.43

func (k *Kubernetes) NewHelm() *helm.Helm

func (*Kubernetes) PodsDelete added in v0.0.12

func (k *Kubernetes) PodsDelete(ctx context.Context, namespace, name string) (string, error)

func (*Kubernetes) PodsExec added in v0.0.21

func (k *Kubernetes) PodsExec(ctx context.Context, namespace, name, container string, command []string) (string, error)

func (*Kubernetes) PodsGet added in v0.0.10

func (k *Kubernetes) PodsGet(ctx context.Context, namespace, name string) (*unstructured.Unstructured, error)

func (*Kubernetes) PodsListInAllNamespaces

func (k *Kubernetes) PodsListInAllNamespaces(ctx context.Context, options ResourceListOptions) (runtime.Unstructured, error)

func (*Kubernetes) PodsListInNamespace

func (k *Kubernetes) PodsListInNamespace(ctx context.Context, namespace string, options ResourceListOptions) (runtime.Unstructured, error)

func (*Kubernetes) PodsLog added in v0.0.10

func (k *Kubernetes) PodsLog(ctx context.Context, namespace, name, container string) (string, error)

func (*Kubernetes) PodsRun added in v0.0.11

func (k *Kubernetes) PodsRun(ctx context.Context, namespace, name, image string, port int32) ([]*unstructured.Unstructured, error)

func (*Kubernetes) PodsTop added in v0.0.42

func (k *Kubernetes) PodsTop(ctx context.Context, options PodsTopOptions) (*metrics.PodMetricsList, error)

func (*Kubernetes) ProjectsList added in v0.0.21

func (k *Kubernetes) ProjectsList(ctx context.Context, options ResourceListOptions) (runtime.Unstructured, error)

func (*Kubernetes) ResourcesCreateOrUpdate added in v0.0.10

func (k *Kubernetes) ResourcesCreateOrUpdate(ctx context.Context, resource string) ([]*unstructured.Unstructured, error)

func (*Kubernetes) ResourcesDelete added in v0.0.10

func (k *Kubernetes) ResourcesDelete(ctx context.Context, gvk *schema.GroupVersionKind, namespace, name string) error

func (*Kubernetes) ResourcesGet added in v0.0.10

func (k *Kubernetes) ResourcesGet(ctx context.Context, gvk *schema.GroupVersionKind, namespace, name string) (*unstructured.Unstructured, error)

func (*Kubernetes) ResourcesList

func (k *Kubernetes) ResourcesList(ctx context.Context, gvk *schema.GroupVersionKind, namespace string, options ResourceListOptions) (runtime.Unstructured, error)

type Manager added in v0.0.43

type Manager struct {
	CloseWatchKubeConfig CloseWatchKubeConfig
	// contains filtered or unexported fields
}

func NewManager added in v0.0.43

func NewManager(config *config.StaticConfig) (*Manager, error)

func (*Manager) Close added in v0.0.43

func (m *Manager) Close()

func (*Manager) ConfigurationView added in v0.0.43

func (m *Manager) ConfigurationView(minify bool) (runtime.Object, error)

func (*Manager) Derived added in v0.0.43

func (m *Manager) Derived(ctx context.Context) (*Kubernetes, error)

func (*Manager) GetAPIServerHost added in v0.0.45

func (m *Manager) GetAPIServerHost() string

func (*Manager) IsInCluster added in v0.0.43

func (m *Manager) IsInCluster() bool

func (*Manager) IsOpenShift added in v0.0.43

func (m *Manager) IsOpenShift(_ context.Context) bool

func (*Manager) NamespaceOrDefault added in v0.0.43

func (m *Manager) NamespaceOrDefault(namespace string) string

func (*Manager) ToDiscoveryClient added in v0.0.43

func (m *Manager) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

func (*Manager) ToRESTConfig added in v0.0.43

func (m *Manager) ToRESTConfig() (*rest.Config, error)

ToRESTConfig returns the rest.Config object (genericclioptions.RESTClientGetter)

func (*Manager) ToRESTMapper added in v0.0.43

func (m *Manager) ToRESTMapper() (meta.RESTMapper, error)

func (*Manager) ToRawKubeConfigLoader added in v0.0.43

func (m *Manager) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader returns the clientcmd.ClientConfig object (genericclioptions.RESTClientGetter)

func (*Manager) VerifyToken added in v0.0.45

func (m *Manager) VerifyToken(ctx context.Context, token, audience string) (*authenticationv1api.UserInfo, []string, error)

func (*Manager) WatchKubeConfig added in v0.0.43

func (m *Manager) WatchKubeConfig(onKubeConfigChange func() error)

type PodsTopOptions added in v0.0.42

type PodsTopOptions struct {
	metav1.ListOptions
	AllNamespaces bool
	Namespace     string
	Name          string
}

type ResourceListOptions added in v0.0.40

type ResourceListOptions struct {
	metav1.ListOptions
	AsTable bool
}

Jump to

Keyboard shortcuts

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