Documentation ¶
Index ¶
- func AddLabel(labels map[string]string, labelKey, labelValue string) map[string]string
- func AddOwnersLabel(owners, resource, name, namespace string) string
- func ApplyClusterRole(kubeClient kubernetes.Interface, clusterRoleName string, ...) error
- func ApplyClusterRoleBinding(ctx context.Context, client client.Client, required *rbacv1.ClusterRoleBinding) error
- func BuildClusterRoleName(objName, rule string) string
- func BuildKubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
- func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string
- func ContainsString(slice []string, s string) bool
- func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
- func DeleteClusterRole(kubeClient kubernetes.Interface, clusterRoleName string) error
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func EqualSubjects(subjects1, subjects2 []rbacv1.Subject) bool
- func FormatQuatityToGi(q resource.Quantity) resource.Quantity
- func FormatQuatityToMi(q resource.Quantity) resource.Quantity
- func GenerateClusterRoleBindingName(clusterName string) string
- func GenerateClusterRoleName(clusterName, role string) string
- func GenerateClustersetClusterroleName(clustersetName, role string) string
- func GeneratePemFile(dir, certFile, keyFile string) (string, error)
- func GetCPUAndMemoryAllocation(pods []*corev1.Pod) (cpuAllocation, memoryAllocation resource.Quantity)
- func GetCPUAndMemoryCapacity(nodes []*corev1.Node) (cpuCapacity, memoryCapacity resource.Quantity)
- func GetClustersetInRules(rules []rbacv1.PolicyRule) sets.String
- func GetComponentNamespace() (string, error)
- func GetStorageCapacityAndAllocation(pvs []*corev1.PersistentVolume) (storageCapacity, storageAllocation resource.Quantity)
- func MatchLabelForLabelSelector(targetLabels map[string]string, labelSelector *metav1.LabelSelector) bool
- func MergeMap(modified *bool, existing map[string]string, required map[string]string)
- func Mergesubjects(subjects []rbacv1.Subject, cursubjects []rbacv1.Subject) []rbacv1.Subject
- func NewMultiLineAggregate(errList []error) error
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSignedCert(cfg cert.Config, key crypto.Signer, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func PodRequestsAndLimits(pod *corev1.Pod) (reqs map[corev1.ResourceName]resource.Quantity, ...)
- func RemoveString(slice []string, s string) (result []string)
- func StringToMap(str string) map[string]string
- func WriteKeyCertToFile(certDir string, key, cert []byte) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOwnersLabel ¶
func ApplyClusterRole ¶
func ApplyClusterRole(kubeClient kubernetes.Interface, clusterRoleName string, rules []rbacv1.PolicyRule) error
apply cluster role
func ApplyClusterRoleBinding ¶
func ApplyClusterRoleBinding(ctx context.Context, client client.Client, required *rbacv1.ClusterRoleBinding) error
ApplyClusterRoleBinding merges objectmeta, requires subjects and role refs
func BuildClusterRoleName ¶
func BuildKubeClient ¶
func BuildKubeClient(kubeConfigPath string) (*kubernetes.Clientset, error)
func CloneAndAddLabel ¶
CloneAndAddLabel the given map and returns a new map with the given key and value added. Returns the given map, if labelKey is empty.
func ContainsString ¶
ContainsString to check string from a slice of strings.
func ConvertLabels ¶
func ConvertLabels(labelSelector *metav1.LabelSelector) (labels.Selector, error)
ConvertLabels returns label
func DeleteClusterRole ¶
func DeleteClusterRole(kubeClient kubernetes.Interface, clusterRoleName string) error
Delete cluster role
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-endcoded certificate data
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM returns PEM-encoded private key data
func EqualSubjects ¶
func GenerateClusterRoleBindingName ¶
clusterset clusterrolebinding
func GenerateClusterRoleName ¶
managedcluster admin role
func GeneratePemFile ¶
GeneratePemFile generate a pem file that include key and cert
func GetCPUAndMemoryCapacity ¶
func GetClustersetInRules ¶
func GetClustersetInRules(rules []rbacv1.PolicyRule) sets.String
func GetComponentNamespace ¶
func GetStorageCapacityAndAllocation ¶
func GetStorageCapacityAndAllocation(pvs []*corev1.PersistentVolume) (storageCapacity, storageAllocation resource.Quantity)
func MatchLabelForLabelSelector ¶
func MatchLabelForLabelSelector(targetLabels map[string]string, labelSelector *metav1.LabelSelector) bool
MatchLabelForLabelSelector match labels for labelselector, if labelSelecor is nil, select everything
func Mergesubjects ¶
func NewMultiLineAggregate ¶
NewMultiLineAggregate returns an aggregate error with multi-line output
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key
func NewSignedCert ¶
func NewSignedCert(cfg cert.Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)
NewSignedCert creates a signed certificate using the given CA certificate and key
func PodRequestsAndLimits ¶
func PodRequestsAndLimits( pod *corev1.Pod) (reqs map[corev1.ResourceName]resource.Quantity, limits map[corev1.ResourceName]resource.Quantity)
PodRequestsAndLimits returns a dictionary of all defined resources summed up for all containers of the pod.
func RemoveString ¶
ContainsString to remove string from a slice of strings.
Types ¶
This section is empty.