util

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestLeaseDurationSeconds = 1
	TestDir                  = "/tmp/registration-integration-test"
)
View Source
const AutoApprovalBootstrapUser = "autoapproval-user"

Variables

View Source
var (
	CertDir = path.Join(TestDir, "client-certs")

	DefaultTestAuthn = NewTestAuthn(caFile, caKeyFile)
)

Functions

func AcceptManagedCluster

func AcceptManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) error

func AcceptManagedClusterWithLeaseDuration added in v0.10.0

func AcceptManagedClusterWithLeaseDuration(clusterClient clusterclientset.Interface, spokeClusterName string, leaseDuration int32) error

func CmpResourceQuantity added in v0.6.0

func CmpResourceQuantity(key string, nodeResourceList corev1.ResourceList, clusterResorceList clusterv1.ResourceList) bool

func CordonNode added in v0.6.0

func CordonNode(kubeClient kubernetes.Interface, name string) error

func CreateNode added in v0.6.0

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 GetFilledHubKubeConfigSecret

func GetFilledHubKubeConfigSecret(kubeClient kubernetes.Interface, secretNamespace, secretName string) (*corev1.Secret, error)

func GetManagedCluster

func GetManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) (*clusterv1.ManagedCluster, error)

func NewIntegrationTestEventRecorder

func NewIntegrationTestEventRecorder(componet string) events.Recorder

func NewResourceList added in v0.6.0

func NewResourceList(cpu, mem int) corev1.ResourceList

func PrepareSpokeAgentNamespace

func PrepareSpokeAgentNamespace(kubeClient kubernetes.Interface, namespace string) error

func RunAgent added in v0.6.0

func RunAgent(name string, opt spoke.SpokeAgentOptions, cfg *rest.Config) context.CancelFunc

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 (*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 added in v0.6.0

type TestAuthn added in v0.6.0

type TestAuthn struct {
	// contains filtered or unexported fields
}

func NewTestAuthn added in v0.6.0

func NewTestAuthn(caFile, caKeyFile string) *TestAuthn

func (*TestAuthn) AddUser added in v0.6.0

func (t *TestAuthn) AddUser(user envtest.User, baseCfg *rest.Config) (*rest.Config, error)

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 added in v0.6.0

func (t *TestAuthn) ApproveCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, notBefore, notAfter time.Time) error

func (*TestAuthn) ApproveSpokeClusterCSR added in v0.6.0

func (t *TestAuthn) ApproveSpokeClusterCSR(kubeClient kubernetes.Interface, spokeClusterName string, certAge time.Duration) error

func (*TestAuthn) ApproveSpokeClusterCSRWithExpiredCert added in v0.6.0

func (t *TestAuthn) ApproveSpokeClusterCSRWithExpiredCert(kubeClient kubernetes.Interface, spokeClusterName string) error

func (*TestAuthn) Configure added in v0.6.0

func (t *TestAuthn) Configure(workDir string, args *envtest.Arguments) error

func (*TestAuthn) CreateBootstrapKubeConfig added in v0.11.0

func (t *TestAuthn) CreateBootstrapKubeConfig(configFileName, serverCertFile, securePort, bootstrapUser string, certAge time.Duration) error

func (*TestAuthn) CreateBootstrapKubeConfigWithCertAge added in v0.6.0

func (t *TestAuthn) CreateBootstrapKubeConfigWithCertAge(configFileName, serverCertFile, securePort string, certAge time.Duration) error

func (*TestAuthn) CreateBootstrapKubeConfigWithUser added in v0.11.0

func (t *TestAuthn) CreateBootstrapKubeConfigWithUser(configFileName, serverCertFile, securePort, bootstrapUser string) error

func (*TestAuthn) FillCertificateToApprovedCSR added in v0.11.0

func (t *TestAuthn) FillCertificateToApprovedCSR(kubeClient kubernetes.Interface, csr *certificates.CertificateSigningRequest, notBefore, notAfter time.Time) error

func (*TestAuthn) Start added in v0.6.0

func (t *TestAuthn) Start() error

Start runs this authenticator. Will be called just before API server start.

Must be called after Configure.

func (*TestAuthn) Stop added in v0.6.0

func (t *TestAuthn) Stop() error

Stop shuts down this authenticator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL