Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) AsUser(user *management.User) (*Client, error)
- func (c *Client) GetClusterCatalogClient(clusterID string) (*catalog.Client, error)
- func (c *Client) GetDownStreamClusterClient(clusterID string) (dynamic.Interface, error)
- func (c *Client) GetEC2Client() (*ec2.Client, error)
- func (c *Client) GetKubeAPIProvisioningClient() (*kubeProvisioning.Client, error)
- func (c *Client) GetKubeAPIRKEClient() (*kubeRKE.Client, error)
- func (c *Client) GetManagementWatchInterface(schemaType string, opts metav1.ListOptions) (watch.Interface, error)
- func (c *Client) GetRancherDynamicClient() (dynamic.Interface, error)
- func (c *Client) IsConnected() (isConnected bool, err error)
- func (c *Client) ReLogin() (*Client, error)
- func (c *Client) SwitchContext(context string, clientConfig *clientcmd.ClientConfig) (dynamic.Interface, error)
- func (c *Client) WithSession(session *session.Session) (*Client, error)
- type Config
Constants ¶
const ConfigurationFileKey = "rancher"
The json/yaml config key for the rancher config
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Client used to access management.cattle.io v3 API resources Management *management.Client // Client used to access Steve v1 API resources Steve *v1.Client // Client used to access catalog.cattle.io v1 API resources (apps, charts, etc.) Catalog *catalog.Client // Config used to test against a rancher instance RancherConfig *Config // Wrangler context to use to access management.cattle.io v3 API resources WranglerContext *wrangler.Context // CLI is the client used to interact with the Rancher CLI CLI *ranchercli.Client // Session is the session object used by the client to track all the resources being created by the client. Session *session.Session // Flags is the environment flags used by the client to test selectively against a rancher instance. Flags *environmentflag.EnvironmentFlags // contains filtered or unexported fields }
Client is the main rancher Client object that gives an end user access to the Provisioning and Management clients in order to create resources on rancher
func NewClient ¶
NewClient is the constructor to the initializing a rancher Client. It takes a bearer token and session.Session. If bearer token is not provided, the bearer token provided in the configuration file is used.
func (*Client) AsUser ¶
func (c *Client) AsUser(user *management.User) (*Client, error)
AsUser accepts a user object, and then creates a token for said `user`. Then it instantiates and returns a Client using the token created. This function uses the login action, and user must have a correct username and password combination.
func (*Client) GetClusterCatalogClient ¶
GetClusterCatalogClient is a function that takes a clusterID and instantiates a catalog client to directly communicate with that specific cluster.
func (*Client) GetDownStreamClusterClient ¶
GetDownStreamClusterClient is a helper function that instantiates a dynamic client to communicate with a specific cluster.
func (*Client) GetEC2Client ¶
GetEC2Client is a helper function that instantiates an aws ec2 client to communicate with the ec2 instances on aws.
func (*Client) GetKubeAPIProvisioningClient ¶
func (c *Client) GetKubeAPIProvisioningClient() (*kubeProvisioning.Client, error)
GetKubeAPIProvisioningClient is a function that instantiates a provisioning client that communicates with the Kube API of a cluster
func (*Client) GetKubeAPIRKEClient ¶
GetKubeAPIRKEClient is a function that instantiates a rke client that communicates with the Kube API of a cluster
func (*Client) GetManagementWatchInterface ¶
func (c *Client) GetManagementWatchInterface(schemaType string, opts metav1.ListOptions) (watch.Interface, error)
GetManagementWatchInterface is a functions used to get a watch.Interface from a resource created by the Management Client. As is the Management resources do not have a watch.Interface, so therefore, the dynamic Client is used to get the watch.Interface. The `schemaType` is a string that is found in different Management clients packages. Ex) management.ProjectType
func (*Client) GetRancherDynamicClient ¶
GetRancherDynamicClient is a helper function that instantiates a dynamic client to communicate with the rancher host.
func (*Client) IsConnected ¶
IsConnected is a helper function that pings rancher ping endpoint with the management, steve and rest clients. Returns boolean value depending on if all the clients are able to get pong respond.
func (*Client) ReLogin ¶
ReLogin reinstantiates a Client to update its API schema. This function would be used for a non admin user that needs to be "reloaded" inorder to have updated permissions for certain resources.
func (*Client) SwitchContext ¶
func (c *Client) SwitchContext(context string, clientConfig *clientcmd.ClientConfig) (dynamic.Interface, error)
SwitchContext is a helper function that changes the current context to `context` and instantiates a dynamic client
func (*Client) WithSession ¶
WithSession accepts a session.Session and instantiates a new Client to reference this new session.Session. The main purpose is to use it when created "sub sessions" when tracking resources created at a test case scope.
type Config ¶
type Config struct { Host string `yaml:"host" json:"host"` AdminToken string `yaml:"adminToken" json:"adminToken"` AdminPassword string `yaml:"adminPassword" json:"adminPassword"` Insecure *bool `yaml:"insecure" json:"insecure" default:"true"` Cleanup *bool `yaml:"cleanup" json:"cleanup" default:"true"` CAFile string `yaml:"caFile" json:"caFile" default:""` CACerts string `yaml:"caCerts" json:"caCerts" default:""` ClusterName string `yaml:"clusterName" json:"clusterName" default:""` ShellImage string `yaml:"shellImage" json:"shellImage" default:""` RancherCLI bool `yaml:"rancherCLI" json:"rancherCLI" default:"false"` }
Config is configuration need to test against a rancher instance