Documentation ¶
Index ¶
- Constants
- func CreateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp) *cappv1alpha1.Capp
- func CreateConfigMap(k8sClient client.Client, configmap *corev1.ConfigMap) *corev1.ConfigMap
- func CreateExcludedServiceAccount(k8sClient client.Client)
- func CreateRole(k8sClient client.Client, role *rbacv1.Role) *rbacv1.Role
- func CreateRoleBinding(k8sClient client.Client, roleBinding *rbacv1.RoleBinding) *rbacv1.RoleBinding
- func CreateSecret(k8sClient client.Client, secret *corev1.Secret) *corev1.Secret
- func CreateServiceAccount(k8sClient client.Client, serviceAccount *corev1.ServiceAccount) *corev1.ServiceAccount
- func CreateTestUser(k8sClient client.Client, namespace string)
- func DeleteCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)
- func DeleteExcludedServiceAccount(k8sClient client.Client)
- func DeleteTestUser(k8sClient client.Client, namespace string)
- func DoesFinalizerExist(k8sClient client.Client, cappName string, cappNamespace string, ...) bool
- func DoesResourceExist(k8sClient client.Client, obj client.Object) bool
- func GenerateUniqueCappName(baseCappName string) string
- func GenerateUniqueName(baseSecretName string) string
- func GetAddOnPlacementScore(k8sClient client.Client, name string, namespace string) *clusterv1alpha1.AddOnPlacementScore
- func GetCapp(k8sClient client.Client, name string, namespace string) *cappv1alpha1.Capp
- func GetCappFromManifestWork(manifestWork workv1.ManifestWork) unstructured.Unstructured
- func GetCappWithPlacementAnnotation(k8sClient client.Client, name, namespace string) *cappv1alpha1.Capp
- func IsObjInManifestWork(k8sClient client.Client, manifestWork workv1.ManifestWork, objName string, ...) (bool, error)
- func IsRbacObjInManifestWork(manifestWork workv1.ManifestWork, cappName string, nsName string, kind string) bool
- func IsSiteInPlacement(k8sClient client.Client, placementName string, placementNamespace string) (bool, error)
- func SwitchUser(k8sClient *client.Client, cfg *rest.Config, namespace string, ...)
- func UpdateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)
Constants ¶
const ( RandStrLength = 10 TimeoutCapp = 60 * time.Second CappCreationInterval = 2 * time.Second )
const ( ServiceAccountNameFormat = "system:serviceaccount:%s:%s" ServiceAccountName = "test-user" ExcludedServiceAccountName = "excluded-sa" )
const RbacObjectSuffix = "-logs-reader"
Variables ¶
This section is empty.
Functions ¶
func CreateCapp ¶
func CreateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp) *cappv1alpha1.Capp
CreateCapp creates a new Capp instance with a unique name and returns it.
func CreateConfigMap ¶ added in v0.2.0
CreateConfigMap creates a corev1.configMap object with a random suffix in its name and returns it
func CreateExcludedServiceAccount ¶ added in v0.3.3
CreateExcludedServiceAccount configures a service account that should be excluded from the mutating webhook.
func CreateRole ¶
CreateRole creates a rbac1.Role object and returns it.
func CreateRoleBinding ¶
func CreateRoleBinding(k8sClient client.Client, roleBinding *rbacv1.RoleBinding) *rbacv1.RoleBinding
CreateRoleBinding creates a rbacv1.RoleBinding and returns it.
func CreateSecret ¶
CreateSecret creates a corev1.secret object with a random suffix in its name and returns it.
func CreateServiceAccount ¶ added in v0.3.3
func CreateServiceAccount(k8sClient client.Client, serviceAccount *corev1.ServiceAccount) *corev1.ServiceAccount
CreateServiceAccount creates a corev1.ServiceAccount and returns it.
func CreateTestUser ¶ added in v0.2.0
CreateTestUser creates a test user with the specified Kubernetes client and namespace.
func DeleteCapp ¶
func DeleteCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)
DeleteCapp deletes an existing Capp instance.
func DeleteExcludedServiceAccount ¶ added in v0.3.3
DeleteExcludedServiceAccount deletes the excluded user created in the specified namespace.
func DeleteTestUser ¶ added in v0.2.0
DeleteTestUser deletes the test user created in the specified namespace.
func DoesFinalizerExist ¶
func DoesFinalizerExist(k8sClient client.Client, cappName string, cappNamespace string, finalizerName string) bool
DoesFinalizerExist checks if a finalizer exists on a Capp.
func DoesResourceExist ¶
DoesResourceExist checks if a given Kubernetes object exists in the cluster.
func GenerateUniqueCappName ¶ added in v0.1.6
GenerateUniqueCappName generates a unique Capp name.
func GenerateUniqueName ¶ added in v0.2.0
GenerateUniqueName generates a unique name.
func GetAddOnPlacementScore ¶ added in v0.1.4
func GetAddOnPlacementScore(k8sClient client.Client, name string, namespace string) *clusterv1alpha1.AddOnPlacementScore
GetAddOnPlacementScore fetches an existing GetAddOnPlacementScore and returns its instance.
func GetCappFromManifestWork ¶
func GetCappFromManifestWork(manifestWork workv1.ManifestWork) unstructured.Unstructured
GetCappFromManifestWork returns a Capp from its corresponding ManifestWork.
func GetCappWithPlacementAnnotation ¶ added in v0.2.0
func GetCappWithPlacementAnnotation(k8sClient client.Client, name, namespace string) *cappv1alpha1.Capp
GetCappWithPlacementAnnotation checks whether a Capp eventually has a placement annotation. If it exists then it returns an up-to-date Capp which contains the annotation.
func IsObjInManifestWork ¶
func IsObjInManifestWork(k8sClient client.Client, manifestWork workv1.ManifestWork, objName string, objNamespace string, object client.Object, kind string) (bool, error)
IsObjInManifestWork checks if a given object is in the ManifestWork's manifests list.
func IsRbacObjInManifestWork ¶
func IsRbacObjInManifestWork(manifestWork workv1.ManifestWork, cappName string, nsName string, kind string) bool
IsRbacObjInManifestWork checks if a given role/rolebinding object is in the ManifestWork's manifests list.
func IsSiteInPlacement ¶
func IsSiteInPlacement(k8sClient client.Client, placementName string, placementNamespace string) (bool, error)
IsSiteInPlacement checks if a given site is part of a clusterset mentioned in a placement.
func SwitchUser ¶ added in v0.2.0
func SwitchUser(k8sClient *client.Client, cfg *rest.Config, namespace string, scheme *runtime.Scheme, serviceAccountName string)
SwitchUser switches the Kubernetes client's user context to the given serviceAccountName if it's not empty. If serviceAccountName is empty, it reverts to the original context.
func UpdateCapp ¶
func UpdateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)
UpdateCapp updates the provided Capp instance in the Kubernetes cluster, and returns it.
Types ¶
This section is empty.