utils

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKubeClientSet

func CreateKubeClientSet() (clientset.Interface, error)

CreateKubeClientSet obtains the client set interface from Kubeconfig

func CreateTestingNamespace

func CreateTestingNamespace(baseName string, cs clientset.Interface) (*v1.Namespace, error)

CreateTestingNamespace builds namespace for each test baseName and labels determine name of the space

func DeleteNamespace

func DeleteNamespace(cs clientset.Interface, namespace string) error

DeleteNamespace deletes the provided namespace, waits for it to be completely deleted, and then checks whether there are any pods remaining in a non-terminating state.

func DeleteNodes

func DeleteNodes(cs clientset.Interface, names []string) error

DeleteNodes ensures a list of nodes to be deleted

func DeletePod

func DeletePod(cs clientset.Interface, ns string, podName string) error

DeletePod deletes a single pod

func DeletePodsInNamespace

func DeletePodsInNamespace(cs clientset.Interface, ns string) error

DeletePodsInNamespace deletes all pods in the namespace

func DeleteService

func DeleteService(cs clientset.Interface, ns string, serviceName string) error

DeleteService deletes a service

func DeleteServiceIfExists

func DeleteServiceIfExists(cs clientset.Interface, ns string, serviceName string) error

DeleteServiceIfExists deletes a service if it exists, return nil if not exists

func ExtractDNSPrefix

func ExtractDNSPrefix() string

ExtractDNSPrefix obtains the cluster DNS prefix

func GetAgentNodes

func GetAgentNodes(cs clientset.Interface) ([]v1.Node, error)

GetAgentNodes obtains the list of agent nodes

func GetAvailableNodeCapacity

func GetAvailableNodeCapacity(cs clientset.Interface) (resource.Quantity, error)

GetAvailableNodeCapacity will calculate the overall quantity of cpu requested by all running pods in all namespaces

func GetNextSubnetCIDR

func GetNextSubnetCIDR(vnet aznetwork.VirtualNetwork) (string, error)

GetNextSubnetCIDR obatins a new ip address which has no overlapping with other subnet

func GetServiceDomainName

func GetServiceDomainName(prefix string) (ret string)

GetServiceDomainName cat prefix and azure suffix

func IsRetryableAPIError

func IsRetryableAPIError(err error) bool

IsRetryableAPIError will judge whether an error retrable or not

func LogPodStatus

func LogPodStatus(cs clientset.Interface, ns string) error

LogPodStatus logs the rate of pending

func Logf

func Logf(format string, args ...interface{})

Logf prints info logs

func ValidateIPInCIDR

func ValidateIPInCIDR(ip, cidr string) (bool, error)

ValidateIPInCIDR validates whether certain ip fits CIDR

func WaitAutoScaleNodes

func WaitAutoScaleNodes(cs clientset.Interface, targetNodeCount int) error

WaitAutoScaleNodes returns nodes count after autoscaling in 30 minutes

func WaitServiceExposure

func WaitServiceExposure(cs clientset.Interface, namespace string, name string) (string, error)

WaitServiceExposure returns ip of ingress

Types

type AzureAuthConfig

type AzureAuthConfig struct {
	// The AAD Tenant ID for the Subscription that the cluster is deployed in
	TenantID string
	// The ClientID for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientID string
	// The ClientSecret for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientSecret string
	// The ID of the Azure Subscription that the cluster is deployed in
	SubscriptionID string
	// The Environment represents a set of endpoints for each of Azure's Clouds.
	Environment azure.Environment
}

AzureAuthConfig holds auth related part of cloud config Only consider servicePrinciple now

type AzureTestClient

type AzureTestClient struct {
	// contains filtered or unexported fields
}

AzureTestClient configs Azure specific clients

func CreateAzureTestClient

func CreateAzureTestClient() (*AzureTestClient, error)

CreateAzureTestClient makes a new AzureTestClient Only consider PublicCloud Environment

func (*AzureTestClient) CreateSecurityGroupsClient

func (tc *AzureTestClient) CreateSecurityGroupsClient() *aznetwork.SecurityGroupsClient

CreateSecurityGroupsClient generates security group client with the same baseclient as azure test client

func (*AzureTestClient) CreateSubnet

func (azureTestClient *AzureTestClient) CreateSubnet(vnet aznetwork.VirtualNetwork, subnetName *string, prefix *string) error

CreateSubnet will create a new subnet in certain virtual network

func (*AzureTestClient) DeleteSubnet

func (azureTestClient *AzureTestClient) DeleteSubnet(vnetName string, subnetName string) error

DeleteSubnet delete a subnet with retry

func (*AzureTestClient) GetClusterSecurityGroup

func (azureTestClient *AzureTestClient) GetClusterSecurityGroup() (ret *aznetwork.SecurityGroup, err error)

GetClusterSecurityGroup gets the only vnet of the cluster

func (*AzureTestClient) GetClusterVirtualNetwork

func (azureTestClient *AzureTestClient) GetClusterVirtualNetwork() (ret aznetwork.VirtualNetwork, err error)

GetClusterVirtualNetwork gets the only vnet of the cluster

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL