Documentation ¶
Index ¶
- Constants
- Variables
- func PopulateResourceListV1WithDefValues(spec string) (v1.ResourceList, error)
- type BuilderOptions
- type Client
- func (c *Client) Apply(content []byte) error
- func (c *Client) ApplyFiles(filenames ...string) error
- func (c *Client) ApplyResource(r *resource.Result) error
- func (c *Client) Approve(ctx context.Context, name string, sa []byte) error
- func (c *Client) Create(content []byte) error
- func (c *Client) CreateFile(filenames ...string) error
- func (c *Client) CreateNamespace(ctx context.Context, namespace string) error
- func (c *Client) CreateResource(r *resource.Result) error
- func (c *Client) Delete(content []byte) error
- func (c *Client) DeleteFiles(filenames ...string) error
- func (c *Client) DeleteNamespace(ctx context.Context, namespace string) error
- func (c *Client) DeleteResource(r *resource.Result) error
- func (c *Client) Get(ctx context.Context, gvkRes []byte, namespace string) ([]byte, error)
- func (c *Client) GetAvailableNodeResources(ctx context.Context, resName string) (int64, int64, map[string]int64, error)
- func (c *Client) GetClusterNodes(ctx context.Context) (*corev1.NodeList, error)
- func (c *Client) GetMasterNodeIP(ctx context.Context) (nodeIP string, err error)
- func (c *Client) GetNodeLabels(ctx context.Context) (map[string](map[string]string), error)
- func (c *Client) GetPodList(ctx context.Context, nodeName string) (*corev1.PodList, error)
- func (c *Client) GetPodsTotalRequestsAndLimits(ctx context.Context, podList *corev1.PodList) (map[corev1.ResourceName]resource.Quantity, ...)
- func (c *Client) IsReachable() error
- func (c *Client) NodesReady(ctx context.Context) (ready int, total int, err error)
- func (c *Client) Replace(content []byte) error
- func (c *Client) ReplaceFiles(filenames ...string) error
- func (c *Client) ReplaceResource(r *resource.Result) error
- func (c *Client) ResultForContent(content []byte, opt *BuilderOptions) *Result
- func (c *Client) ResultForFilenameParam(filenames []string, opt *BuilderOptions) *Result
- func (c *Client) ResultForReader(r io.Reader, opt *BuilderOptions) *Result
- func (c *Client) Version() (string, error)
- type ReadResource
- type Result
Constants ¶
const DefaultValidation = false
DefaultValidation default action to validate. If `true` all resources by default will be validated.
Variables ¶
var ( // ErrLoggerInternal is returned when an error occurs due to the logger ErrLoggerInternal = errors.New("internal logger error") )
Functions ¶
func PopulateResourceListV1WithDefValues ¶
func PopulateResourceListV1WithDefValues(spec string) (v1.ResourceList, error)
PopulateResourceListV1WithDefValues takes strings of form <resourceName1>=<value1>,<resourceName1>=<value2> and returns ResourceList.
Types ¶
type BuilderOptions ¶
type BuilderOptions struct { Unstructured bool Validate bool Namespace string LabelSelector string FieldSelector string All bool AllNamespaces bool }
BuilderOptions parameters to create a Resource Builder
func NewBuilderOptions ¶
func NewBuilderOptions() *BuilderOptions
NewBuilderOptions creates a BuilderOptions with the default values for the parameters to create a Resource Builder
type Client ¶
type Client struct { Clientset kubernetes.Interface DynamicClient dynamic.Interface RestMapper meta.RESTMapper ServerSideApply bool // contains filtered or unexported fields }
Client is a kubernetes client, like `kubectl`
func NewKubeFakeClient ¶
NewKubeFakeClient returns a fake kube client object
func (*Client) ApplyFiles ¶
ApplyFiles create the resource(s) from the given filenames (file, directory or STDIN) or HTTP URLs
func (*Client) ApplyResource ¶
ApplyResource applies the given resource. Create the resources with `ResultForFilenameParam` or `ResultForContent`
func (*Client) CreateFile ¶
CreateFile creates a resource with the given content
func (*Client) CreateNamespace ¶
CreateNamespace creates a namespace with the given name
func (*Client) CreateResource ¶
CreateResource creates the given resource. Create the resources with `ResultForFilenameParam` or `ResultForContent`
func (*Client) DeleteFiles ¶
DeleteFiles create the resource(s) from the given filenames (file, directory or STDIN) or HTTP URLs
func (*Client) DeleteNamespace ¶
DeleteNamespace deletes the namespace with the given name
func (*Client) DeleteResource ¶
DeleteResource applies the given resource. Create the resources with `ResultForFilenameParam` or `ResultForContent`
func (*Client) GetAvailableNodeResources ¶
func (c *Client) GetAvailableNodeResources(ctx context.Context, resName string) (int64, int64, map[string]int64, error)
GetAvailableNodeResources returns the Resource available in the cluster(after dedecting running pods resource requirements)
func (*Client) GetClusterNodes ¶
GetClusterNodes lists all the nodes deployed on the cluster
func (*Client) GetMasterNodeIP ¶
GetMasterNodeIP returns the master node IP of the deployed app
func (*Client) GetNodeLabels ¶
GetNodeLabels .. Fetch labels published by the K8s node
func (*Client) GetPodList ¶
GetPodList lists all the pods deployed on the node
func (*Client) GetPodsTotalRequestsAndLimits ¶
func (c *Client) GetPodsTotalRequestsAndLimits(ctx context.Context, podList *corev1.PodList) (map[corev1.ResourceName]resource.Quantity, map[corev1.ResourceName]resource.Quantity, error)
GetPodsTotalRequestsAndLimits ... Get resource total requests/limits (including running instances)
func (*Client) IsReachable ¶
IsReachable tests connectivity to the cluster
func (*Client) NodesReady ¶
NodesReady returns the number of nodes ready
func (*Client) ReplaceFiles ¶
ReplaceFiles create the resource(s) from the given filenames (file, directory or STDIN) or HTTP URLs
func (*Client) ReplaceResource ¶
ReplaceResource applies the given resource. Create the resources with `ResultForFilenameParam` or `ResultForContent`
func (*Client) ResultForContent ¶
func (c *Client) ResultForContent(content []byte, opt *BuilderOptions) *Result
ResultForContent returns the builder results for the given content
func (*Client) ResultForFilenameParam ¶
func (c *Client) ResultForFilenameParam(filenames []string, opt *BuilderOptions) *Result
ResultForFilenameParam returns the builder results for the given list of files or URLs
func (*Client) ResultForReader ¶
func (c *Client) ResultForReader(r io.Reader, opt *BuilderOptions) *Result
ResultForReader returns the builder results for the given reader
type ReadResource ¶
type ReadResource struct { Gvk schema.GroupVersionKind `json:"GVK,omitempty"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` }
ReadResource is structure used for reading resource