test

package
v2.20.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AuthorizationCode represents a shared secret used by IssuerVerifier
	// TODO: consider injecting it into IssuerVerifier.
	AuthorizationCode = "fakeCode"
	// IDToken represents a shared fake token.
	IDToken       = "fakeTokenId"
	IDViewerToken = "fakeViewerTokenId"

	// IssuerURL holds test issuer URL.
	IssuerURL = "url://dex"
	// IssuerClientID holds test issuer client ID.
	IssuerClientID = "kubermatic"
	// IssuerClientSecret holds test issuer client secret.
	IssuerClientSecret = "secret"
)
View Source
const (
	NoExistingFakeProject      = "NoExistingFakeProject"
	NoExistingFakeProjectID    = "NoExistingFakeProject-ID"
	ForbiddenFakeProject       = "ForbiddenFakeProject"
	ForbiddenFakeProjectID     = "ForbiddenFakeProject-ID"
	ExistingFakeProject        = "ExistingFakeProject"
	ExistingFakeProjectID      = "ExistingFakeProject-ID"
	ImpersonatedClientErrorMsg = "forbidden"
)
View Source
const (
	// UserID holds a test user ID.
	UserID = "1233"
	// UserID2 holds a test user ID.
	UserID2 = "1523"
	// UserName holds a test user name.
	UserName = "user1"
	// UserName2 holds a test user name.
	UserName2 = "user2"
	// UserEmail holds a test user email.
	UserEmail = "john@acme.com"
	// UserEmail2 holds a test user email.
	UserEmail2 = "bob@example.com"
	// ClusterID holds the test cluster ID.
	ClusterID = "AbcClusterID"
	// DefaultClusterID holds the test default cluster ID.
	DefaultClusterID = "defClusterID"
	// DefaultClusterName holds the test default cluster name.
	DefaultClusterName = "defClusterName"
	// ProjectName holds the test project ID.
	ProjectName = "my-first-project-ID"
	// TestDatacenter holds datacenter name.
	TestSeedDatacenter = "us-central1"
	// TestServiceAccountHashKey authenticates the service account's token value using HMAC.
	TestServiceAccountHashKey = "eyJhbGciOiJIUzI1NeyJhbGciOiJIUzI1N"
	// TestFakeToken signed JWT token with fake data. It will expire after 3 years from 12-04-2022. To generate new token use kubermatic/pkg/serviceaccount/jwt_test.go.
	TestFakeToken = "" /* 237-byte string literal not displayed */
	// TestOSdomain OpenStack domain.
	TestOSdomain = "OSdomain"
	// TestOSuserPass OpenStack user password.
	TestOSuserPass = "OSpass"
	// TestOSuserName OpenStack user name.
	TestOSuserName = "OSuser"
	// TestFakeCredential Fake provider credential name.
	TestFakeCredential = "fake"
	// RequiredEmailDomain required domain for predefined credentials.
	RequiredEmailDomain = "acme.com"
	// DefaultKubernetesVersion kubernetes version.
	DefaultKubernetesVersion = "1.22.16"
	// Kubermatic namespace.
	KubermaticNamespace = "kubermatic"
)

Variables

View Source
var SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

SchemeGroupVersion is group version used to register these objects.

View Source
var (
	// UserLastSeen hold a time the user was last seen.
	UserLastSeen = time.Date(2020, time.December, 31, 23, 0, 0, 0, time.UTC)
)

Functions

func APIUserToKubermaticUser

func APIUserToKubermaticUser(user apiv1.User) *kubermaticv1.User

APIUserToKubermaticUser simply converts apiv1.User to kubermaticv1.User type.

func CheckStatusCode

func CheckStatusCode(wantStatusCode int, recorder *httptest.ResponseRecorder, t *testing.T)

func CompareVersions

func CompareVersions(t *testing.T, versions, expected []*apiv1.MasterVersion)

func CompareWithResult

func CompareWithResult(t *testing.T, res *httptest.ResponseRecorder, response string)

CompareWithResult a convenience function for comparing http.Body content with response.

func CreateRawVariables added in v2.16.3

func CreateRawVariables(t *testing.T, in map[string]interface{}) *runtime.RawExtension

func CreateTestEndpoint

func CreateTestEndpoint(user apiv1.User, kubeObjects, kubermaticObjects []ctrlruntimeclient.Object, config *kubermaticv1.KubermaticConfiguration, routingFunc newRoutingFunc) (http.Handler, error)

CreateTestEndpoint does exactly the same as CreateTestEndpointAndGetClients except it omits ClientsSets when returning.

func CreateTestSeedsGetter added in v2.17.0

func CreateTestSeedsGetter(ctx context.Context, client ctrlruntimeclient.Client) provider.SeedsGetter

CreateTestSeedsGetter creates a SeedsGetter only useful for generic tests, as it does not follow the CE/EE conventions and always returns all Seeds.

