aws

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package aws holds AWS-side helpers used by cluster-facing seictl commands.

Index

Constants

View Source
const (
	IAMPath = "/seictl/"
)

Variables

This section is empty.

Functions

func AssertECRDigestRef

func AssertECRDigestRef(ref string) error

AssertECRDigestRef returns an actionable error if ref is not a digest-pinned ECR reference. Used at render time to guarantee manifests never carry a tag.

func CredsHint

func CredsHint() string

CredsHint returns a one-line remediation for the "no AWS credentials resolvable" case. It reads AWS_PROFILE and ~/.aws/config so the message names a profile the engineer can actually use, instead of a generic "Unable to locate credentials".

func ResolveDigest

func ResolveDigest(ctx context.Context, ref string) (string, *clioutput.Error)

ResolveDigest converts an ECR image reference (registry/repo:tag) into its sha256 digest. Already-digested refs are returned as-is without an ECR round-trip.

Account + region come from the hostname rather than constants so the resolver works for any ECR registry the validate-layer policy admits.

Types

type Caller

type Caller struct {
	Account      string
	Region       string
	PrincipalARN string
}

func GetCaller

func GetCaller(ctx context.Context) (*Caller, *clioutput.Error)

GetCaller resolves the active AWS principal via STS GetCallerIdentity. Errors map to ExitIdentity / CatAWSUnavailable — this is a read of auth state, not a creation. When the failure is "no credentials resolvable" (vs e.g. permission denied), the message is prefixed with CredsHint() so the engineer sees the specific remediation.

type EngineerScope

type EngineerScope struct {
	Account string
	Region  string
	Cluster string
	Alias   string
}

func (EngineerScope) PolicyARN

func (e EngineerScope) PolicyARN() string

func (EngineerScope) PolicyName

func (e EngineerScope) PolicyName() string

func (EngineerScope) RoleARN

func (e EngineerScope) RoleARN() string

func (EngineerScope) RoleName

func (e EngineerScope) RoleName() string

type IAMArtifact

type IAMArtifact struct {
	Kind   string // "Policy" | "Role" | "Attachment"
	ARN    string
	Action string // "create" | "exists" | "would-create"
}

func ProvisionIAM

func ProvisionIAM(ctx context.Context, scope EngineerScope, dryRun bool) ([]IAMArtifact, *clioutput.Error)

ProvisionIAM is idempotent: re-running on a fully-onboarded engineer returns all "exists" actions and performs no mutation.

type PodIdentityArtifact

type PodIdentityArtifact struct {
	Kind          string // always "PodIdentityAssociation"
	AssociationID string
	RoleARN       string
	Action        string // "create" | "exists" | "would-create"
}

func EnsurePodIdentity

func EnsurePodIdentity(ctx context.Context, b PodIdentityBinding, dryRun bool) (PodIdentityArtifact, *clioutput.Error)

EnsurePodIdentity creates the seictl SA association if it doesn't exist. EKS exposes no Get-by-tuple API, so we list-then-match. A pre-existing association bound to a different role is a hard failure — silently rebinding could grant the engineer access to the wrong S3 prefix.

type PodIdentityBinding

type PodIdentityBinding struct {
	Cluster        string
	Namespace      string
	ServiceAccount string
	RoleARN        string
	Region         string
}

PodIdentityBinding identifies one Pod Identity association uniquely via the (cluster, namespace, serviceAccount) tuple, plus the role to bind. This shape mirrors EKS's natural key.

Jump to

Keyboard shortcuts

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