k8s

package
v0.0.0-...-d31a008 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagedLabel      = "app.kubernetes.io/managed-by"
	ManagedLabelValue = "cinderella"
)
View Source
const (
	KubeconfigTemplate = "templates/kubeconfig.tmpl"
)

Variables

View Source
var ManagedLabelMap = map[string]string{
	"cinderella":                   "user",
	"app.kubernetes.io/managed-by": "cinderella",
}

Functions

func CreateEncryptedFile

func CreateEncryptedFile(claim model.Claim) (string, error)

func GetCinderellaNamespace

func GetCinderellaNamespace() string

GetCinderellaNamespace returns the namespace of cinderella it returns the get from CINDERELLA_POD_NAMESPACE environment variables if it is empty, it returns the get from configfile

func GetClient

func GetClient() (kubernetes.Interface, string)

func GetClientOutOfCluster

func GetClientOutOfCluster() (kubernetes.Interface, string)

GetClientOutOfCluster returns a k8s clientset to the request from outside of cluster

func GetDefaultClient

func GetDefaultClient() (kubernetes.Interface, string)

TODO: client取得するときにHost一緒に返すのあまりにも使いづらいのでなんとかする

func RaiseResourceCreateEvent

func RaiseResourceCreateEvent(message string)

func WriteEncryptedFile

func WriteEncryptedFile(writer io.Writer, claim model.Claim) error

Types

type Cleaner

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

func NewCleaner

func NewCleaner(client kubernetes.Interface, tickEvery time.Duration) (Cleaner, error)

func (*Cleaner) CleanupResources

func (c *Cleaner) CleanupResources(ctx context.Context, now time.Time)

一応外部から手動で呼び出せるようにしておく

func (*Cleaner) Start

func (c *Cleaner) Start(ctx context.Context) error

type CleanupError

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

func (CleanupError) Error

func (m CleanupError) Error() string

func (CleanupError) Unwrap

func (m CleanupError) Unwrap() error

type CleanupEvent

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

func (*CleanupEvent) EventAt

func (e *CleanupEvent) EventAt() time.Time

func (*CleanupEvent) GetMessage

func (e *CleanupEvent) GetMessage() string

func (*CleanupEvent) GetType

func (e *CleanupEvent) GetType() audit.AuditType

func (*CleanupEvent) String

func (e *CleanupEvent) String() string

type KubeconfigGenerator

type KubeconfigGenerator struct {
	Client kubernetes.Interface
}

func (*KubeconfigGenerator) Generate

func (gen *KubeconfigGenerator) Generate(writer io.Writer, name, namespace string) error

type KubeconfigValues

type KubeconfigValues struct {
	ClusterName string
	CA          string
	User        string
	Token       string
	Namespace   string
	Server      string
}

type ResourceCreateEvent

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

func (*ResourceCreateEvent) EventAt

func (e *ResourceCreateEvent) EventAt() time.Time

func (*ResourceCreateEvent) GetMessage

func (e *ResourceCreateEvent) GetMessage() string

func (*ResourceCreateEvent) GetType

func (e *ResourceCreateEvent) GetType() audit.AuditType

type ResourceCreator

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

func NewResourceCreator

func NewResourceCreator(claim model.Claim) (*ResourceCreator, error)

func (*ResourceCreator) Create

func (rc *ResourceCreator) Create() error

type RoleBindingValues

type RoleBindingValues struct {
	Subject                 string
	ServiceAccountName      string
	ServiceAccountNamespace string
	RoleBindingName         string
	RoleName                string
}

Jump to

Keyboard shortcuts

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