func DefaultCreationTimestamp

func DefaultCreationTimestamp() time.Time

DefaultCreationTimestamp returns default test timestamp.

func GenAPIAdminUser added in v2.19.0

func GenAPIAdminUser(name, email string, isAdmin bool) *apiv1.User

GenAPIAdminUser generates an admin API user.

func GenAPIEtcdBackupConfig added in v2.18.0

func GenAPIEtcdBackupConfig(name, clusterID string) *apiv2.EtcdBackupConfig

func GenAPIEtcdRestore added in v2.18.0

func GenAPIEtcdRestore(name, clusterID string) *apiv2.EtcdRestore

func GenAPIMLAAdminSetting added in v2.18.0

func GenAPIMLAAdminSetting(value int32) *apiv2.MLAAdminSetting

func GenAPIRuleGroup added in v2.18.0

func GenAPIRuleGroup(name string, ruleGroupType kubermaticv1.RuleGroupType) *apiv2.RuleGroup

func GenAPIUser

func GenAPIUser(name, email string) *apiv1.User

GenAPIUser generates a API user.

func GenAdminRuleGroup added in v2.19.0

func GenAdminRuleGroup(name, namespace string, ruleGroupType kubermaticv1.RuleGroupType) *kubermaticv1.RuleGroup

func GenAdminUser added in v2.16.3

func GenAdminUser(name, email string, isAdmin bool) *kubermaticv1.User

func GenAlertmanager added in v2.18.0

func GenAlertmanager(namespace, configSecretName string) *kubermaticv1.Alertmanager

func GenAlertmanagerConfigSecret added in v2.18.0

func GenAlertmanagerConfigSecret(name, namespace string, config []byte) *corev1.Secret

func GenAllowedRegistry added in v2.18.0

func GenAllowedRegistry(name, registryPrefix string) *kubermaticv1.AllowedRegistry

func GenBinding

func GenBinding(projectID, email, group string) *kubermaticv1.UserProjectBinding

GenBinding generates a binding.

func GenBlacklistTokenSecret

func GenBlacklistTokenSecret(name string, tokens []byte) *corev1.Secret

func GenCluster

func GenCluster(id string, name string, projectID string, creationTime time.Time, modifiers ...func(*kubermaticv1.Cluster)) *kubermaticv1.Cluster

func GenClusterTemplate added in v2.18.0

func GenClusterTemplate(name, id, projectID, scope, userEmail string) *kubermaticv1.ClusterTemplate

func GenClusterTemplateInstance added in v2.18.0

func GenClusterTemplateInstance(projectID, templateID string, replicas int64) *kubermaticv1.ClusterTemplateInstance

func GenClusterWithOpenstack

func GenClusterWithOpenstack(cluster *kubermaticv1.Cluster) *kubermaticv1.Cluster

func GenClusterWithOpenstackProjectAuth added in v2.19.0

func GenClusterWithOpenstackProjectAuth(cluster *kubermaticv1.Cluster) *kubermaticv1.Cluster

func GenConstraint added in v2.16.3

func GenConstraint(name, namespace, kind string) *kubermaticv1.Constraint

func GenConstraintTemplate added in v2.16.3

func GenConstraintTemplate(name string) *kubermaticv1.ConstraintTemplate

func GenDefaultAPIAllowedRegistry added in v2.18.0

func GenDefaultAPIAllowedRegistry(name, registryPrefix string) apiv2.AllowedRegistry

func GenDefaultAPIBackupCredentials added in v2.18.0

func GenDefaultAPIBackupCredentials() *apiv2.BackupCredentials

func GenDefaultAPIConstraint added in v2.16.3

func GenDefaultAPIConstraint(name, kind string) apiv2.Constraint

func GenDefaultAPIUser

func GenDefaultAPIUser() *apiv1.User

GenDefaultAPIUser generates a default API user.

func GenDefaultAdminAPIUser

func GenDefaultAdminAPIUser() *apiv1.User

GenDefaultAdminAPIUser generates a default admin API user.

func GenDefaultAdminUser added in v2.19.0

func GenDefaultAdminUser() *kubermaticv1.User

GenDefaultAdminUser generates a default admin user.

func GenDefaultBackupCredentials added in v2.18.0

func GenDefaultBackupCredentials() *corev1.Secret

func GenDefaultCluster

func GenDefaultCluster() *kubermaticv1.Cluster

func GenDefaultClusterRole added in v2.16.3

func GenDefaultClusterRole(name string) *rbacv1.ClusterRole

func GenDefaultClusterRoleBinding added in v2.16.3

func GenDefaultClusterRoleBinding(name, roleID, userEmail string) *rbacv1.ClusterRoleBinding

func GenDefaultConstraintTemplate added in v2.16.3

func GenDefaultConstraintTemplate(name string) apiv2.ConstraintTemplate

