kubernetes

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 19 Imported by: 22

Documentation

Overview

Copyright © 2019 Portworx

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DEFAULT_TAIL_LINES = int64(10)
	NO_TAIL_LINES      = int64(-1)
)

Variables

View Source
var (

	// KubeCliOpts is setup by cmd/root.go
	KubeCliOpts *genericclioptions.ConfigFlags
)
View Source
var (
	NODE_KEY = []byte("node=")
)

Functions

func InKubectlPluginMode added in v0.22.0

func InKubectlPluginMode() bool

InKubectlPluginMode returns true if running as a plugin to kubectl

func KubeConnect

func KubeConnect(cfgFile, context string) (clientcmd.ClientConfig, *kubernetes.Clientset, error)

KubeConnect will return a Kubernetes client using the kubeconfig file set in the default context. clientcmd.ClientConfig will allow the caller to call ClientConfig.Namespace() to get the namespace set by the caller on their Kubeconfig.

func KubeConnectDefault added in v0.21.4

func KubeConnectDefault() (clientcmd.ClientConfig, *kubernetes.Clientset, error)

KubeConnectDefault returns a Kubernetes client to the default or named context.

Types

type COps added in v0.21.3

type COps interface {
	// Close close the connection
	Close()
	// GetDefaultNamespace returns the default namespace
	GetDefaultNamespace() (string, error)
	// GetNamespace returns the default namespace if namespace is nil
	// else returns *namespace
	GetNamespace(namespace *string) (string, error)
	// GetPodsByLabels returns pods from specified namespace with the given labels
	// labels should be of the form "abc=def,xyz=mno"
	GetPodsByLabels(namespace string, labels string) ([]v1.Pod, error)
	// GetPvcsByLabels returns pvcs from spacified namespace with given labels
	// labels should be of the form "abc=def,xyz=mno"
	GetPvcsByLabels(namespace string, labels string) ([]v1.PersistentVolumeClaim, error)
	// GetLogs writes out logs to out based on the logOptions specified
	GetLogs(logOptions *COpsLogOptions, out io.Writer) error
}

func NewCOps added in v0.21.3

func NewCOps(connect bool) (COps, error)

type COpsLogOptions added in v0.21.3

type COpsLogOptions struct {
	PodLogOptions       v1.PodLogOptions
	IgnoreLogErrors     bool
	MaxFollowConcurency int
	ShowPodInfo         bool
	Filters             []string
	ApplyFilters        bool
	PortworxNamespace   string
	CInfo               []ContainerInfo
}

type ContainerInfo added in v0.21.3

type ContainerInfo struct {
	Pod       v1.Pod
	Container string
	MountPath string
}

type KubectlPortForwarder added in v0.22.0

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

KubectlPortForwarder object

func (*KubectlPortForwarder) Endpoint added in v0.22.0

func (p *KubectlPortForwarder) Endpoint() string

Endpoint returns the gRPC endpoint to the SDK

func (*KubectlPortForwarder) Start added in v0.22.0

func (p *KubectlPortForwarder) Start() error

Start creates the portforward using kubectl

func (*KubectlPortForwarder) Stop added in v0.22.0

func (p *KubectlPortForwarder) Stop() error

Stop ends the session

type PortForwarder added in v0.22.0

type PortForwarder interface {
	Endpoint() string
	Start() error
	Stop() error
}

PortForwarder provides a way to forward a local port to Portworx endpoint

func NewKubectlPortForwarder added in v0.22.0

func NewKubectlPortForwarder(kubeconfig string) PortForwarder

NewKubectlPortForwarder forwards a local port to the Portworx gRPC SDK endpoint through the Kubernetes API server using kubectl If kubeconfig is not provided, then kubectl will use the default kubeconfig

type PxPvc added in v0.21.2

type PxPvc struct {
	Name      string
	Namespace string
	PodNames  []string
	Pvc       *v1.PersistentVolumeClaim
	PxVolume  *api.Volume
	Pods      []v1.Pod
}

func NewPxPvc added in v0.21.2

func NewPxPvc(pvc *v1.PersistentVolumeClaim) *PxPvc

func (*PxPvc) GetPodNames added in v0.21.2

func (p *PxPvc) GetPodNames() []string

func (*PxPvc) GetVolume added in v0.21.2

func (p *PxPvc) GetVolume() *api.Volume

func (*PxPvc) SetPods added in v0.21.2

func (p *PxPvc) SetPods(pods []v1.Pod) bool

SetPods return true if found

func (*PxPvc) SetVolume added in v0.21.2

func (p *PxPvc) SetVolume(vols []*api.Volume) bool

SetVolume return true if found

Jump to

Keyboard shortcuts

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