Documentation ¶
Index ¶
- Variables
- func Create[T any, PT AddrofObject[T]](ctx context.Context, ctl *Ctl, obj T) (*T, error)
- func Delete[T any, PT AddrofObject[T]](ctx context.Context, ctl *Ctl, key ObjectKey) error
- func EncodeYAML(scheme *runtime.Scheme, objs ...Object) ([]byte, error)
- func EncodeYAMLInto(w io.Writer, scheme *runtime.Scheme, objs ...Object) error
- func Get[T any, PT AddrofObject[T]](ctx context.Context, ctl *Ctl, key ObjectKey) (*T, error)
- func List[T any, L ObjectList[T]](ctx context.Context, ctl *Ctl, opts ...client.ListOption) (*T, error)
- func RestToConfig(cfg *rest.Config) clientcmdapi.Config
- type AddrofObject
- type Ctl
- func (c *Ctl) Create(ctx context.Context, obj Object) error
- func (c *Ctl) Delete(ctx context.Context, obj Object) error
- func (c *Ctl) Exec(ctx context.Context, pod *corev1.Pod, opts ExecOptions) error
- func (c *Ctl) Get(ctx context.Context, key ObjectKey, obj Object) error
- func (c *Ctl) RestConfig() *rest.Config
- type ExecOptions
- type Object
- type ObjectKey
- type ObjectList
- type RESTConfig
Constants ¶
This section is empty.
Variables ¶
var ( NewYAMLFrameReader = json.YAMLFramer.NewFrameReader NewYAMLFrameWriter = json.YAMLFramer.NewFrameWriter )
var WriteToFile = clientcmd.WriteToFile
Functions ¶
func Create ¶
Get is a generic equivalent of Ctl.Create.
func Delete ¶
Get is a generic equivalent of Ctl.Delete.
func EncodeYAML ¶
EncodeYAML calls EncodeYAMLInto with a bytes.Buffer and returns the resultant bytes.
func EncodeYAMLInto ¶
EncodeYAMLInto encodes a slice of [Object]s into multi-document YAML and writes them to w. NOTE: .TypeMeta of all provided objects WILL BE SET BY THIS FUNCTION.
func List ¶
func List[T any, L ObjectList[T]](ctx context.Context, ctl *Ctl, opts ...client.ListOption) (*T, error)
List is a generic equivalent of [Ctl.List].
func RestToConfig ¶
func RestToConfig(cfg *rest.Config) clientcmdapi.Config
Types ¶
type AddrofObject ¶
AddrofObject is a helper type constraint for accepting a struct value that implements the Object interface.
type Ctl ¶
type Ctl struct {
// contains filtered or unexported fields
}
Ctl is a Kubernetes client inspired by the shape of the `kubectl` CLI with a focus on being ergonomic.
func (*Ctl) Get ¶
Get fetches the latest state of an object into `obj` from Kubernetes. Usage:
var pod corev1.Pod ctl.Get(ctx, kube.ObjectKey{Namespace: "", Name:""}, &pod)
func (*Ctl) RestConfig ¶
RestConfig returns a deep copy of the rest.Config used by this Ctl.
type ExecOptions ¶
type Object ¶
func DecodeYAML ¶
DecodeYAML calls DecodeYAMLFrom with a bytes.Reader.
func DecodeYAMLFrom ¶
DecodeYAMLFrom decodes a multi-document YAML into a slice of concretely types [kube.Object]s. To appropriately decode, a scheme that's knowledgable of all the provided types must be provided. If none is provided, the scheme from Kubernetes' go client will be used.
type ObjectList ¶
type ObjectList[T any] interface { client.ObjectList *T }
ObjectList is a generic equivalent of ObjectList.