func GenDefaultExpiry

func GenDefaultExpiry() (apiv1.Time, error)

func GenDefaultExternalClusterNode

func GenDefaultExternalClusterNode() (*corev1.Node, error)

func GenDefaultExternalClusterNodes

func GenDefaultExternalClusterNodes() ([]ctrlruntimeclient.Object, error)

func GenDefaultGlobalSettings

func GenDefaultGlobalSettings() *kubermaticv1.KubermaticSetting

func GenDefaultGroupClusterRoleBinding added in v2.16.3

func GenDefaultGroupClusterRoleBinding(name, roleID, group string) *rbacv1.ClusterRoleBinding

func GenDefaultGroupRoleBinding added in v2.16.3

func GenDefaultGroupRoleBinding(name, namespace, roleID, group string) *rbacv1.RoleBinding

func GenDefaultKubermaticObjects

func GenDefaultKubermaticObjects(objs ...ctrlruntimeclient.Object) []ctrlruntimeclient.Object

GenDefaultKubermaticObjects generates default kubermatic object.

func GenDefaultOwnerBinding

func GenDefaultOwnerBinding() *kubermaticv1.UserProjectBinding

GenDefaultOwnerBinding generates default owner binding.

func GenDefaultPreset

func GenDefaultPreset() *kubermaticv1.Preset

func GenDefaultProject

func GenDefaultProject() *kubermaticv1.Project

GenDefaultProject generates a default project.

func GenDefaultRole added in v2.16.3

func GenDefaultRole(name, namespace string) *rbacv1.Role

func GenDefaultRoleBinding added in v2.16.3

func GenDefaultRoleBinding(name, namespace, roleID, userEmail string) *rbacv1.RoleBinding

func GenDefaultSaToken

func GenDefaultSaToken(projectID, saID, name, id string) *corev1.Secret

func GenDefaultSettings

func GenDefaultSettings() *kubermaticv1.KubermaticSetting

func GenDefaultUser

func GenDefaultUser() *kubermaticv1.User

GenDefaultUser generates a default user.

func GenDefaultVersions

func GenDefaultVersions() []semver.Semver

func GenEtcdBackupConfig added in v2.18.0

func GenEtcdBackupConfig(name string, cluster *kubermaticv1.Cluster, projectID string) *kubermaticv1.EtcdBackupConfig

func GenEtcdRestore added in v2.18.0

func GenEtcdRestore(name string, cluster *kubermaticv1.Cluster, projectID string) *kubermaticv1.EtcdRestore

func GenInactiveProjectServiceAccount added in v2.17.0

func GenInactiveProjectServiceAccount(id, name, group, projectName string) *kubermaticv1.User

GenInactiveProjectServiceAccount generates a Service Account resource.

func GenMLAAdminSetting added in v2.18.0

func GenMLAAdminSetting(name, clusterName string, value int32) *kubermaticv1.MLAAdminSetting

func GenMainServiceAccount added in v2.17.0

func GenMainServiceAccount(id, name, group, ownerEmail string) *kubermaticv1.User

func GenProject

func GenProject(name string, phase kubermaticv1.ProjectPhase, creationTime time.Time, oRef ...metav1.OwnerReference) *kubermaticv1.Project

GenProject generates new empty project.

func GenProjectServiceAccount added in v2.17.0

func GenProjectServiceAccount(id, name, group, projectName string) *kubermaticv1.User

func GenRuleGroup added in v2.18.0

func GenRuleGroup(name, clusterName string, ruleGroupType kubermaticv1.RuleGroupType) *kubermaticv1.RuleGroup

func GenTestAddon

func GenTestAddon(name string, variables *runtime.RawExtension, cluster *kubermaticv1.Cluster, creationTime time.Time) *kubermaticv1.Addon

func GenTestEvent

func GenTestEvent(eventName, eventType, eventReason, eventMessage, kind, uid string) *corev1.Event

func GenTestMachine

func GenTestMachine(name, rawProviderSpec string, labels map[string]string, ownerRef []metav1.OwnerReference) *clusterv1alpha1.Machine

func GenTestMachineDeployment

func GenTestMachineDeployment(name, rawProviderSpec string, selector map[string]string, dynamicConfig bool) *clusterv1alpha1.MachineDeployment

func GenTestSeed

func GenTestSeed(modifiers ...func(seed *kubermaticv1.Seed)) *kubermaticv1.Seed

func GenUser

func GenUser(id, name, email string) *kubermaticv1.User

GenUser generates a User resource note if the id is empty then it will be auto generated.

func GenerateTestKubeconfig

func GenerateTestKubeconfig(clusterID, token string) string

GenerateTestKubeconfig returns test kubeconfig yaml structure.

func GenerateTestRuleGroupData added in v2.18.0

