app

package
v0.0.0-...-0f4d767 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSClient

type AWSClient interface {
	Region() string
	AccountID(context.Context) (string, error)
	EnsureIssuer(context.Context, State, []byte, []byte) error
	CheckIssuerObjects(context.Context, State, []byte, []byte) error
	EnsureOIDCProvider(context.Context, State) (string, error)
	CheckOIDCProvider(context.Context, State) error
	EnsureRole(context.Context, State, Binding) (string, error)
	EnsureDemoPolicy(context.Context, State, DemoPolicyRequest) (DemoPolicyDetails, error)
	AssumeRoleWithWebIdentity(context.Context, string, string, int32) (string, error)
	DeleteDemoPolicy(context.Context, State, DemoPolicyRequest) (bool, error)
	CleanupRole(context.Context, State, Binding) (bool, error)
	CleanupProvider(context.Context, State) (bool, error)
	CleanupIssuer(context.Context, State, bool) (bool, error)
}

type AWSFactory

type AWSFactory interface {
	New(context.Context, AWSOptions) (AWSClient, error)
}

type AWSOptions

type AWSOptions struct {
	Region  string
	Profile string
}

type ActualAWSFactory

type ActualAWSFactory struct{}

func (ActualAWSFactory) New

type Binding

type Binding struct {
	Namespace      string   `json:"namespace"`
	ServiceAccount string   `json:"serviceAccount"`
	RoleName       string   `json:"roleName"`
	RoleARN        string   `json:"roleARN"`
	PolicyARNs     []string `json:"policyARNs"`
}

type DemoPolicyDetails

type DemoPolicyDetails struct {
	Status           string
	PolicyName       string
	PolicyARN        string
	AccountID        string
	RoleName         string
	DefaultVersionID string
	Document         []byte
	Tags             map[string]string
}

type DemoPolicyRequest

type DemoPolicyRequest struct {
	PolicyName string
	RoleName   string
	Document   []byte
	Tags       map[string]string
}

type KubeClient

type KubeClient interface {
	Raw(context.Context, string) ([]byte, error)
	CheckCertManager(context.Context) error
	Apply(context.Context, string) error
	WaitDeploymentAvailable(context.Context, string, string, string) error
	CheckServiceAccountPermissions(context.Context, string, string, []string, string) error
	CheckWebhookMutation(context.Context, string, string) error
	ServiceAccountExists(context.Context, string, string) (bool, error)
	CreateServiceAccount(context.Context, string, string) error
	AnnotateServiceAccount(context.Context, string, string, map[string]string) error
	RemoveServiceAccountAnnotations(context.Context, string, string, []string) error
	ServiceAccountRoleARN(context.Context, string, string) (string, error)
	CreateToken(context.Context, string, string, string, string) (string, error)
	PodExists(context.Context, string, string) (bool, error)
	RunDemoPod(context.Context, string, string, string, string, string) ([]byte, error)
	DeletePod(context.Context, string, string) error
}

type Kubectl

type Kubectl struct {
	ContextName string
}

func (Kubectl) AnnotateServiceAccount

func (k Kubectl) AnnotateServiceAccount(ctx context.Context, namespace, name string, annotations map[string]string) error

func (Kubectl) Apply

func (k Kubectl) Apply(ctx context.Context, manifest string) error

func (Kubectl) CheckCertManager

func (k Kubectl) CheckCertManager(ctx context.Context) error

func (Kubectl) CheckServiceAccountPermissions

func (k Kubectl) CheckServiceAccountPermissions(ctx context.Context, namespace, name string, verbs []string, resource string) error

func (Kubectl) CheckWebhookMutation

func (k Kubectl) CheckWebhookMutation(ctx context.Context, accountID, region string) error

func (Kubectl) CreateServiceAccount

func (k Kubectl) CreateServiceAccount(ctx context.Context, namespace, name string) error

func (Kubectl) CreateToken

func (k Kubectl) CreateToken(ctx context.Context, namespace, name, audience, duration string) (string, error)

func (Kubectl) DeletePod

func (k Kubectl) DeletePod(ctx context.Context, namespace, name string) error

func (Kubectl) PodExists

func (k Kubectl) PodExists(ctx context.Context, namespace, name string) (bool, error)

func (Kubectl) Raw

func (k Kubectl) Raw(ctx context.Context, path string) ([]byte, error)

func (Kubectl) RemoveServiceAccountAnnotations

func (k Kubectl) RemoveServiceAccountAnnotations(ctx context.Context, namespace, name string, annotations []string) error

func (Kubectl) RunDemoPod

func (k Kubectl) RunDemoPod(ctx context.Context, namespace, name, serviceAccount, region, roleName string) ([]byte, error)

func (Kubectl) ServiceAccountExists

func (k Kubectl) ServiceAccountExists(ctx context.Context, namespace, name string) (bool, error)

func (Kubectl) ServiceAccountRoleARN

func (k Kubectl) ServiceAccountRoleARN(ctx context.Context, namespace, name string) (string, error)

func (Kubectl) WaitDeploymentAvailable

func (k Kubectl) WaitDeploymentAvailable(ctx context.Context, namespace, name, timeout string) error

type Progress

type Progress interface {
	Start(step string)
	Detail(key string, value string)
	Info(key string, value string)
	Success(message string)
	Warn(message string)
	Fail(message string)
}

type Runner

type Runner struct {
	AWSFactory        AWSFactory
	KubectlFactory    func(contextName string) KubeClient
	IssuerIDGenerator func() (string, error)
	Env               func(string) string
	HomeDir           func() (string, error)
}

func NewRunner

func NewRunner() *Runner

func (*Runner) Execute

func (r *Runner) Execute(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) error

type State

type State struct {
	Name      string    `json:"name"`
	Region    string    `json:"region"`
	IssuerID  string    `json:"issuerID,omitempty"`
	Bucket    string    `json:"bucket"`
	IssuerURL string    `json:"issuerURL"`
	AccountID string    `json:"accountID"`
	Profile   string    `json:"profile,omitempty"`
	Bindings  []Binding `json:"bindings,omitempty"`
}

Jump to

Keyboard shortcuts

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