fixturelib

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package fixturelib holds the identity API helpers shared by the CI fixture programs under hack/ci. Every helper exits the process on failure.

Index

Constants

This section is empty.

Variables

View Source
var Quiet bool

Quiet silences Detailf, the per-object output of the Create* helpers, for programs that call them thousands of times.

Functions

func CreateGroup

func CreateGroup(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, roleIDs []string) string

CreateGroup creates a group with the given role IDs assigned.

func CreateOrganization

func CreateOrganization(ctx context.Context, ac *openapi.ClientWithResponses, k8s client.Client, namespace, name string) string

CreateOrganization creates an organization and waits for its namespace.

func CreateProject

func CreateProject(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, groupIDs []string) string

CreateProject creates a project with the given group memberships and returns its ID.

func CreateServiceAccount

func CreateServiceAccount(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, groupIDs []string) (string, string)

CreateServiceAccount creates a service account in the given groups and returns its ID and token.

func CreateUser

func CreateUser(ctx context.Context, ac *openapi.ClientWithResponses, orgID, subject string, groupIDs []string) string

CreateUser creates an active user in the given groups and returns its organization user ID.

func Detailf

func Detailf(format string, args ...interface{})

Detailf prints a per-object progress line unless Quiet is set.

func Fatalf

func Fatalf(format string, args ...interface{})

func FindGlobalUserID

func FindGlobalUserID(ctx context.Context, k8s client.Client, namespace, subject string) string

func FindRole

func FindRole(roles *openapi.RolesResponse, name string) string

FindRole returns the ID of a named role within an organization. platform-administrator and other protected roles are excluded from the API response.

func FindRoleID

func FindRoleID(ctx context.Context, k8s client.Client, namespace, name string) string

FindRoleID resolves a Role CRD ID by its friendly name label. Protected roles never appear in the user-facing role listing, so the API cannot be used for this.

func IssueCert

func IssueCert(ctx context.Context, k8s client.Client, namespace, name, cn string) ([]byte, []byte)

IssueCert creates a cert-manager Certificate via controller-runtime and waits for the backing Secret to be ready. Returns the cert and key PEM bytes.

func Logf

func Logf(format string, args ...interface{})

Logf prints a progress line.

func MustParseOrganizationID

func MustParseOrganizationID(orgID string) ids.OrganizationID

func NewAPIClient

func NewAPIClient(baseURL, caCertPath string, certPEM, keyPEM []byte) *openapi.ClientWithResponses

NewAPIClient builds an openapi.ClientWithResponses that authenticates via mTLS. The certificate CN maps directly to an RBAC role — no bearer token is needed. An X-Principal header is injected on every request as required by the middleware.

func NewClientScheme

func NewClientScheme() *runtime.Scheme

func ResolveRoles

func ResolveRoles(ctx context.Context, ac *openapi.ClientWithResponses, orgID string) (string, string, string)

ResolveRoles lists organization roles and returns role IDs. - administrator is required. - user is required. - auditor is required.

func WaitForOrgNamespace

func WaitForOrgNamespace(ctx context.Context, k8s client.Client, namespace, orgID string)

WaitForOrgNamespace polls until the organization controller has provisioned the backing namespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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