util

package
v0.0.0-...-edbd4c5 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateServiceSpec

func CreateServiceSpec(s ServiceConfig) *v1.Service

func GetContextFromKubeconfig

func GetContextFromKubeconfig(kubeconfigpath string) (string, error)

func ImpersonateWithUserClient

func ImpersonateWithUserClient(serviceaccountname string, namespace string) (*kubernetes.Clientset, error)

func LoadFile

func LoadFile(path string) ([]byte, error)

func MakeSecPod

func MakeSecPod(p PodSpec) *v1.Pod

func NewKubeClient

func NewKubeClient() (*kubernetes.Clientset, error)

func RunAccessCheck

func RunAccessCheck(client *kubernetes.Clientset, namespace string, resource GroupResource, verb string) (bool, string, error)

Types

type GroupResource

type GroupResource struct {
	APIGroup    string
	APIResource metav1.APIResource
}

type PodSpec

type PodSpec struct {
	NS                  string                      `default:""`
	Pvclaims            []*v1.PersistentVolumeClaim `default:"-"`
	InlineVolumeSources []*v1.VolumeSource          `default:"-"`
	HostNetwork         bool                        `default:"false"`
	Command             string                      `default:""`
	HostIPC             bool                        `default:"false"`
	HostPID             bool                        `default:"false"`

	RunAsNonRoot             bool               `default:"-"`
	IsPrivileged             bool               `default:"false"`
	Capability               []v1.Capability    `default:"-"`
	Ports                    []v1.ContainerPort `default:"-"`
	AllowPrivilegeEscalation bool               `default:"false"`
	// contains filtered or unexported fields
}

https://github.com/creasty/defaults#usage

func (*PodSpec) SetDefaults

func (p *PodSpec) SetDefaults() error

type ServiceConfig

type ServiceConfig struct {
	Type     v1.ServiceType
	Selector map[string]string
}

Jump to

Keyboard shortcuts

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