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 ¶
- Variables
- func CreateGroup(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, ...) string
- func CreateOrganization(ctx context.Context, ac *openapi.ClientWithResponses, k8s client.Client, ...) string
- func CreateProject(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, ...) string
- func CreateServiceAccount(ctx context.Context, ac *openapi.ClientWithResponses, orgID, name string, ...) (string, string)
- func CreateUser(ctx context.Context, ac *openapi.ClientWithResponses, orgID, subject string, ...) string
- func Detailf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func FindGlobalUserID(ctx context.Context, k8s client.Client, namespace, subject string) string
- func FindRole(roles *openapi.RolesResponse, name string) string
- func FindRoleID(ctx context.Context, k8s client.Client, namespace, name string) string
- func IssueCert(ctx context.Context, k8s client.Client, namespace, name, cn string) ([]byte, []byte)
- func Logf(format string, args ...interface{})
- func MustParseOrganizationID(orgID string) ids.OrganizationID
- func NewAPIClient(baseURL, caCertPath string, certPEM, keyPEM []byte) *openapi.ClientWithResponses
- func NewClientScheme() *runtime.Scheme
- func ResolveRoles(ctx context.Context, ac *openapi.ClientWithResponses, orgID string) (string, string, string)
- func WaitForOrgNamespace(ctx context.Context, k8s client.Client, namespace, orgID string)
Constants ¶
This section is empty.
Variables ¶
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 FindGlobalUserID ¶
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 ¶
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 ¶
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 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 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.
Types ¶
This section is empty.