Documentation
¶
Index ¶
- Constants
- func ChangedDNSProvider(currentDNS, desiredDNS *pb.DNS) bool
- func CloseClientConnection(connection *grpc.ClientConn)
- func ConcurrentExec[K any](items []K, f func(index int, item K) error) error
- func Contains[K comparable](item K, items []K, cmp func(item K, other K) bool) bool
- func CreateDirectory(dir string) error
- func CreateHash(length int) string
- func CreateKeyFile(key string, outputPath string, keyName string) error
- func CreateLoggerWithClusterName(clusterName string) zerolog.Logger
- func CreateLoggerWithProjectAndClusterName(projectName, clusterName string) zerolog.Logger
- func CreateLoggerWithProjectName(projectName string) zerolog.Logger
- func FindAPIEndpointNode(nodepools []*pb.NodePool) (*pb.Node, error)
- func FindControlNode(nodepools []*pb.NodePool) (*pb.Node, error)
- func FindEndpointNode(np *pb.NodePool) (*pb.Node, error)
- func FindLbAPIEndpoint(lbs []*pb.LBcluster) bool
- func FindName(realNames []string, name string) string
- func FindNodepoolWithApiEndpointNode(nodepools []*pb.NodePool) (*pb.NodePool, *pb.Node, error)
- func GetClusterByName(clusterName string, clusters []*pb.K8Scluster) int
- func GetClusterID(clusterInfo *pb.ClusterInfo) string
- func GetCommonDynamicNodePools(nps []*pb.NodePool) []*pb.NodePool
- func GetCommonStaticNodePools(nps []*pb.NodePool) []*pb.NodePool
- func GetDynamicNodePools(nps []*pb.NodePool) []*pb.DynamicNodePool
- func GetDynamicNodePoolsFromCI(ci *pb.ClusterInfo) []*pb.DynamicNodePool
- func GetEnvDefault(envKey string, defaultVal string) string
- func GetLBClusterByName(name string, clusters []*pb.LBcluster) int
- func GetNodePoolByName(nodePoolName string, nodePools []*pb.NodePool) *pb.NodePool
- func GetRegions(nodepools []*pb.DynamicNodePool) []string
- func GetStaticNodePools(nps []*pb.NodePool) []*pb.StaticNodePool
- func GroupNodepoolsByProvider(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
- func GroupNodepoolsByProviderNames(clusterInfo *pb.ClusterInfo) map[ProviderNames][]*pb.NodePool
- func GroupNodepoolsByProviderRegion(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
- func GroupNodepoolsByProviderSpecName(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
- func GrpcDialWithInsecure(serviceName string, serviceURL string) (*grpc.ClientConn, error)
- func HasAPIServerRole(roles []*pb.Role) bool
- func InitLog(moduleName string)
- func IsAutoscaled(cluster *pb.K8Scluster) bool
- func SanitiseKubeconfig(s string) string
- func SanitiseURI(s string) string
- type ProviderNames
Constants ¶
const HashLength = 7
Variables ¶
This section is empty.
Functions ¶
func ChangedDNSProvider ¶
func CloseClientConnection ¶
func CloseClientConnection(connection *grpc.ClientConn)
CloseClientConnection is a wrapper around grpc.ClientConn Close function
func Contains ¶ added in v0.3.1
func Contains[K comparable](item K, items []K, cmp func(item K, other K) bool) bool
Contains checks if item is present in the list of items.
func CreateDirectory ¶
func CreateHash ¶
func CreateKeyFile ¶
CreateKeyFile writes the given key to a file. The key filename is specified by its outputPath and KeyName operands.
func CreateLoggerWithClusterName ¶ added in v0.3.1
CreateLoggerWithClusterName creates a new logger aware of the cluster-name. Returns the new logger
func CreateLoggerWithProjectAndClusterName ¶ added in v0.3.1
CreateLoggerWithProjectAndClusterName creates a new logger aware of the project-name and cluster-name. Returns the new logger
func CreateLoggerWithProjectName ¶ added in v0.3.1
CreateLoggerWithProjectName creates a new logger aware of the project-name. Returns the new logger
func FindAPIEndpointNode ¶ added in v0.3.1
FindAPIEndpointNode searches the NodePools for a Node with type ApiEndpoint.
func FindControlNode ¶ added in v0.3.1
FindControlNode search the nodepools for a node with type Master.
func FindEndpointNode ¶ added in v0.3.1
FindEndpointNode searches the nodes of the nodepool for a node with type ApiEndpoint.
func FindLbAPIEndpoint ¶ added in v0.3.1
FindLbAPIEndpoint searches for a role with ApiEndpoint among the LBcluster.
func FindName ¶
FindName will return a real node name based on the user defined one example: name defined in cloud provider: gcp-cluster-jkshbdc-gcp-control-1 -> name defined in cluster : gcp-control-1
func FindNodepoolWithApiEndpointNode ¶ added in v0.4.0
FindNodepoolWithApiEndpointNode searches for a nodepool that has the control node representing the Api endpoint of the cluster. Returns the control node if found and its corresponding nodepool.
func GetClusterByName ¶
func GetClusterByName(clusterName string, clusters []*pb.K8Scluster) int
GetClusterByName will return index of Cluster that will have same name as specified in parameters If no name is found, return -1
func GetClusterID ¶ added in v0.3.1
func GetClusterID(clusterInfo *pb.ClusterInfo) string
func GetCommonDynamicNodePools ¶ added in v0.4.0
GetCommonDynamicNodePools returns slice of common node pools, where every node pool is dynamic.
func GetCommonStaticNodePools ¶ added in v0.4.0
GetCommonStaticNodePools returns slice of common node pools, where every node pool is static.
func GetDynamicNodePools ¶ added in v0.4.0
func GetDynamicNodePools(nps []*pb.NodePool) []*pb.DynamicNodePool
GetDynamicNodePools returns slice of dynamic node pools.
func GetDynamicNodePoolsFromCI ¶ added in v0.4.0
func GetDynamicNodePoolsFromCI(ci *pb.ClusterInfo) []*pb.DynamicNodePool
GetDynamicNodePoolsFromCI returns slice of dynamic node pools used in specified cluster info.
func GetEnvDefault ¶ added in v0.4.0
GetEnvDefault take a string representing environment variable as an argument, and a default value If the environment variable is not defined, it returns the provided default value.
func GetLBClusterByName ¶ added in v0.4.0
GetLBClusterByName will return index of Cluster that will have same name as specified in parameters If no name is found, return -1
func GetNodePoolByName ¶
GetNodePoolByName will return first Nodepool that will have same name as specified in parameters If no name is found, return nil
func GetRegions ¶
func GetRegions(nodepools []*pb.DynamicNodePool) []string
GetRegions will return a list of all regions used in list of nodepools
func GetStaticNodePools ¶ added in v0.4.0
func GetStaticNodePools(nps []*pb.NodePool) []*pb.StaticNodePool
GetStaticNodePools returns slice of dynamic node pools.
func GroupNodepoolsByProvider ¶
func GroupNodepoolsByProvider(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
GroupNodepoolsByProvider groups nodepool by cloud provider name into the map[Provider Name][]*pb.Nodepool
func GroupNodepoolsByProviderNames ¶ added in v0.4.0
func GroupNodepoolsByProviderNames(clusterInfo *pb.ClusterInfo) map[ProviderNames][]*pb.NodePool
GroupNodepoolsByProviderNames groups nodepool by provider spec name into the map[Provider Names][]*pb.Nodepool
func GroupNodepoolsByProviderRegion ¶ added in v0.2.2
func GroupNodepoolsByProviderRegion(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
GroupNodepoolsByProviderRegion groups nodepool by cloud provider instance name and region into the map[<provider-instance-name>-<region>][]*pb.Nodepool
func GroupNodepoolsByProviderSpecName ¶
func GroupNodepoolsByProviderSpecName(clusterInfo *pb.ClusterInfo) map[string][]*pb.NodePool
GroupNodepoolsByProviderSpecName groups nodepool by provider spec name into the map[Provider Name][]*pb.Nodepool
func GrpcDialWithInsecure ¶
func GrpcDialWithInsecure(serviceName string, serviceURL string) (*grpc.ClientConn, error)
func HasAPIServerRole ¶ added in v0.3.1
HasAPIServerRole checks if there is an API server role.
func InitLog ¶
func InitLog(moduleName string)
Initialize the logging framework. Inputs are the golang module name used as a logging prefix and the env variable with the logging level
func IsAutoscaled ¶ added in v0.2.2
func IsAutoscaled(cluster *pb.K8Scluster) bool
IsAutoscaled returns true, if cluster has at least one nodepool with autoscaler config.
func SanitiseKubeconfig ¶
SanitiseKubeconfig replaces the entire kubeconfig found after the '--kubeconfig' flag with '*****'. This has been decided to be the superior option when compared to matching sensitive fields and obscuring just those.
func SanitiseURI ¶
SanitiseURI replaces passwords with '*****' in connection strings that are in the form of <scheme>://<username>:<password>@<domain>.<tld> or <scheme>://<username>:<password>@<pqdn>.
Types ¶
type ProviderNames ¶ added in v0.4.0
ProviderNames struct hold pair of cloud provider name and user defined name from manifest.