Documentation ¶
Index ¶
- func Module() fx.Option
- type K8sClient
- type K8sClientConstructorIn
- type RealK8sClient
- func (r *RealK8sClient) GetClientSet() *kubernetes.Clientset
- func (r *RealK8sClient) GetDynamicClient() dynamic.Interface
- func (r *RealK8sClient) GetRESTMapper() apimeta.RESTMapper
- func (r *RealK8sClient) GetScaleClient() scale.ScalesGetter
- func (r *RealK8sClient) ScaleForGroupKind(ctx context.Context, namespace, name string, groupKind schema.GroupKind) (*autoscalingv1.Scale, schema.GroupResource, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type K8sClient ¶
type K8sClient interface { GetClientSet() *kubernetes.Clientset GetScaleClient() scale.ScalesGetter GetDynamicClient() dynamic.Interface GetRESTMapper() apimeta.RESTMapper ScaleForGroupKind(context.Context, string, string, schema.GroupKind) (*autoscalingv1.Scale, schema.GroupResource, error) }
K8sClient provides an interface for kubernetes client.
func Providek8sClient ¶
func Providek8sClient(in K8sClientConstructorIn) (K8sClient, error)
Providek8sClient provides a new kubernetes client and sets logger.
type K8sClientConstructorIn ¶
type K8sClientConstructorIn struct { fx.In HTTPClient *http.Client `name:"k8s-http-client"` Shutdowner fx.Shutdowner }
K8sClientConstructorIn holds parameter for Providek8sClient and Providek8sDynamicClient.
type RealK8sClient ¶
type RealK8sClient struct {
// contains filtered or unexported fields
}
RealK8sClient provides access to Kubernetes Clients.
func NewK8sClient ¶
func NewK8sClient(httpClient *http.Client, shutdowner fx.Shutdowner) (*RealK8sClient, error)
NewK8sClient returns a new kubernetes client.
func (*RealK8sClient) GetClientSet ¶
func (r *RealK8sClient) GetClientSet() *kubernetes.Clientset
GetClientSet returns the kubernetes client set.
func (*RealK8sClient) GetDynamicClient ¶ added in v0.19.0
func (r *RealK8sClient) GetDynamicClient() dynamic.Interface
GetDynamicClient returns the kubernetes dynamic client.
func (*RealK8sClient) GetRESTMapper ¶ added in v0.19.0
func (r *RealK8sClient) GetRESTMapper() apimeta.RESTMapper
GetRESTMapper returns the rest mapper.
func (*RealK8sClient) GetScaleClient ¶ added in v0.19.0
func (r *RealK8sClient) GetScaleClient() scale.ScalesGetter
GetScaleClient returns the kubernetes scale client.
func (*RealK8sClient) ScaleForGroupKind ¶ added in v0.19.0
func (r *RealK8sClient) ScaleForGroupKind(ctx context.Context, namespace, name string, groupKind schema.GroupKind) (*autoscalingv1.Scale, schema.GroupResource, error)
ScaleForGroupKind attempts to fetch the scale for the given Group and Kind. The possible Resources for the group and kind are retrieved. Scale is fetched for each Resource in the RESTMapping with the given name and namespace, until a working one is found. If none work, the first error is returned. It returns both the scale, as well as the group-resource from the working mapping.