func GenerateTestRuleGroupData(ruleGroupName string) []byte

func GetUser

func GetUser(email, id, name string) apiv1.User

GetUser is a convenience function for generating apiv1.User.

func RegisterScheme added in v2.16.3

func RegisterScheme(builder runtime.SchemeBuilder) error

Types

type ClientsSets

type ClientsSets struct {
	FakeClient ctrlruntimeclient.Client
	// this client is used for unprivileged methods where impersonated client is used
	FakeKubernetesCoreClient kubernetesclientset.Interface

	TokenAuthenticator serviceaccount.TokenAuthenticator
	TokenGenerator     serviceaccount.TokenGenerator
}

ClientsSets a simple wrapper that holds fake client sets.

func CreateTestEndpointAndGetClients

func CreateTestEndpointAndGetClients(user apiv1.User, seedsGetter provider.SeedsGetter, kubeObjects, machineObjects, kubermaticObjects []ctrlruntimeclient.Object, config *kubermaticv1.KubermaticConfiguration, routingFunc newRoutingFunc) (http.Handler, *ClientsSets, error)

CreateTestEndpointAndGetClients is a convenience function that instantiates fake providers and sets up routes for the tests.

type ConstraintSpec added in v2.16.3

type ConstraintSpec struct {
	Match      kubermaticv1.Match     `json:"match,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

func (*ConstraintSpec) DeepCopy added in v2.16.3

func (in *ConstraintSpec) DeepCopy() *ConstraintSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequiredLabelSpec.

func (*ConstraintSpec) DeepCopyInto added in v2.16.3

func (in *ConstraintSpec) DeepCopyInto(out *ConstraintSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConstraintStatus added in v2.16.3

type ConstraintStatus struct {
	Enforcement    string      `json:"enforcement,omitempty"`
	AuditTimestamp string      `json:"auditTimestamp,omitempty"`
	Violations     []Violation `json:"violations,omitempty"`
}

func (*ConstraintStatus) DeepCopy added in v2.16.3

func (in *ConstraintStatus) DeepCopy() *ConstraintStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConstraintStatus.

func (*ConstraintStatus) DeepCopyInto added in v2.16.3

func (in *ConstraintStatus) DeepCopyInto(out *ConstraintStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FakeConstraintProvider added in v2.16.3

type FakeConstraintProvider struct {
	Provider   *kubernetes.ConstraintProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeConstraintProvider) Create added in v2.16.3

func (*FakeConstraintProvider) Delete added in v2.16.3

func (p *FakeConstraintProvider) Delete(cluster *kubermaticv1.Cluster, userInfo *provider.UserInfo, name string) error

func (*FakeConstraintProvider) Get added in v2.16.3

func (*FakeConstraintProvider) List added in v2.16.3

func (*FakeConstraintProvider) Update added in v2.16.3

type FakeConstraintTemplateProvider added in v2.16.3

type FakeConstraintTemplateProvider struct {
	Provider   *kubernetes.ConstraintTemplateProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeConstraintTemplateProvider) Create added in v2.16.3

func (*FakeConstraintTemplateProvider) Delete added in v2.16.3

func (*FakeConstraintTemplateProvider) Get added in v2.16.3

func (*FakeConstraintTemplateProvider) List added in v2.16.3

func (*FakeConstraintTemplateProvider) Update added in v2.16.3

type FakeDefaultConstraintProvider added in v2.18.0

type FakeDefaultConstraintProvider struct {
	Provider   *kubernetes.DefaultConstraintProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeDefaultConstraintProvider) Create added in v2.18.0

func (*FakeDefaultConstraintProvider) Delete added in v2.18.0

func (p *FakeDefaultConstraintProvider) Delete(name string) error

func (*FakeDefaultConstraintProvider) Get added in v2.18.0

func (*FakeDefaultConstraintProvider) List added in v2.18.0

func (*FakeDefaultConstraintProvider) Update added in v2.18.0

type FakeEtcdBackupConfigProvider added in v2.18.0

type FakeEtcdBackupConfigProvider struct {
	Provider   *kubernetes.EtcdBackupConfigProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeEtcdBackupConfigProvider) Create added in v2.18.0

func (*FakeEtcdBackupConfigProvider) Delete added in v2.18.0

func (p *FakeEtcdBackupConfigProvider) Delete(userInfo *provider.UserInfo, cluster *kubermaticv1.Cluster, name string) error

func (*FakeEtcdBackupConfigProvider) Get added in v2.18.0

func (*FakeEtcdBackupConfigProvider) List added in v2.18.0

func (*FakeEtcdBackupConfigProvider) Patch added in v2.18.0

type FakeEtcdRestoreProvider added in v2.18.0

type FakeEtcdRestoreProvider struct {
	Provider   *kubernetes.EtcdRestoreProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeEtcdRestoreProvider) Create added in v2.18.0

func (*FakeEtcdRestoreProvider) Delete added in v2.18.0

func (p *FakeEtcdRestoreProvider) Delete(userInfo *provider.UserInfo, cluster *kubermaticv1.Cluster, name string) error

func (*FakeEtcdRestoreProvider) Get added in v2.18.0

func (*FakeEtcdRestoreProvider) List added in v2.18.0

type FakeExternalClusterProvider

type FakeExternalClusterProvider struct {
	Provider   *kubernetes.ExternalClusterProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakeExternalClusterProvider) CreateOrUpdateCredentialSecretForCluster added in v2.19.0

func (p *FakeExternalClusterProvider) CreateOrUpdateCredentialSecretForCluster(ctx context.Context, cloud *apiv2.ExternalClusterCloudSpec, projectID, clusterID string) (*providerconfig.GlobalSecretKeySelector, error)

func (*FakeExternalClusterProvider) CreateOrUpdateKubeconfigSecretForCluster

func (p *FakeExternalClusterProvider) CreateOrUpdateKubeconfigSecretForCluster(ctx context.Context, cluster *kubermaticv1.ExternalCluster, kubeconfig string) error

func (*FakeExternalClusterProvider) Delete

func (*FakeExternalClusterProvider) GenerateClient

func (*FakeExternalClusterProvider) Get

func (*FakeExternalClusterProvider) GetClient

func (*FakeExternalClusterProvider) GetNode

func (p *FakeExternalClusterProvider) GetNode(cluster *kubermaticv1.ExternalCluster, nodeName string) (*corev1.Node, error)

func (*FakeExternalClusterProvider) GetVersion

func (*FakeExternalClusterProvider) IsMetricServerAvailable

func (p *FakeExternalClusterProvider) IsMetricServerAvailable(cluster *kubermaticv1.ExternalCluster) (bool, error)

func (*FakeExternalClusterProvider) List

func (*FakeExternalClusterProvider) ListNodes

func (*FakeExternalClusterProvider) New

func (*FakeExternalClusterProvider) Update

type FakePrivilegedAllowedRegistryProvider added in v2.18.0

type FakePrivilegedAllowedRegistryProvider struct {
	Provider   *kubernetes.PrivilegedAllowedRegistryProvider
	FakeClient ctrlruntimeclient.Client
}

func (*FakePrivilegedAllowedRegistryProvider) CreateUnsecured added in v2.18.0

func (*FakePrivilegedAllowedRegistryProvider) DeleteUnsecured added in v2.18.0

func (p *FakePrivilegedAllowedRegistryProvider) DeleteUnsecured(name string) error

func (*FakePrivilegedAllowedRegistryProvider) GetUnsecured added in v2.18.0

func (*FakePrivilegedAllowedRegistryProvider) ListUnsecured added in v2.18.0

func (*FakePrivilegedAllowedRegistryProvider) UpdateUnsecured added in v2.18.0

type FakePrivilegedProjectProvider

type FakePrivilegedProjectProvider struct {
}

func NewFakePrivilegedProjectProvider

func NewFakePrivilegedProjectProvider() *FakePrivilegedProjectProvider

func (*FakePrivilegedProjectProvider) DeleteUnsecured

func (f *FakePrivilegedProjectProvider) DeleteUnsecured(projectInternalName string) error

DeleteUnsecured deletes any given project This function is unsafe in a sense that it uses privileged account to delete project with the given name.

func (*FakePrivilegedProjectProvider) GetUnsecured

func (f *FakePrivilegedProjectProvider) GetUnsecured(projectInternalName string, options *provider.ProjectGetOptions) (*kubermaticv1.Project, error)

GetUnsecured returns the project with the given name This function is unsafe in a sense that it uses privileged account to get project with the given name.

func (*FakePrivilegedProjectProvider) UpdateUnsecured

UpdateUnsecured update an existing project and returns it This function is unsafe in a sense that it uses privileged account to update project.

type FakeProjectProvider

type FakeProjectProvider struct {
}

func NewFakeProjectProvider

func NewFakeProjectProvider() *FakeProjectProvider

func (*FakeProjectProvider) Delete

func (f *FakeProjectProvider) Delete(userInfo *provider.UserInfo, projectInternalName string) error

Delete deletes the given project as the given user

Note: Before deletion project's status.phase is set to ProjectTerminating.

func (*FakeProjectProvider) Get

func (f *FakeProjectProvider) Get(userInfo *provider.UserInfo, projectInternalName string, options *provider.ProjectGetOptions) (*kubermaticv1.Project, error)

Get returns the project with the given name.

func (*FakeProjectProvider) List

List gets a list of projects, by default it returns all resources. If you want to filter the result please set ProjectListOptions

Note that the list is taken from the cache.

func (*FakeProjectProvider) New

func (f *FakeProjectProvider) New(user []*kubermaticv1.User, name string, labels map[string]string) (*kubermaticv1.Project, error)

func (*FakeProjectProvider) Update

func (f *FakeProjectProvider) Update(userInfo *provider.UserInfo, newProject *kubermaticv1.Project) (*kubermaticv1.Project, error)

Update update an existing project and returns it.

type IssuerVerifier

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

IssuerVerifier is a test stub that mocks OIDC responses.

func NewFakeOIDCClient

func NewFakeOIDCClient(user apiv1.User) *IssuerVerifier

NewFakeOIDCClient returns fake OIDC issuer and verifier.

func (*IssuerVerifier) AuthCodeURL

func (o *IssuerVerifier) AuthCodeURL(state string, offlineAsScope bool, scopes ...string) string

AuthCodeURL returns a URL to OpenID provider's consent page.

func (*IssuerVerifier) Exchange

func (o *IssuerVerifier) Exchange(ctx context.Context, code string) (auth.OIDCToken, error)

Exchange converts an authorization code into a token.

func (*IssuerVerifier) Extract

func (o *IssuerVerifier) Extract(_ *http.Request) (string, error)

Extractor knows how to extract the ID token from the request.

func (*IssuerVerifier) Verify

func (o *IssuerVerifier) Verify(ctx context.Context, token string) (auth.TokenClaims, error)

Verify parses a raw ID Token, verifies it's been signed by the provider, performs any additional checks depending on the Config, and returns the payload as TokenClaims.

type NewAddonSliceWrapper

type NewAddonSliceWrapper []apiv1.Addon

NewAddonSliceWrapper wraps []apiv1.Addon to provide convenient methods for tests.

func (*NewAddonSliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewAddonSliceWrapper) EqualOrDie

func (k NewAddonSliceWrapper) EqualOrDie(expected NewAddonSliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewAddonSliceWrapper) Sort

func (k NewAddonSliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NewAllowedRegistrySliceWrapper added in v2.18.0

type NewAllowedRegistrySliceWrapper []*apiv2.AllowedRegistry

NewAllowedRegistrySliceWrapper wraps []apiv2.AllowedRegistry to provide convenient methods for tests.

func (*NewAllowedRegistrySliceWrapper) DecodeOrDie added in v2.18.0

DecodeOrDie reads and decodes json data from the reader.

func (NewAllowedRegistrySliceWrapper) EqualOrDie added in v2.18.0

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewAllowedRegistrySliceWrapper) Sort added in v2.18.0

Sort sorts the collection by Name.

type NewClusterTemplateSliceWrapper added in v2.18.0

type NewClusterTemplateSliceWrapper []apiv2.ClusterTemplate

NewClusterTemplateSliceWrapper wraps []apiv2.ClusterTemplate to provide convenient methods for tests.

func (*NewClusterTemplateSliceWrapper) DecodeOrDie added in v2.18.0

DecodeOrDie reads and decodes json data from the reader.

func (NewClusterTemplateSliceWrapper) EqualOrDie added in v2.18.0

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewClusterTemplateSliceWrapper) Sort added in v2.18.0

Sort sorts the collection by Name.

type NewClusterV1SliceWrapper

type NewClusterV1SliceWrapper []apiv1.Cluster

NewClusterV1SliceWrapper wraps []apiv1.Cluster to provide convenient methods for tests.

func (*NewClusterV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewClusterV1SliceWrapper) EqualOrDie

func (k NewClusterV1SliceWrapper) EqualOrDie(expected NewClusterV1SliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewClusterV1SliceWrapper) Sort

func (k NewClusterV1SliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NewConstraintTemplateV1SliceWrapper added in v2.16.3

type NewConstraintTemplateV1SliceWrapper []apiv2.ConstraintTemplate

NewConstraintTemplateV1SliceWrapper wraps []apiv1.ConstraintTemplate to provide convenient methods for tests.

func (*NewConstraintTemplateV1SliceWrapper) DecodeOrDie added in v2.16.3

DecodeOrDie reads and decodes json data from the reader.

func (NewConstraintTemplateV1SliceWrapper) EqualOrDie added in v2.16.3

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewConstraintTemplateV1SliceWrapper) Sort added in v2.16.3

Sort sorts the collection by Name.

type NewConstraintsSliceWrapper added in v2.16.3

type NewConstraintsSliceWrapper []apiv2.Constraint

NewConstraintsSliceWrapper wraps []apiv2.Constraints to provide convenient methods for tests.

func (*NewConstraintsSliceWrapper) DecodeOrDie added in v2.16.3

DecodeOrDie reads and decodes json data from the reader.

func (NewConstraintsSliceWrapper) EqualOrDie added in v2.16.3

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewConstraintsSliceWrapper) Sort added in v2.16.3

func (k NewConstraintsSliceWrapper) Sort()

Sort sorts the collection by Name.

type NewEtcdBackupConfigSliceWrapper added in v2.18.0

type NewEtcdBackupConfigSliceWrapper []*apiv2.EtcdBackupConfig

NewEtcdBackupConfigSliceWrapper wraps []apiv2.EtcdBackupConfig to provide convenient methods for tests.

func (*NewEtcdBackupConfigSliceWrapper) DecodeOrDie added in v2.18.0

DecodeOrDie reads and decodes json data from the reader.

func (NewEtcdBackupConfigSliceWrapper) EqualOrDie added in v2.18.0

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewEtcdBackupConfigSliceWrapper) Sort added in v2.18.0

Sort sorts the collection by Name.

type NewEtcdRestoreSliceWrapper added in v2.18.0

type NewEtcdRestoreSliceWrapper []*apiv2.EtcdRestore

NewEtcdRestoreSliceWrapper wraps []apiv2.EtcdRestore to provide convenient methods for tests.

func (*NewEtcdRestoreSliceWrapper) DecodeOrDie added in v2.18.0

DecodeOrDie reads and decodes json data from the reader.

func (NewEtcdRestoreSliceWrapper) EqualOrDie added in v2.18.0

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewEtcdRestoreSliceWrapper) Sort added in v2.18.0

func (k NewEtcdRestoreSliceWrapper) Sort()

Sort sorts the collection by Name.

type NewRoleNameSliceWrapper

type NewRoleNameSliceWrapper []apiv1.RoleName

NewRoleNameSliceWrapper wraps []apiv1.RoleName to provide convenient methods for tests.

func (*NewRoleNameSliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewRoleNameSliceWrapper) EqualOrDie

func (k NewRoleNameSliceWrapper) EqualOrDie(expected NewRoleNameSliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewRoleNameSliceWrapper) Sort

func (k NewRoleNameSliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NewRuleGroupSliceWrapper added in v2.18.0

type NewRuleGroupSliceWrapper []*apiv2.RuleGroup

NewRuleGroupSliceWrapper wraps []apiv2.RuleGroup to provide convenient methods for tests.

func (*NewRuleGroupSliceWrapper) DecodeOrDie added in v2.18.0

DecodeOrDie reads and decodes json data from the reader.

func (NewRuleGroupSliceWrapper) EqualOrDie added in v2.18.0

func (k NewRuleGroupSliceWrapper) EqualOrDie(expected NewRuleGroupSliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewRuleGroupSliceWrapper) Sort added in v2.18.0

func (k NewRuleGroupSliceWrapper) Sort()

Sort sorts the collection by Name.

type NewSSHKeyV1SliceWrapper

type NewSSHKeyV1SliceWrapper []apiv1.SSHKey

NewSSHKeyV1SliceWrapper wraps []apiv1.SSHKey to provide convenient methods for tests.

func (*NewSSHKeyV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewSSHKeyV1SliceWrapper) EqualOrDie

func (k NewSSHKeyV1SliceWrapper) EqualOrDie(expected NewSSHKeyV1SliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewSSHKeyV1SliceWrapper) Sort

func (k NewSSHKeyV1SliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NewServiceAccountTokenV1SliceWrapper

type NewServiceAccountTokenV1SliceWrapper []apiv1.PublicServiceAccountToken

NewServiceAccountTokenV1SliceWrapper wraps []apiv1.ServiceAccountToken to provide convenient methods for tests.

func (*NewServiceAccountTokenV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewServiceAccountTokenV1SliceWrapper) EqualOrDie

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewServiceAccountTokenV1SliceWrapper) Sort

Sort sorts the collection by name.

type NewServiceAccountV1SliceWrapper

type NewServiceAccountV1SliceWrapper []apiv1.ServiceAccount

NewServiceAccountV1SliceWrapper wraps []apiv1.ServiceAccount to provide convenient methods for tests.

func (*NewServiceAccountV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewServiceAccountV1SliceWrapper) EqualOrDie

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewServiceAccountV1SliceWrapper) Sort

Sort sorts the collection by name.

type NewUserV1SliceWrapper

type NewUserV1SliceWrapper []apiv1.User

NewUserV1SliceWrapper wraps []apiv1.User to provide convenient methods for tests.

func (*NewUserV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (NewUserV1SliceWrapper) EqualOrDie

func (k NewUserV1SliceWrapper) EqualOrDie(expected NewUserV1SliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NewUserV1SliceWrapper) Sort

func (k NewUserV1SliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NodeDeploymentSliceWrapper added in v2.16.3

type NodeDeploymentSliceWrapper []apiv1.NodeDeployment

NodeDeploymentSliceWrapper wraps []apiv1.NodeDeployment to provide convenient methods for tests.

func (*NodeDeploymentSliceWrapper) DecodeOrDie added in v2.16.3

DecodeOrDie reads and decodes json data from the reader.

func (NodeDeploymentSliceWrapper) EqualOrDie added in v2.16.3

EqualOrDie compares whether expected collection is equal to the actual one.

func (NodeDeploymentSliceWrapper) Sort added in v2.16.3

func (k NodeDeploymentSliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type NodeV1SliceWrapper

type NodeV1SliceWrapper []apiv1.Node

NodeV1SliceWrapper wraps []apiv1.Node to provide convenient methods for tests.

func (*NodeV1SliceWrapper) DecodeOrDie

func (k *NodeV1SliceWrapper) DecodeOrDie(r io.Reader, t *testing.T) *NodeV1SliceWrapper

DecodeOrDie reads and decodes json data from the reader.

func (NodeV1SliceWrapper) EqualOrDie

func (k NodeV1SliceWrapper) EqualOrDie(expected NodeV1SliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (NodeV1SliceWrapper) Sort

func (k NodeV1SliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type OicdProvider

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

OicdProvider is a test stub that mocks *oidc.Provider.

func (*OicdProvider) Endpoint

func (p *OicdProvider) Endpoint() oauth2.Endpoint

Endpoint returns the OAuth2 auth and token endpoints for the given provider.

type ProjectV1SliceWrapper

type ProjectV1SliceWrapper []apiv1.Project

ProjectV1SliceWrapper wraps []apiv1.Project to provide convenient methods for tests.

func (*ProjectV1SliceWrapper) DecodeOrDie

DecodeOrDie reads and decodes json data from the reader.

func (ProjectV1SliceWrapper) EqualOrDie

func (k ProjectV1SliceWrapper) EqualOrDie(expected ProjectV1SliceWrapper, t *testing.T)

EqualOrDie compares whether expected collection is equal to the actual one.

func (ProjectV1SliceWrapper) Sort

func (k ProjectV1SliceWrapper) Sort()

Sort sorts the collection by CreationTimestamp.

type RequiredLabel added in v2.16.3

type RequiredLabel struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ConstraintSpec   `json:"spec,omitempty"`
	Status ConstraintStatus `json:"status,omitempty"`
}

func (*RequiredLabel) DeepCopy added in v2.16.3

func (in *RequiredLabel) DeepCopy() *RequiredLabel

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequiredLabel.

func (*RequiredLabel) DeepCopyInto added in v2.16.3

func (in *RequiredLabel) DeepCopyInto(out *RequiredLabel)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RequiredLabel) DeepCopyObject added in v2.16.3

func (in *RequiredLabel) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RequiredLabelList added in v2.16.3

type RequiredLabelList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []runtime.RawExtension `json:"items"`
}

func (*RequiredLabelList) DeepCopy added in v2.16.3

func (in *RequiredLabelList) DeepCopy() *RequiredLabelList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RequiredLabelList.

func (*RequiredLabelList) DeepCopyInto added in v2.16.3

func (in *RequiredLabelList) DeepCopyInto(out *RequiredLabelList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RequiredLabelList) DeepCopyObject added in v2.16.3

func (in *RequiredLabelList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type UniqueLabel added in v2.16.3

type UniqueLabel struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ConstraintSpec   `json:"spec,omitempty"`
	Status ConstraintStatus `json:"status,omitempty"`
}

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*UniqueLabel) DeepCopy added in v2.16.3

func (in *UniqueLabel) DeepCopy() *UniqueLabel

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UniqueLabel.

func (*UniqueLabel) DeepCopyInto added in v2.16.3

func (in *UniqueLabel) DeepCopyInto(out *UniqueLabel)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*UniqueLabel) DeepCopyObject added in v2.16.3

func (in *UniqueLabel) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type UniqueLabelList added in v2.16.3

type UniqueLabelList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []runtime.RawExtension `json:"items"`
}

func (*UniqueLabelList) DeepCopy added in v2.16.3

func (in *UniqueLabelList) DeepCopy() *UniqueLabelList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UniqueLabelList.

func (*UniqueLabelList) DeepCopyInto added in v2.16.3

func (in *UniqueLabelList) DeepCopyInto(out *UniqueLabelList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*UniqueLabelList) DeepCopyObject added in v2.16.3

func (in *UniqueLabelList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type Violation added in v2.16.3

type Violation struct {
	EnforcementAction string `json:"enforcementAction,omitempty"`
	Kind              string `json:"kind,omitempty"`
	Message           string `json:"message,omitempty"`
	Name              string `json:"name,omitempty"`
	Namespace         string `json:"namespace,omitempty"`
}

func (*Violation) DeepCopy added in v2.16.3

func (in *Violation) DeepCopy() *Violation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Violation.

func (*Violation) DeepCopyInto added in v2.16.3

func (in *Violation) DeepCopyInto(out *Violation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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