iamserviceaccount

package
v1.2.61 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceAccountRoleType is the role type tag for service account roles
	ServiceAccountRoleType = "ServiceAccountRole"

	// RoleTypeTagKey is the tag key for the role type
	RoleTypeTagKey = "rosa_role_type"

	// ServiceAccountTagKey is the tag key for the service account name
	ServiceAccountTagKey = "rosa.openshift.io/service-account"

	// NamespaceTagKey is the tag key for the namespace
	NamespaceTagKey = "rosa.openshift.io/namespace"

	// ClusterTagKey is the tag key for the cluster name
	ClusterTagKey = "rosa.openshift.io/cluster"
)

Variables

View Source
var (
	// ServiceAccountNameRE validates Kubernetes service account names
	ServiceAccountNameRE = regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`)

	// NamespaceNameRE validates Kubernetes namespace names
	NamespaceNameRE = regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`)
)

Functions

func GenerateDefaultTags

func GenerateDefaultTags(clusterName, namespace, serviceAccountName string) map[string]string

GenerateDefaultTags creates default tags for service account roles

func GenerateRoleName

func GenerateRoleName(clusterName, namespace, serviceAccountName string) string

GenerateRoleName creates a standardized role name for a service account

func GenerateTrustPolicy

func GenerateTrustPolicy(oidcProviderARN, namespace, serviceAccountName string) string

GenerateTrustPolicy creates an OIDC trust policy for the service account

func GenerateTrustPolicyMultiple

func GenerateTrustPolicyMultiple(oidcProviderARN string, serviceAccounts []ServiceAccountIdentifier) string

GenerateTrustPolicyMultiple creates an OIDC trust policy for multiple service accounts

func GetRoleARN

func GetRoleARN(accountID, roleName, path, partition string) string

GetRoleARN constructs the ARN for a role given the account ID, role name, path, and partition

func NamespaceNameValidator

func NamespaceNameValidator(val interface{}) error

NamespaceNameValidator is an interactive validator for namespace names

func ServiceAccountNameValidator

func ServiceAccountNameValidator(val interface{}) error

ServiceAccountNameValidator is an interactive validator for service account names

func ValidateNamespaceName

func ValidateNamespaceName(name string) error

ValidateNamespaceName validates a Kubernetes namespace name

func ValidateServiceAccountName

func ValidateServiceAccountName(name string) error

ValidateServiceAccountName validates a Kubernetes service account name

Types

type CreateOptions

type CreateOptions struct {
	ClusterName         string
	ServiceAccountName  string
	Namespace           string
	RoleName            string
	PolicyARNs          []string
	InlinePolicy        string
	PermissionsBoundary string
	Path                string
	Tags                map[string]string
}

CreateOptions contains options for creating a service account IAM role

type ListOptions

type ListOptions struct {
	ClusterName string
	Namespace   string
}

ListOptions contains filtering options for listing service account roles

type ServiceAccountIdentifier

type ServiceAccountIdentifier struct {
	Name      string
	Namespace string
}

ServiceAccountIdentifier represents a service account with its namespace

type ServiceAccountRole

type ServiceAccountRole struct {
	RoleName            string   `json:"roleName"`
	RoleARN             string   `json:"roleArn"`
	ClusterName         string   `json:"clusterName"`
	ServiceAccountName  string   `json:"serviceAccountName"`
	Namespace           string   `json:"namespace"`
	PolicyARNs          []string `json:"policyArns"`
	InlinePolicy        string   `json:"inlinePolicy,omitempty"`
	PermissionsBoundary string   `json:"permissionsBoundary,omitempty"`
	TrustPolicy         string   `json:"trustPolicy"`
}

ServiceAccountRole represents an IAM role associated with a Kubernetes service account

type ValidateOptions

type ValidateOptions struct {
	VerifyServiceAccountExists bool
	CheckExistingRole          bool
}

ValidateOptions contains validation configuration

Jump to

Keyboard shortcuts

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