Documentation ¶
Overview ¶
Package resource provides a general CRUD interface for Kubernetes resources.
Index ¶
- func BuildRestConfigFromData(apiServer, apiServerToken, caData string, tls *rest.TLSClientConfig) (*rest.Config, error)
- func BuildRestConfigFromFiles(apiServer, apiServerTokenFile, caFile string, tls *rest.TLSClientConfig) *rest.Config
- func DefaultUpdateStatus(_ context.Context, _ runtime.Object, _ metav1.UpdateOptions) (runtime.Object, error)
- func EnsureValidName(name string) string
- func GetAuthorizedRestConfigFromData(apiServer, apiServerToken, caData string, tls *rest.TLSClientConfig, ...) (restConfig *rest.Config, authorized bool, err error)
- func GetAuthorizedRestConfigFromDataByYD(apiServer, apiServerToken, caData string, tls *rest.TLSClientConfig, ...) (restConfig *rest.Config, authorized bool, err error)
- func GetAuthorizedRestConfigFromFiles(apiServer, apiServerTokenFile, caFile string, tls *rest.TLSClientConfig, ...) (restConfig *rest.Config, authorized bool, err error)
- func GetAuthorizedRestConfigFromFilesByYD(apiServer, apiServerTokenFile, caFile string, tls *rest.TLSClientConfig, ...) (restConfig *rest.Config, authorized bool, err error)
- func IsAuthorizedFor(restConfig *rest.Config, gvr schema.GroupVersionResource, namespace string) (bool, error)
- func IsUnknownAuthorityError(err error) bool
- func MustToMeta(obj runtime.Object) metav1.Object
- func MustToUnstructured(from runtime.Object) *unstructured.Unstructured
- func MustToUnstructuredUsingDefaultConverter(from runtime.Object) *unstructured.Unstructured
- func MustToUnstructuredUsingScheme(from runtime.Object, usingScheme *runtime.Scheme) *unstructured.Unstructured
- func ToJSON(o any) string
- func ToUnstructured(from runtime.Object) (*unstructured.Unstructured, error)
- func ToUnstructuredUsingScheme(from runtime.Object, usingScheme *runtime.Scheme) (*unstructured.Unstructured, error)
- type Interface
- func ForClusterRole(client kubernetes.Interface) Interface
- func ForClusterRoleBinding(client kubernetes.Interface) Interface
- func ForConfigMap(client kubernetes.Interface, namespace string) Interface
- func ForDaemonSet(client kubernetes.Interface, namespace string) Interface
- func ForDeployment(client kubernetes.Interface, namespace string) Interface
- func ForNamespace(client kubernetes.Interface) Interface
- func ForPod(client kubernetes.Interface, namespace string) Interface
- func ForRole(client kubernetes.Interface, namespace string) Interface
- func ForRoleBinding(client kubernetes.Interface, namespace string) Interface
- func ForService(client kubernetes.Interface, namespace string) Interface
- func ForServiceAccount(client kubernetes.Interface, namespace string) Interface
- type InterfaceFuncs
- func (i *InterfaceFuncs) Create(ctx context.Context, obj runtime.Object, options metav1.CreateOptions) (runtime.Object, error)
- func (i *InterfaceFuncs) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error
- func (i *InterfaceFuncs) Get(ctx context.Context, name string, options metav1.GetOptions) (runtime.Object, error)
- func (i *InterfaceFuncs) Update(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error)
- func (i *InterfaceFuncs) UpdateStatus(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRestConfigFromData ¶
func BuildRestConfigFromFiles ¶
func BuildRestConfigFromFiles(apiServer, apiServerTokenFile, caFile string, tls *rest.TLSClientConfig) *rest.Config
func DefaultUpdateStatus ¶
func DefaultUpdateStatus(_ context.Context, _ runtime.Object, _ metav1.UpdateOptions) (runtime.Object, error)
DefaultUpdateStatus returns NotFound error indicating the status subresource isn't supported.
func EnsureValidName ¶
func GetAuthorizedRestConfigFromData ¶
func GetAuthorizedRestConfigFromData(apiServer, apiServerToken, caData string, tls *rest.TLSClientConfig, gvr schema.GroupVersionResource, namespace string, ) (restConfig *rest.Config, authorized bool, err error)
func GetAuthorizedRestConfigFromDataByYD ¶ added in v0.15.13
func GetAuthorizedRestConfigFromFiles ¶
func GetAuthorizedRestConfigFromFiles(apiServer, apiServerTokenFile, caFile string, tls *rest.TLSClientConfig, gvr schema.GroupVersionResource, namespace string, ) (restConfig *rest.Config, authorized bool, err error)
func GetAuthorizedRestConfigFromFilesByYD ¶ added in v0.15.25
func IsAuthorizedFor ¶
func IsUnknownAuthorityError ¶
func MustToUnstructured ¶
func MustToUnstructured(from runtime.Object) *unstructured.Unstructured
func MustToUnstructuredUsingDefaultConverter ¶
func MustToUnstructuredUsingDefaultConverter(from runtime.Object) *unstructured.Unstructured
MustToUnstructuredUsingDefaultConverter uses runtime.DefaultUnstructuredConverter which doesn't use a runtime.Scheme and thus the returned Unstructured will not have the type metadata field populated.
func MustToUnstructuredUsingScheme ¶
func MustToUnstructuredUsingScheme(from runtime.Object, usingScheme *runtime.Scheme) *unstructured.Unstructured
func ToUnstructured ¶
func ToUnstructured(from runtime.Object) (*unstructured.Unstructured, error)
func ToUnstructuredUsingScheme ¶
func ToUnstructuredUsingScheme(from runtime.Object, usingScheme *runtime.Scheme) (*unstructured.Unstructured, error)
Types ¶
type Interface ¶
type Interface interface { Get(ctx context.Context, name string, options metav1.GetOptions) (runtime.Object, error) Create(ctx context.Context, obj runtime.Object, options metav1.CreateOptions) (runtime.Object, error) Update(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error) UpdateStatus(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error }
func ForClusterRole ¶
func ForClusterRole(client kubernetes.Interface) Interface
func ForClusterRoleBinding ¶
func ForClusterRoleBinding(client kubernetes.Interface) Interface
func ForConfigMap ¶
func ForConfigMap(client kubernetes.Interface, namespace string) Interface
func ForDaemonSet ¶
func ForDaemonSet(client kubernetes.Interface, namespace string) Interface
func ForDeployment ¶
func ForDeployment(client kubernetes.Interface, namespace string) Interface
func ForNamespace ¶
func ForNamespace(client kubernetes.Interface) Interface
func ForRoleBinding ¶
func ForRoleBinding(client kubernetes.Interface, namespace string) Interface
func ForService ¶
func ForService(client kubernetes.Interface, namespace string) Interface
func ForServiceAccount ¶
func ForServiceAccount(client kubernetes.Interface, namespace string) Interface
type InterfaceFuncs ¶
type InterfaceFuncs struct { GetFunc func(ctx context.Context, name string, options metav1.GetOptions) (runtime.Object, error) CreateFunc func(ctx context.Context, obj runtime.Object, options metav1.CreateOptions) (runtime.Object, error) UpdateFunc func(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error) UpdateStatusFunc func(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error) DeleteFunc func(ctx context.Context, name string, options metav1.DeleteOptions) error }
func ForControllerClient ¶
func ForControllerClient(client controllerClient.Client, namespace string, objType controllerClient.Object) *InterfaceFuncs
func ForDynamic ¶
func ForDynamic(client dynamic.ResourceInterface) *InterfaceFuncs
func (*InterfaceFuncs) Create ¶
func (i *InterfaceFuncs) Create(ctx context.Context, obj runtime.Object, options metav1.CreateOptions) (runtime.Object, error)
func (*InterfaceFuncs) Delete ¶
func (i *InterfaceFuncs) Delete(ctx context.Context, name string, options metav1.DeleteOptions, ) error
func (*InterfaceFuncs) Get ¶
func (i *InterfaceFuncs) Get(ctx context.Context, name string, options metav1.GetOptions) (runtime.Object, error)
func (*InterfaceFuncs) Update ¶
func (i *InterfaceFuncs) Update(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error)
func (*InterfaceFuncs) UpdateStatus ¶
func (i *InterfaceFuncs) UpdateStatus(ctx context.Context, obj runtime.Object, options metav1.UpdateOptions) (runtime.Object, error)
Click to show internal directories.
Click to hide internal directories.