Documentation ¶
Index ¶
- Constants
- func DefaultClient() (client *kubernetes.Clientset, err error)
- func ExtractMetadata(v any) v1.ObjectMeta
- func GetOrCreate[T any](ctx context.Context, api APIGetCreate[T], obj *T) (out *T, err error)
- func GetOrCreateTLSSecret(ctx context.Context, api APIGetCreate[corev1.Secret], name string, ...) (secret *corev1.Secret, res gracex509.PEMPair, err error)
- func InClusterClient() (client *kubernetes.Clientset, err error)
- func InClusterNamespace() (string, error)
- type APIGetCreate
- type MetadataObject
Constants ¶
View Source
const (
PathServiceAccountNamespace = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultClient ¶
func DefaultClient() (client *kubernetes.Clientset, err error)
DefaultClient create kubernetes client automatically, first try in-cluster client, then from default kubeconfig locations
func ExtractMetadata ¶
func ExtractMetadata(v any) v1.ObjectMeta
ExtractMetadata extract 'metadata' field from any kubernetes resource object
func GetOrCreate ¶
func GetOrCreate[T any](ctx context.Context, api APIGetCreate[T], obj *T) (out *T, err error)
GetOrCreate get or create a kubernetes resource
func GetOrCreateTLSSecret ¶
func GetOrCreateTLSSecret( ctx context.Context, api APIGetCreate[corev1.Secret], name string, opts gracex509.GenerateOptions, ) (secret *corev1.Secret, res gracex509.PEMPair, err error)
GetOrCreateTLSSecret get or create a secret with type tls, using gracex509.Generate
func InClusterClient ¶
func InClusterClient() (client *kubernetes.Clientset, err error)
InClusterClient create a kubernetes client from in-cluster environment
func InClusterNamespace ¶
InClusterNamespace determine current namespace from in-cluster environment
Types ¶
type APIGetCreate ¶
type MetadataObject ¶
type MetadataObject struct {
v1.ObjectMeta `json:"metadata"`
}
Click to show internal directories.
Click to hide internal directories.