Documentation ¶
Index ¶
- Variables
- func AddNamespaceLabel(ctx context.Context, nm, k, v string)
- func AddToHNCConfig(ctx context.Context, group, resource string, mode api.SynchronizationMode)
- func CanGetHierarchy(ctx context.Context, nm string) func() bool
- func CleanupObjects(ctx context.Context)
- func CreateNS(ctx context.Context, prefix string) string
- func CreateNSName(prefix string) string
- func CreateNSWithLabel(ctx context.Context, prefix string, label map[string]string) string
- func CreateNSWithLabelAnnotation(ctx context.Context, prefix string, l map[string]string, a map[string]string) string
- func CreateNSes(ctx context.Context, num int) []string
- func DeleteObject(ctx context.Context, resource string, nsName, name string)
- func GetAnnotation(ctx context.Context, from, key string) func() string
- func GetHNCConfig(ctx context.Context) (*api.HNCConfiguration, error)
- func GetHNCConfigWithName(ctx context.Context, nm string) (*api.HNCConfiguration, error)
- func GetHierarchy(ctx context.Context, nm string) *api.HierarchyConfiguration
- func GetLabel(ctx context.Context, from, label string) func() string
- func GetNamespace(ctx context.Context, nm string) *corev1.Namespace
- func GetNamespaceWithOffset(offset int, ctx context.Context, nm string) *corev1.Namespace
- func GetObject(ctx context.Context, resource string, nsName, name string) (*unstructured.Unstructured, error)
- func HNCAfterSuite()
- func HNCBeforeSuite()
- func HNCRun(t *testing.T, title string)
- func HasChild(ctx context.Context, nm, cnm string) func() bool
- func HasCondition(ctx context.Context, nm string, tp, reason string) func() bool
- func HasObject(ctx context.Context, resource string, nsName, name string) func() bool
- func MakeObject(ctx context.Context, resource string, nsName, name string)
- func MakeObjectWithAnnotations(ctx context.Context, resource string, nsName, name string, a map[string]string)
- func MakeObjectWithLabels(ctx context.Context, resource string, nsName, name string, l map[string]string)
- func MakeSecrettWithType(ctx context.Context, nsName, name, scType string)
- func NewHierarchy(nm string) *api.HierarchyConfiguration
- func NewOrGetHierarchy(ctx context.Context, nm string) *api.HierarchyConfiguration
- func ObjectInheritedFrom(ctx context.Context, resource string, nsName, name string) string
- func RemoveNamespaceLabel(ctx context.Context, nm, k string)
- func ReplaceStrings(str string, table map[string]string) string
- func ResetHNCConfigToDefault(ctx context.Context)
- func SetParent(ctx context.Context, nm, pnm string)
- func TestCheckHRQDrift() bool
- func TryUpdateHierarchy(ctx context.Context, h *api.HierarchyConfiguration) error
- func UpdateHNCConfig(ctx context.Context, c *api.HNCConfiguration) error
- func UpdateHierarchy(ctx context.Context, h *api.HierarchyConfiguration)
- func UpdateNamespace(ctx context.Context, ns *corev1.Namespace)
- func UpdateObjectWithAnnotations(ctx context.Context, resource, nsName, name string, a map[string]string)
Constants ¶
This section is empty.
Variables ¶
var ( K8sClient client.Client TestForest *forest.Forest )
var GVKs = map[string]schema.GroupVersionKind{ "secrets": {Group: "", Version: "v1", Kind: "Secret"}, api.RoleResource: {Group: api.RBACGroup, Version: "v1", Kind: api.RoleKind}, api.RoleBindingResource: {Group: api.RBACGroup, Version: "v1", Kind: api.RoleBindingKind}, "networkpolicies": {Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}, "resourcequotas": {Group: "", Version: "v1", Kind: "ResourceQuota"}, "limitranges": {Group: "", Version: "v1", Kind: "LimitRange"}, "configmaps": {Group: "", Version: "v1", Kind: "ConfigMap"}, "crontabs": {Group: "stable.example.com", Version: "v1", Kind: "CronTab"}, "subnamespaceanchors": {Group: "hnc.x-k8s.io", Version: "v1alpha2", Kind: "SubnamespaceAnchor"}, }
GVKs maps a resource to its corresponding GVK.
Functions ¶
func AddNamespaceLabel ¶
func AddToHNCConfig ¶
func AddToHNCConfig(ctx context.Context, group, resource string, mode api.SynchronizationMode)
func CleanupObjects ¶
CleanupObjects makes a best attempt to cleanup all objects created from MakeObject.
func CreateNS ¶
CreateNS is a convenience function to create a namespace and wait for its singleton to be created. It's used in other tests in this package, but basically duplicates the code in this test (it didn't originally). TODO: refactor.
func CreateNSName ¶
CreateNSName generates random namespace names. Namespaces are never deleted in test-env because the building Namespace controller (which finalizes namespaces) doesn't run; I searched Github and found that everyone who was deleting namespaces was *also* very intentionally generating random names, so I guess this problem is widespread.
func CreateNSWithLabel ¶
CreateNSWithLabel has similar function to CreateNS with label as additional parameter
func CreateNSWithLabelAnnotation ¶
func CreateNSWithLabelAnnotation(ctx context.Context, prefix string, l map[string]string, a map[string]string) string
CreateNSWithLabelAnnotation has similar function to CreateNS with label and annotation as additional parameters.
func CreateNSes ¶
Namespaces are named "a-<rand>", "b-<rand>", etc
func DeleteObject ¶
DeleteObject deletes an object of the given kind in a specific namespace. The kind and its corresponding GVK should be included in the GVKs map.
func GetAnnotation ¶ added in v1.0.0
func GetHNCConfig ¶
func GetHNCConfig(ctx context.Context) (*api.HNCConfiguration, error)
func GetHNCConfigWithName ¶
func GetHierarchy ¶
func GetHierarchy(ctx context.Context, nm string) *api.HierarchyConfiguration
func GetNamespaceWithOffset ¶
func GetObject ¶
func GetObject(ctx context.Context, resource string, nsName, name string) (*unstructured.Unstructured, error)
func HNCAfterSuite ¶
func HNCAfterSuite()
func HNCBeforeSuite ¶
func HNCBeforeSuite()
All tests in the reconcilers_test package are in one suite. As a result, they share the same test environment (e.g., same api server).
func HasCondition ¶
func HasObject ¶
HasObject returns true if a namespace contains a specific object of the given kind.
The kind and its corresponding GVK should be included in the GVKs map.
func MakeObject ¶
MakeObject creates an empty object of the given kind in a specific namespace. The kind and its corresponding GVK should be included in the GVKs map.
func MakeObjectWithAnnotations ¶ added in v1.0.0
func MakeObjectWithAnnotations(ctx context.Context, resource string, nsName, name string, a map[string]string)
MakeObjectWithAnnotations creates an empty object with annotation given kind in a specific namespace. The kind and its corresponding GVK should be included in the GVKs map.
func MakeObjectWithLabels ¶ added in v1.0.0
func MakeObjectWithLabels(ctx context.Context, resource string, nsName, name string, l map[string]string)
MakeObjectWithLabels creates an empty object with label given kind in a specific namespace. The kind and its corresponding GVK should be included in the GVKs map.
func MakeSecrettWithType ¶ added in v1.1.0
MakeSecrettWithType creates an empty Secret with type given kind in a specific namespace.
func NewHierarchy ¶
func NewHierarchy(nm string) *api.HierarchyConfiguration
func NewOrGetHierarchy ¶
func NewOrGetHierarchy(ctx context.Context, nm string) *api.HierarchyConfiguration
func ObjectInheritedFrom ¶
ObjectInheritedFrom returns the name of the namespace where a specific object of a given kind is propagated from or an empty string if the object is not a propagated object. The kind and its corresponding GVK should be included in the GVKs map.
func RemoveNamespaceLabel ¶
func ReplaceStrings ¶
ReplaceStrings returns a copy of str with all non-overlapping instances of the keys in table replaced by values in table
func ResetHNCConfigToDefault ¶
func TestCheckHRQDrift ¶ added in v1.1.0
func TestCheckHRQDrift() bool
func TryUpdateHierarchy ¶
func TryUpdateHierarchy(ctx context.Context, h *api.HierarchyConfiguration) error
func UpdateHNCConfig ¶
func UpdateHNCConfig(ctx context.Context, c *api.HNCConfiguration) error
func UpdateHierarchy ¶
func UpdateHierarchy(ctx context.Context, h *api.HierarchyConfiguration)
Types ¶
This section is empty.