Documentation
¶
Overview ¶
Package orgsettings reconciles one GitHub organisation's Actions variables, Actions secrets and code security configurations with the typed document the organisation keeps in its own account (ADR 0080).
The package reads the document through a [Reader], checks it against the owner's ceiling with policy/tenant, and compares it with what GitHub holds. In `report` mode it says what differs and changes nothing. In `enforce` mode it applies the difference. It removes only a name it wrote itself and recorded in status.Managed, and it never holds a secret's value beyond the one call that seals it: values are not logged, not stored and not recorded in the audit trail.
Index ¶
Constants ¶
const ( ModeReport = orgconfig.ModeReport ModeEnforce = orgconfig.ModeEnforce )
The modes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AWSReader ¶
type AWSReader struct {
// contains filtered or unexported fields
}
AWSReader reads each organisation's document and secrets with the role the installation names for it. The controller's own credentials (a Lambda role, Pod Identity, the environment) are used only to assume that role.
func NewAWSReader ¶
NewAWSReader connects with the platform's credentials. It calls nothing: a role is assumed when an organisation's document is first read.
func NewAWSReaderWith ¶
func NewAWSReaderWith(configs map[string]orgconfig.Config, assume stscreds.AssumeRoleAPIClient, client ParametersFor) *AWSReader
NewAWSReaderWith is NewAWSReader with the clients given, for a test.
type Desired ¶
type Desired struct {
Variables map[string]tenant.OrgVariable
Secrets map[string]tenant.OrgSecret
Configs map[string]tenant.SecurityConfiguration
// Platform are the variables the installation sets, which the controller
// writes whatever GitHub already holds under the name.
Platform map[string]bool
}
Desired is what the organisation should hold: the platform's variables and the document's, merged and checked. Variable and secret names are keyed as GitHub keeps them, folded to upper case (tenant.FoldName).
type Input ¶
type Input struct {
Mode Mode
Target Target
Desired Desired
// Ceiling says which names the platform owns: the controller never
// removes one the installation does not set.
Ceiling tenant.OrgCeiling
// Previous is the record of what the controller wrote last time.
Previous status.Managed
Secrets Secrets
}
Input is one pass over one organisation.
type ParametersAPI ¶
type ParametersAPI interface {
GetParameter(ctx context.Context, in *awsssm.GetParameterInput, opts ...func(*awsssm.Options)) (*awsssm.GetParameterOutput, error)
}
ParametersAPI is the part of the SSM client a read calls.
type ParametersFor ¶
type ParametersFor func(creds aws.CredentialsProvider, region string) ParametersAPI
ParametersFor builds the parameter-store client of one organisation's account, from the credentials of the role assumed there.
type PassInput ¶
type PassInput struct {
Org string
Settings orgconfig.Config
// Source is nil when the organisation has no way to read its document;
// the pass then reports it unreadable.
Source Source
Target Target
// Previous is the last pass's record, or nil for the first.
Previous *status.Settings
Now time.Time
// Enabled is whether the controller acts in this organisation
// (`controllers.github.enabledOrgs`). A disabled organisation is read as
// `report` whatever its mode says: that list is the kill switch.
Enabled bool
}
PassInput is one pass over one organisation's settings.
type Result ¶
type Result struct {
Changes []status.SettingChange
Managed status.Managed
}
Result is what a pass found or did, and the record to keep.
func Reconcile ¶
Reconcile compares the desired settings with GitHub's and, in enforce mode, applies the difference. An error means GitHub could not be read, so nothing was changed; a change that GitHub refuses is a row of the result and the pass goes on.
A name GitHub holds that the controller did not write is the organisation's and not the controller's: it is reported as a conflict and never written, adopted or removed, except for the installation's own variables. A pass that would remove most of what the controller wrote removes none of it.
type Secrets ¶
type Secrets interface {
// Version is the parameter's version, read without decrypting it.
Version(ctx context.Context, parameter string) (int64, error)
// Value is the parameter's decrypted value and its version.
Value(ctx context.Context, parameter string) (string, int64, error)
}
Secrets reads the values the document's secrets refer to, from the organisation's own parameter store.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package settingstest is an organisation's own account in memory: the document and the SecureString parameters the controller reads with the role it assumes.
|
Package settingstest is an organisation's own account in memory: the document and the SecureString parameters the controller reads with the role it assumes. |