Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCRDInstalled(discoveryClient discovery.DiscoveryInterface, gvk schema.GroupVersionKind) error
- func GetEventString(object runtime.Object, eventtype, reason, messageFmt string, ...) string
- func GetObjectFromManifest(relativeFilePath string, obj runtime.Object) error
- func GetObjectFromRawExtension(rawByte []byte, obj runtime.Object) error
- func IsReservedNamespace(namespace string) bool
- func NewFakeRecorder(bufferSize int) *record.FakeRecorder
- func NewResourceList() v1.ResourceList
- func NewTestNodes(ns string) []v1.Node
- func RandSecureInt(limit int64) int64
- func RandStr() string
- func ShouldPropagateNamespace(namespace string, skippedNamespaces map[string]bool) bool
- func ShouldPropagateObj(informerManager informer.Manager, uObj *unstructured.Unstructured) (bool, error)
- type AlreadyExistMatcher
- type DisabledResourceConfig
- func (r *DisabledResourceConfig) DisableGroup(g string)
- func (r *DisabledResourceConfig) DisableGroupVersion(gv schema.GroupVersion)
- func (r *DisabledResourceConfig) DisableGroupVersionKind(gvk schema.GroupVersionKind)
- func (r *DisabledResourceConfig) IsResourceDisabled(gvk schema.GroupVersionKind) bool
- func (r *DisabledResourceConfig) Parse(c string) error
- type NotFoundMatcher
Constants ¶
const ( FleetSystemNamespace = fleetPrefix + "system" NamespaceNameFormat = fleetPrefix + "member-%s" RoleNameFormat = fleetPrefix + "role-%s" RoleBindingNameFormat = fleetPrefix + "rolebinding-%s" )
const ( PlacementFieldManagerName = "cluster-placement-controller" MCControllerFieldManagerName = "member-cluster-controller" )
const ( // LabelFleetObj is a label key indicate the resource is created by the fleet. LabelFleetObj = "kubernetes.azure.com/managed-by" LabelFleetObjValue = "fleet" // LabelWorkPlacementName is used to indicate which placement created the work. // This label aims to enable different work objects to be managed by different placement. LabelWorkPlacementName = "work.fleet.azure.com/placement-name" // MemberClusterFinalizer is used to make sure that we handle gc of all the member cluster resources on the hub cluster. MemberClusterFinalizer = "work.fleet.azure.com/membercluster-finalizer" // LastWorkUpdateTimeAnnotationKey is used to mark the last update time on a work object. LastWorkUpdateTimeAnnotationKey = "work.fleet.azure.com/last-update-time" )
const (
// NetworkingGroupName is the group name of the fleet networking.
NetworkingGroupName = "networking.fleet.azure.com"
)
const ( // TestCaseMsg is used in the table driven test TestCaseMsg string = "\nTest case: %s" )
Variables ¶
var ( FleetRule = rbacv1.PolicyRule{ Verbs: []string{"*"}, APIGroups: []string{fleetv1alpha1.GroupVersion.Group}, Resources: []string{"*"}, } EventRule = rbacv1.PolicyRule{ Verbs: []string{"get", "list", "update", "patch", "watch", "create"}, APIGroups: []string{""}, Resources: []string{"events"}, } WorkRule = rbacv1.PolicyRule{ Verbs: []string{"*"}, APIGroups: []string{workv1alpha1.GroupName}, Resources: []string{"*"}, } FleetNetworkRule = rbacv1.PolicyRule{ Verbs: []string{"*"}, APIGroups: []string{NetworkingGroupName}, Resources: []string{"*"}, } )
var ( ClusterResourcePlacementGVR = schema.GroupVersionResource{ Group: fleetv1alpha1.GroupVersion.Group, Version: fleetv1alpha1.GroupVersion.Version, Resource: fleetv1alpha1.ClusterResourcePlacementResource, } ClusterResourcePlacementGVK = schema.GroupVersionKind{ Group: fleetv1alpha1.GroupVersion.Group, Version: fleetv1alpha1.GroupVersion.Version, Kind: "ClusterResourcePlacement", } NamespaceGVK = schema.GroupVersionKind{ Group: corev1.GroupName, Version: corev1.SchemeGroupVersion.Version, Kind: "Namespace", } NamespaceGVR = schema.GroupVersionResource{ Group: corev1.GroupName, Version: corev1.SchemeGroupVersion.Version, Resource: "namespaces", } MemberClusterGVR = schema.GroupVersionResource{ Group: fleetv1alpha1.GroupVersion.Group, Version: fleetv1alpha1.GroupVersion.Version, Resource: fleetv1alpha1.MemberClusterResource, } MemberClusterGVK = schema.GroupVersionKind{ Group: fleetv1alpha1.GroupVersion.Group, Version: fleetv1alpha1.GroupVersion.Version, Kind: fleetv1alpha1.MemberClusterKind, } WorkGVK = schema.GroupVersionKind{ Group: workv1alpha1.GroupVersion.Group, Version: workv1alpha1.GroupVersion.Version, Kind: workv1alpha1.WorkKind, } WorkGVR = schema.GroupVersionResource{ Group: workv1alpha1.GroupVersion.Group, Version: workv1alpha1.GroupVersion.Version, Resource: workv1alpha1.WorkResource, } ServiceGVR = schema.GroupVersionResource{ Group: corev1.GroupName, Version: corev1.SchemeGroupVersion.Version, Resource: "services", } )
Those are the GVR/GVK of the fleet related resources.
Functions ¶
func CheckCRDInstalled ¶
func CheckCRDInstalled(discoveryClient discovery.DiscoveryInterface, gvk schema.GroupVersionKind) error
CheckCRDInstalled checks if the custom resource definition is installed
func GetEventString ¶
func GetEventString(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{}) string
GetEventString get the exact string literal of the event created by the fake event library.
func GetObjectFromManifest ¶ added in v0.6.4
GetObjectFromManifest returns a runtime object decoded from the file.
func GetObjectFromRawExtension ¶ added in v0.6.4
GetObjectFromRawExtension returns an object decoded from the raw byte array.
func IsReservedNamespace ¶ added in v0.6.3
IsReservedNamespace indicates if an argued namespace is reserved.
func NewFakeRecorder ¶
func NewFakeRecorder(bufferSize int) *record.FakeRecorder
NewFakeRecorder makes a new fake event recorder that prints the object.
func NewResourceList ¶
func NewResourceList() v1.ResourceList
NewResourceList returns a resource list for test purpose.
func NewTestNodes ¶
NewTestNodes return a set of nodes for test purpose. Those nodes have random names and capacities/ allocatable.
func RandSecureInt ¶
RandSecureInt returns a uniform random value in [1, max] or panic. Only use this in tests.
func ShouldPropagateNamespace ¶ added in v0.5.5
ShouldPropagateNamespace decides if we should propagate the resources in the namespace.
func ShouldPropagateObj ¶ added in v0.3.0
func ShouldPropagateObj(informerManager informer.Manager, uObj *unstructured.Unstructured) (bool, error)
ShouldPropagateObj decides if one should propagate the object
Types ¶
type AlreadyExistMatcher ¶ added in v0.5.5
type AlreadyExistMatcher struct { }
AlreadyExistMatcher matches the error to be already exist
func (AlreadyExistMatcher) FailureMessage ¶ added in v0.5.5
func (matcher AlreadyExistMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage builds an error message.
func (AlreadyExistMatcher) Match ¶ added in v0.5.5
func (matcher AlreadyExistMatcher) Match(actual interface{}) (success bool, err error)
Match matches error.
func (AlreadyExistMatcher) NegatedFailureMessage ¶ added in v0.5.5
func (matcher AlreadyExistMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage builds an error message.
type DisabledResourceConfig ¶
type DisabledResourceConfig struct {
// contains filtered or unexported fields
}
DisabledResourceConfig represents the configuration that identifies the API resources should not be selected.
func NewDisabledResourceConfig ¶
func NewDisabledResourceConfig() *DisabledResourceConfig
NewDisabledResourceConfig to create DisabledResourceConfig
func (*DisabledResourceConfig) DisableGroup ¶
func (r *DisabledResourceConfig) DisableGroup(g string)
DisableGroup to disable group.
func (*DisabledResourceConfig) DisableGroupVersion ¶
func (r *DisabledResourceConfig) DisableGroupVersion(gv schema.GroupVersion)
DisableGroupVersion to disable group version.
func (*DisabledResourceConfig) DisableGroupVersionKind ¶
func (r *DisabledResourceConfig) DisableGroupVersionKind(gvk schema.GroupVersionKind)
DisableGroupVersionKind to disable GroupVersionKind.
func (*DisabledResourceConfig) IsResourceDisabled ¶
func (r *DisabledResourceConfig) IsResourceDisabled(gvk schema.GroupVersionKind) bool
IsResourceDisabled returns whether a given GroupVersionKind is disabled. a gkv is disabled if its group or group version is disabled
func (*DisabledResourceConfig) Parse ¶
func (r *DisabledResourceConfig) Parse(c string) error
Parse parses the --avoid-selecting-apis input.
type NotFoundMatcher ¶
type NotFoundMatcher struct { }
NotFoundMatcher matches the error to be not found.
func (NotFoundMatcher) FailureMessage ¶
func (matcher NotFoundMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage builds an error message.
func (NotFoundMatcher) Match ¶
func (matcher NotFoundMatcher) Match(actual interface{}) (success bool, err error)
Match matches the api error.
func (NotFoundMatcher) NegatedFailureMessage ¶
func (matcher NotFoundMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage builds an error message.
Directories ¶
Path | Synopsis |
---|---|
Package annotations provides the utils related to object annotations.
|
Package annotations provides the utils related to object annotations. |
Package condition provides condition related utils.
|
Package condition provides condition related utils. |
Package labels provides utils related to object labels.
|
Package labels provides utils related to object labels. |