Documentation ¶
Index ¶
- Constants
- Variables
- func AcceptManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) error
- func AcceptManagedClusterWithLeaseDuration(clusterClient clusterclientset.Interface, spokeClusterName string, ...) error
- func AppliedManifestWorkName(sourceDriver, hubHash string, work *workapiv1.ManifestWork) string
- func AssertAppliedManifestWorkDeleted(name string, workClient workclientset.Interface, ...)
- func AssertAppliedResources(appliedManifestWorkName string, gvrs []schema.GroupVersionResource, ...)
- func AssertClusterManagerCondition(name string, operatorClient operatorclientset.Interface, ...)
- func AssertExistenceOfConfigMaps(manifests []workapiv1.Manifest, kubeClient kubernetes.Interface, ...)
- func AssertExistenceOfResources(gvrs []schema.GroupVersionResource, namespaces, names []string, ...)
- func AssertFinalizerAdded(namespace, name, expectedFinalizer string, workClient workclientset.Interface, ...)
- func AssertKlusterletCondition(name string, operatorClient operatorclientset.Interface, ...)
- func AssertNonexistenceOfConfigMaps(manifests []workapiv1.Manifest, kubeClient kubernetes.Interface, ...)
- func AssertNonexistenceOfResources(gvrs []schema.GroupVersionResource, namespaces, names []string, ...)
- func AssertWorkCondition(namespace, name string, workClient workclientset.Interface, ...)
- func AssertWorkDeleted(namespace, name, appliedManifestWorkName string, ...)
- func AssertWorkGeneration(namespace, name string, workClient workclientset.Interface, ...)
- func CmpResourceQuantity(key string, nodeResourceList corev1.ResourceList, ...) bool
- func CordonNode(kubeClient kubernetes.Interface, name string) error
- func CreateKubeconfigFile(clientConfig *rest.Config, filename string) error
- func CreateMQTTConfigFile(configFileName, sourceID string) error
- func CreateNode(kubeClient kubernetes.Interface, name string, ...) error
- func FindAddOnCSRs(kubeClient kubernetes.Interface, spokeClusterName, addOnName string) ([]*certificates.CertificateSigningRequest, error)
- func FindAutoApprovedSpokeCSR(kubeClient kubernetes.Interface, spokeClusterName string) (*certificates.CertificateSigningRequest, error)
- func FindUnapprovedAddOnCSR(kubeClient kubernetes.Interface, spokeClusterName, addOnName string) (*certificates.CertificateSigningRequest, error)
- func FindUnapprovedSpokeCSR(kubeClient kubernetes.Interface, spokeClusterName string) (*certificates.CertificateSigningRequest, error)
- func GetBootstrapKubeConfigData(filePath string) (map[string][]byte, error)
- func GetFilledHubKubeConfigSecret(kubeClient kubernetes.Interface, secretNamespace, secretName string) (*corev1.Secret, error)
- func GetManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) (*clusterv1.ManagedCluster, error)
- func GetManagedClusterLease(kubeClient kubernetes.Interface, spokeClusterName string) (*coordinationv1.Lease, error)
- func GetResource(namespace, name string, gvr schema.GroupVersionResource, ...) (*unstructured.Unstructured, error)
- func GuestbookCr(namespace, name string) (cr *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
- func GuestbookCrd() (crd *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
- func HasCondition(conditions []metav1.Condition, expectedType, expectedReason string, ...) bool
- func HaveManifestCondition(conditions []workapiv1.ManifestCondition, expectedType string, ...) bool
- func NewCert(notAfter time.Time) []byte
- func NewClusterRole(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
- func NewConfigmap(namespace, name string, data map[string]string, finalizers []string) *corev1.ConfigMap
- func NewDaesonSet(namespace, name string) (u *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
- func NewDeployment(namespace, name, sa string) (u *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
- func NewIntegrationTestEventRecorder(component string) events.Recorder
- func NewKubeConfig(config *rest.Config) []byte
- func NewMQTTSourceOptions(sourceID string) *mqtt.MQTTOptions
- func NewManifestWork(namespace, name string, manifests []workapiv1.Manifest) *workapiv1.ManifestWork
- func NewResourceList(cpu, mem int) corev1.ResourceList
- func NewRole(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
- func NewRoleBinding(namespace, name, sa, role string) (*unstructured.Unstructured, schema.GroupVersionResource)
- func NewRoleBindingForManifest(namespace, name string, rule rbacv1.RoleRef, subjects ...rbacv1.Subject) *rbacv1.RoleBinding
- func NewRoleForManifest(namespace, name string, rules ...rbacv1.PolicyRule) *rbacv1.Role
- func NewServiceAccount(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
- func NewWorkPatch(old, new *workapiv1.ManifestWork) ([]byte, error)
- func PrepareSpokeAgentNamespace(kubeClient kubernetes.Interface, namespace string) error
- func RemoveConfigmapFinalizers(kubeClient kubernetes.Interface, namespace string, names ...string) error
- func RunMQTTBroker() error
- func StopMQTTBroker() error
- func SyncBootstrapKubeConfigFilesToSecret(filePath, secretNS, secretName string, kubeClient kubernetes.Interface) error
- func SyncBootstrapKubeConfigSecretToFiles(filePath, secretNS, secretName string, kubeClient kubernetes.Interface) error
- func ToManifest(object runtime.Object) workapiv1.Manifest
- type IntegrationTestEventRecorder
- func (r *IntegrationTestEventRecorder) ComponentName() string
- func (r *IntegrationTestEventRecorder) Event(reason, message string)
- func (r *IntegrationTestEventRecorder) Eventf(reason, messageFmt string, args ...interface{})
- func (r *IntegrationTestEventRecorder) ForComponent(c string) events.Recorder
- func (r *IntegrationTestEventRecorder) Shutdown()
- func (r *IntegrationTestEventRecorder) Warning(reason, message string)
- func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args ...interface{})
- func (r *IntegrationTestEventRecorder) WithComponentSuffix(suffix string) events.Recorder
- func (r *IntegrationTestEventRecorder) WithContext(ctx context.Context) events.Recorder
- type ProxyServer
- type TestAuthn
- func (t *TestAuthn) AddUser(user envtest.User, baseCfg *rest.Config) (*rest.Config, error)
- func (t *TestAuthn) ApproveCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, ...) error
- func (t *TestAuthn) ApproveSpokeClusterCSR(kubeClient kubernetes.Interface, spokeClusterName string, ...) error
- func (t *TestAuthn) ApproveSpokeClusterCSRWithExpiredCert(kubeClient kubernetes.Interface, spokeClusterName string) error
- func (t *TestAuthn) Configure(workDir string, args *envtest.Arguments) error
- func (t *TestAuthn) CreateBootstrapKubeConfig(configFileName, serverCertFile, securePort, bootstrapUser string, ...) error
- func (t *TestAuthn) CreateBootstrapKubeConfigWithCertAge(configFileName, serverCertFile, securePort string, certAge time.Duration, ...) error
- func (t *TestAuthn) CreateBootstrapKubeConfigWithProxy(configFileName, serverCertFile, securePort, proxyURL string, ...) error
- func (t *TestAuthn) CreateBootstrapKubeConfigWithUser(configFileName, serverCertFile, securePort, bootstrapUser string) error
- func (t *TestAuthn) FillCertificateToApprovedCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, ...) error
- func (t *TestAuthn) SignServerCert(commonName string, maxAge time.Duration) ([]byte, []byte, error)
- func (t *TestAuthn) Start() error
- func (t *TestAuthn) Stop() error
Constants ¶
const ( TestLeaseDurationSeconds = 1 TestDir = "/tmp/registration-integration-test" )
const ( KubeDriver = "kube" MQTTDriver = "mqtt" )
const AutoApprovalBootstrapUser = "autoapproval-user"
const MQTTBrokerHost = "127.0.0.1:1883"
Variables ¶
var ( CertDir = path.Join(TestDir, "client-certs") DefaultTestAuthn = NewTestAuthn(caFile, caKeyFile) )
Functions ¶
func AcceptManagedCluster ¶
func AcceptManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) error
func AcceptManagedClusterWithLeaseDuration ¶
func AcceptManagedClusterWithLeaseDuration(clusterClient clusterclientset.Interface, spokeClusterName string, leaseDuration int32) error
func AppliedManifestWorkName ¶ added in v0.15.0
func AppliedManifestWorkName(sourceDriver, hubHash string, work *workapiv1.ManifestWork) string
func AssertAppliedManifestWorkDeleted ¶
func AssertAppliedManifestWorkDeleted(name string, workClient workclientset.Interface, eventuallyTimeout, eventuallyInterval int)
func AssertAppliedResources ¶
func AssertAppliedResources(appliedManifestWorkName string, gvrs []schema.GroupVersionResource, namespaces, names []string, workClient workclientset.Interface, eventuallyTimeout, eventuallyInterval int)
AssertAppliedResources check if applied resources in work status are updated correctly
func AssertClusterManagerCondition ¶
func AssertClusterManagerCondition( name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus)
func AssertExistenceOfConfigMaps ¶
func AssertExistenceOfConfigMaps(manifests []workapiv1.Manifest, kubeClient kubernetes.Interface, eventuallyTimeout, eventuallyInterval int)
AssertExistenceOfConfigMaps check if all manifests are applied
func AssertExistenceOfResources ¶
func AssertExistenceOfResources(gvrs []schema.GroupVersionResource, namespaces, names []string, dynamicClient dynamic.Interface, eventuallyTimeout, eventuallyInterval int)
AssertExistenceOfResources check the existence of resource with GVR, namespace and name
func AssertFinalizerAdded ¶
func AssertFinalizerAdded(namespace, name, expectedFinalizer string, workClient workclientset.Interface, eventuallyTimeout, eventuallyInterval int)
AssertFinalizerAdded check if finalizer is added
func AssertKlusterletCondition ¶
func AssertKlusterletCondition( name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus)
func AssertNonexistenceOfConfigMaps ¶
func AssertNonexistenceOfConfigMaps(manifests []workapiv1.Manifest, kubeClient kubernetes.Interface, eventuallyTimeout, eventuallyInterval int)
AssertNonexistenceOfConfigMaps check if configmap does not exist
func AssertNonexistenceOfResources ¶
func AssertNonexistenceOfResources(gvrs []schema.GroupVersionResource, namespaces, names []string, dynamicClient dynamic.Interface, eventuallyTimeout, eventuallyInterval int)
AssertNonexistenceOfResources check if resource with GVR, namespace and name does not exists
func AssertWorkCondition ¶
func AssertWorkCondition(namespace, name string, workClient workclientset.Interface, expectedType string, expectedWorkStatus metav1.ConditionStatus, expectedManifestStatuses []metav1.ConditionStatus, eventuallyTimeout, eventuallyInterval int)
func AssertWorkDeleted ¶
func AssertWorkDeleted(namespace, name, appliedManifestWorkName string, manifests []workapiv1.Manifest, workClient, spokeWorkClient workclientset.Interface, spokeKubeClient kubernetes.Interface, eventuallyTimeout, eventuallyInterval int)
AssertWorkDeleted check if work is deleted
func AssertWorkGeneration ¶
func AssertWorkGeneration(namespace, name string, workClient workclientset.Interface, expectedType string, eventuallyTimeout, eventuallyInterval int)
func CmpResourceQuantity ¶
func CmpResourceQuantity(key string, nodeResourceList corev1.ResourceList, clusterResorceList clusterv1.ResourceList) bool
func CordonNode ¶
func CordonNode(kubeClient kubernetes.Interface, name string) error
func CreateKubeconfigFile ¶
func CreateMQTTConfigFile ¶ added in v0.15.0
func CreateNode ¶
func CreateNode(kubeClient kubernetes.Interface, name string, capacity, allocatable corev1.ResourceList) error
func FindAddOnCSRs ¶
func FindAddOnCSRs(kubeClient kubernetes.Interface, spokeClusterName, addOnName string) ([]*certificates.CertificateSigningRequest, error)
func FindAutoApprovedSpokeCSR ¶
func FindAutoApprovedSpokeCSR(kubeClient kubernetes.Interface, spokeClusterName string) (*certificates.CertificateSigningRequest, error)
func FindUnapprovedAddOnCSR ¶
func FindUnapprovedAddOnCSR(kubeClient kubernetes.Interface, spokeClusterName, addOnName string) (*certificates.CertificateSigningRequest, error)
func FindUnapprovedSpokeCSR ¶
func FindUnapprovedSpokeCSR(kubeClient kubernetes.Interface, spokeClusterName string) (*certificates.CertificateSigningRequest, error)
func GetBootstrapKubeConfigData ¶ added in v0.14.0
func GetManagedCluster ¶
func GetManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) (*clusterv1.ManagedCluster, error)
func GetManagedClusterLease ¶ added in v0.13.0
func GetManagedClusterLease(kubeClient kubernetes.Interface, spokeClusterName string) (*coordinationv1.Lease, error)
func GetResource ¶
func GetResource(namespace, name string, gvr schema.GroupVersionResource, dynamicClient dynamic.Interface) (*unstructured.Unstructured, error)
func GuestbookCr ¶
func GuestbookCr(namespace, name string) (cr *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
func GuestbookCrd ¶
func GuestbookCrd() (crd *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
func HasCondition ¶
func HaveManifestCondition ¶
func HaveManifestCondition(conditions []workapiv1.ManifestCondition, expectedType string, expectedStatuses []metav1.ConditionStatus) bool
func NewClusterRole ¶ added in v0.13.0
func NewClusterRole(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
func NewConfigmap ¶
func NewDaesonSet ¶ added in v0.14.0
func NewDaesonSet(namespace, name string) (u *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
func NewDeployment ¶
func NewDeployment(namespace, name, sa string) (u *unstructured.Unstructured, gvr schema.GroupVersionResource, err error)
func NewKubeConfig ¶
func NewMQTTSourceOptions ¶ added in v0.15.0
func NewMQTTSourceOptions(sourceID string) *mqtt.MQTTOptions
func NewManifestWork ¶
func NewManifestWork(namespace, name string, manifests []workapiv1.Manifest) *workapiv1.ManifestWork
func NewResourceList ¶
func NewResourceList(cpu, mem int) corev1.ResourceList
func NewRole ¶
func NewRole(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
func NewRoleBinding ¶
func NewRoleBinding(namespace, name, sa, role string) (*unstructured.Unstructured, schema.GroupVersionResource)
func NewRoleForManifest ¶
func NewRoleForManifest(namespace, name string, rules ...rbacv1.PolicyRule) *rbacv1.Role
func NewServiceAccount ¶
func NewServiceAccount(namespace, name string) (*unstructured.Unstructured, schema.GroupVersionResource)
func NewWorkPatch ¶ added in v0.15.0
func NewWorkPatch(old, new *workapiv1.ManifestWork) ([]byte, error)
func PrepareSpokeAgentNamespace ¶
func PrepareSpokeAgentNamespace(kubeClient kubernetes.Interface, namespace string) error
func RemoveConfigmapFinalizers ¶
func RemoveConfigmapFinalizers(kubeClient kubernetes.Interface, namespace string, names ...string) error
func RunMQTTBroker ¶ added in v0.15.0
func RunMQTTBroker() error
func StopMQTTBroker ¶ added in v0.15.0
func StopMQTTBroker() error
func SyncBootstrapKubeConfigFilesToSecret ¶ added in v0.14.0
func SyncBootstrapKubeConfigFilesToSecret( filePath, secretNS, secretName string, kubeClient kubernetes.Interface) error
func SyncBootstrapKubeConfigSecretToFiles ¶ added in v0.14.0
func SyncBootstrapKubeConfigSecretToFiles( filePath, secretNS, secretName string, kubeClient kubernetes.Interface) error
Types ¶
type IntegrationTestEventRecorder ¶
type IntegrationTestEventRecorder struct {
// contains filtered or unexported fields
}
func (*IntegrationTestEventRecorder) ComponentName ¶
func (r *IntegrationTestEventRecorder) ComponentName() string
func (*IntegrationTestEventRecorder) Event ¶
func (r *IntegrationTestEventRecorder) Event(reason, message string)
func (*IntegrationTestEventRecorder) Eventf ¶
func (r *IntegrationTestEventRecorder) Eventf(reason, messageFmt string, args ...interface{})
func (*IntegrationTestEventRecorder) ForComponent ¶
func (r *IntegrationTestEventRecorder) ForComponent(c string) events.Recorder
func (*IntegrationTestEventRecorder) Shutdown ¶
func (r *IntegrationTestEventRecorder) Shutdown()
func (*IntegrationTestEventRecorder) Warning ¶
func (r *IntegrationTestEventRecorder) Warning(reason, message string)
func (*IntegrationTestEventRecorder) Warningf ¶
func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args ...interface{})
func (*IntegrationTestEventRecorder) WithComponentSuffix ¶
func (r *IntegrationTestEventRecorder) WithComponentSuffix(suffix string) events.Recorder
func (*IntegrationTestEventRecorder) WithContext ¶
func (r *IntegrationTestEventRecorder) WithContext(ctx context.Context) events.Recorder
type ProxyServer ¶ added in v0.12.0
type ProxyServer struct { HTTPProxyURL string HTTPSProxyURL string // contains filtered or unexported fields }
ProxyServer is a simple proxy server that supports http tunnel
func NewProxyServer ¶ added in v0.12.0
func NewProxyServer(certData, keyData []byte) *ProxyServer
type TestAuthn ¶
type TestAuthn struct {
// contains filtered or unexported fields
}
func NewTestAuthn ¶
func (*TestAuthn) AddUser ¶
AddUser provisions a user, returning a copy of the given base rest.Config configured to authenticate as that users.
May only be called while the authenticator is "running".
func (*TestAuthn) ApproveCSR ¶
func (t *TestAuthn) ApproveCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, notBefore, notAfter time.Time) error
func (*TestAuthn) ApproveSpokeClusterCSR ¶
func (*TestAuthn) ApproveSpokeClusterCSRWithExpiredCert ¶
func (t *TestAuthn) ApproveSpokeClusterCSRWithExpiredCert(kubeClient kubernetes.Interface, spokeClusterName string) error
func (*TestAuthn) CreateBootstrapKubeConfig ¶
func (*TestAuthn) CreateBootstrapKubeConfigWithCertAge ¶
func (*TestAuthn) CreateBootstrapKubeConfigWithProxy ¶ added in v0.12.0
func (*TestAuthn) CreateBootstrapKubeConfigWithUser ¶
func (*TestAuthn) FillCertificateToApprovedCSR ¶
func (t *TestAuthn) FillCertificateToApprovedCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, notBefore, notAfter time.Time) error