Documentation ¶
Index ¶
- Variables
- type Client
- func (c Client) CheckStatus(resourceType string, clusterName string, action string) error
- func (c Client) CreateKubernetesObjects(clusterName string, obj *unstructured.Unstructured, ...) error
- func (c Client) GetConfig() (*rest.Config, error)
- func (c Client) JobStatus(clusterName string, action string) error
- func (c Client) LaunchKubernetesObjects(clusterName string, template []ResourceTemplate) error
- func (c Client) ManageObjects(clusterName string, template []ResourceTemplate, resourceType string, ...) (*unstructured.Unstructured, error)
- func (c Client) RenderYamlTemplate(resourceName string, templatebody string, data TemplateData) (*bytes.Buffer, error)
- func (c Client) SpokeClusterExists(name string) bool
- func (c Client) ViewProcessing(viewConditions []interface{}) (string, string)
- type ResourceTemplate
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
var ( MCA = "managedclusteractions" MCV = "managedclusterviews" Failed = "FAILED" Done = "DONE" NExist = "NON-EXISTENT" NErr = "NO ERROR" TimeInterval = 5 TimeOut = 120 Launch = "launched" Complete = "completed" )
MCA, MCV represnts the corresponding resources
var ActionCreateTemplates = []ResourceTemplate{
{"backup-create-namespace", mngClusterActCreateNS},
{"backup-create-serviceaccount", mngClusterActCreateSA},
{"backup-create-rolebinding", mngClusterActCreateRB},
{"backup-create-job", mngClusterActCreateJob},
}
ActionCreateTemplates populates templates for creation of managedclusteraction resources
var JobDeleteTemplates = []ResourceTemplate{
{"backup-delete-ns", mngClusterActDeleteNS},
}
JobDeleteTemplates populates templates for creation of managedclusteraction resource to delete the namespace in the spoke
var ViewCreateTemplates = []ResourceTemplate{
{"backup-create-clusterview", mngClusterViewJob},
}
ViewCreateTemplates populates templates for creation of managedclusterview resource
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Spoke []string BackupPath string KubeconfigPath string KubernetesClient dynamic.Interface }
Client provides a k8s dynamic client
func (Client) CheckStatus ¶
CheckStatus checks whether the job launched on the spoke was successfully launched and finished returns: error
func (Client) CreateKubernetesObjects ¶
func (c Client) CreateKubernetesObjects(clusterName string, obj *unstructured.Unstructured, resource schema.GroupVersionResource) error
CreateKubernetesObjects creates specific mca and mcv object targeted to spoke cluster based on unstructured object and gvr returns: error
func (Client) JobStatus ¶
JobStatus uses timeout to verify the state of the job in a predefined window returns: error
func (Client) LaunchKubernetesObjects ¶
func (c Client) LaunchKubernetesObjects(clusterName string, template []ResourceTemplate) error
LaunchKubernetesObjects creates managedclusteraction and managedclusterview resources from template returns: error
func (Client) ManageObjects ¶
func (c Client) ManageObjects(clusterName string, template []ResourceTemplate, resourceType string, action string) (*unstructured.Unstructured, error)
ManageObjects can query and delete k8s resource returns: *unstructured.Unstructured (view data)
error
func (Client) RenderYamlTemplate ¶
func (c Client) RenderYamlTemplate(resourceName string, templatebody string, data TemplateData) (*bytes.Buffer, error)
RenderYamlTemplate renders a single yaml template
resourceName - resource name templateBody - template body
returns: bytes.Buffer rendered template
error
func (Client) SpokeClusterExists ¶
SpokeClusterExists verifies if a provided spoke cluster do exist or not returns: bool
func (Client) ViewProcessing ¶
ViewProcessing checks whether managedclusterview is processing or complete returns: processing bool
type ResourceTemplate ¶
type ResourceTemplate struct { // Must always correspond the Action or View resource name ResourceName string Template string }
ResourceTemplate define a resource template structure
type TemplateData ¶
TemplateData provides template rendering data