Documentation
¶
Index ¶
- func Merge(configFiles []string, conflictError bool) ([]byte, error)
- func ReflectSchema() ([]byte, error)
- func Validate(data []byte) error
- type AmazonRDS
- type AmazonS3
- type AzureBlobStorage
- type Bundle
- type BundleStatus
- type ClientSecret
- type CounterConfig
- type Database
- type Datasource
- type Datasources
- type Duration
- type FileSystemStorage
- type Files
- type GCPCloudStorage
- type Git
- type GitRequirement
- type GitSyncMetrics
- type HTTPMetrics
- type HistogramConfig
- type Labels
- type Metadata
- type MetricsConfig
- type ObjectStorage
- type Optimization
- type Options
- type Requirement
- type Requirements
- type Root
- func (r *Root) SetSQLitePersistentByDefault(persistenceDir string) bool
- func (r *Root) SortedBundles() iter.Seq2[int, *Bundle]
- func (r *Root) SortedSecrets() iter.Seq2[int, *Secret]
- func (r *Root) SortedStacks() iter.Seq2[int, *Stack]
- func (r *Root) TopologicalSortedSources() ([]*Source, error)
- func (r *Root) Unmarshal() error
- func (r *Root) UnmarshalJSON(bs []byte) error
- func (r *Root) UnmarshalYAML(bs []byte) error
- type SQLDatabase
- type Scope
- type Secret
- func (s *Secret) Equal(other *Secret) bool
- func (s *Secret) MarshalJSON() ([]byte, error)
- func (s *Secret) MarshalYAML() (any, error)
- func (s *Secret) Ref() *SecretRef
- func (s *Secret) Typed(context.Context) (any, error)
- func (s *Secret) UnmarshalJSON(bs []byte) error
- func (s *Secret) UnmarshalYAML(bs []byte) error
- type SecretAPIKey
- type SecretAWS
- type SecretAzure
- type SecretBasicAuth
- type SecretGCP
- type SecretGitHubApp
- type SecretOIDCClientCredentials
- type SecretPassword
- type SecretRef
- type SecretSSHKey
- type SecretTLSCert
- type SecretTokenAuth
- type Selector
- func (s Selector) Equal(other Selector) bool
- func (s *Selector) Get(key string) ([]string, bool)
- func (s *Selector) Keys() []string
- func (s *Selector) Len() int
- func (s Selector) MarshalJSON() ([]byte, error)
- func (s Selector) MarshalYAML() (any, error)
- func (s *Selector) Matches(labels Labels) bool
- func (*Selector) PrepareJSONSchema(schema *schemareflector.Schema) error
- func (s *Selector) PtrEqual(other *Selector) bool
- func (s *Selector) PtrMatches(labels Labels) bool
- func (s *Selector) Set(key string, value []string) error
- func (s *Selector) UnmarshalJSON(bs []byte) error
- func (s *Selector) UnmarshalYAML(bs []byte) error
- type Service
- type Source
- type Sources
- type Stack
- type Stacks
- type StringSet
- type Token
- type TokenSecret
- type WorkerMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReflectSchema ¶
Types ¶
type AmazonRDS ¶
type AmazonRDS struct {
Region string `json:"region"`
Endpoint string `json:"endpoint"` // hostname:port
Driver string `json:"driver"` // mysql or postgres
DatabaseUser string `json:"database_user"`
DatabaseName string `json:"database_name"`
DSN string `json:"dsn"`
Credentials *SecretRef `json:"credentials,omitempty"`
// RootCertificates points to PEM-encoded root certificate bundle file. If empty, the default system
// root CA certificates are used. For RDS, you can download the appropriate bundle for your region
// from here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions
RootCertificates string `json:"root_certificates,omitempty"`
// contains filtered or unexported fields
}
type AmazonS3 ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type AzureBlobStorage ¶
type AzureBlobStorage = extconfig.AzureBlobStorage
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Bundle ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type BundleStatus ¶ added in v0.6.0
type BundleStatus = extconfig.BundleStatus
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type ClientSecret ¶ added in v0.3.0
ClientSecret is the shared type of those secrets that can become effective by returning a properly set-up *http.Client. Note that this is not used everywhere yet, only for a those supported in the HTTP datasource.
type CounterConfig ¶ added in v0.7.0
type CounterConfig struct {
Enabled *bool `json:"enabled,omitempty"`
// contains filtered or unexported fields
}
CounterConfig configures a Prometheus counter metric.
type Database ¶
type Database struct {
SQL *SQLDatabase `json:"sql,omitempty"`
AWSRDS *AmazonRDS `json:"aws_rds,omitempty"`
// contains filtered or unexported fields
}
func DatabaseFromPublic ¶ added in v0.7.0
func DatabaseFromPublic(cfg *extconfig.DatabaseConfig) *Database
DatabaseFromPublic converts the public DatabaseConfig to the internal Database config.
type Datasource ¶
type Datasource = extconfig.Datasource
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Datasources ¶
type Datasources = extconfig.Datasources
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Duration ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type FileSystemStorage ¶
type FileSystemStorage = extconfig.FileSystemStorage
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Files ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type GCPCloudStorage ¶
type GCPCloudStorage = extconfig.GCPCloudStorage
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Git ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type GitRequirement ¶
type GitRequirement = extconfig.GitRequirement
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type GitSyncMetrics ¶ added in v0.7.0
type GitSyncMetrics struct {
Enabled *bool `json:"enabled,omitempty"`
GitSyncDuration *HistogramConfig `json:"git_sync_duration,omitempty"`
GitSyncCount *CounterConfig `json:"git_sync_count,omitempty"`
// contains filtered or unexported fields
}
GitSyncMetrics configures git synchronization metrics.
func (*GitSyncMetrics) GetCountEnabled ¶ added in v0.7.0
func (g *GitSyncMetrics) GetCountEnabled() *bool
GetCountEnabled returns the Enabled pointer from the counter config, or nil if the receiver is nil.
type HTTPMetrics ¶ added in v0.7.0
type HTTPMetrics struct {
Enabled *bool `json:"enabled,omitempty"`
RequestDuration *HistogramConfig `json:"request_duration,omitempty"`
// contains filtered or unexported fields
}
HTTPMetrics configures HTTP request metrics.
type HistogramConfig ¶ added in v0.7.0
type HistogramConfig struct {
BucketsSeconds []float64 `json:"buckets_seconds,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// contains filtered or unexported fields
}
HistogramConfig configures a Prometheus histogram metric.
func (*HistogramConfig) GetBuckets ¶ added in v0.7.0
func (h *HistogramConfig) GetBuckets() []float64
GetBuckets returns the configured buckets, or nil if the receiver is nil.
type Labels ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Metadata ¶
type Metadata struct {
ExportedFrom string `json:"exported_from"`
ExportedAt string `json:"exported_at"`
// contains filtered or unexported fields
}
Metadata contains metadata about the configuration file itself. This information is not stored in the database and is only used by the migration tooling.
type MetricsConfig ¶ added in v0.7.0
type MetricsConfig struct {
Enabled *bool `json:"enabled,omitempty"`
HTTP *HTTPMetrics `json:"http,omitempty"`
GitSync *GitSyncMetrics `json:"gitsync,omitempty"`
Worker *WorkerMetrics `json:"worker,omitempty"`
// contains filtered or unexported fields
}
MetricsConfig configures Prometheus metrics collection.
type ObjectStorage ¶
type ObjectStorage = extconfig.ObjectStorage
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Optimization ¶ added in v0.6.0
type Optimization = extconfig.Optimization
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Options ¶ added in v0.2.0
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Requirement ¶
type Requirement = extconfig.Requirement
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Requirements ¶
type Requirements = extconfig.Requirements
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Root ¶
type Root struct {
Metadata Metadata `json:"metadata"`
Bundles map[string]*Bundle `json:"bundles,omitempty"`
Stacks map[string]*Stack `json:"stacks,omitempty"`
Sources map[string]*Source `json:"sources,omitempty"`
Secrets map[string]*Secret `json:"secrets,omitempty"` // Schema validation overrides Secret to object type.
Tokens map[string]*Token `json:"tokens,omitempty"`
Database *Database `json:"database,omitempty"`
Service *Service `json:"service,omitempty"`
Metrics *MetricsConfig `json:"metrics,omitempty"`
// contains filtered or unexported fields
}
Root is the top-level configuration structure used by OPA Control Plane.
func (*Root) SetSQLitePersistentByDefault ¶
SetSQLitePersistentByDefault sets the database configuration to use a SQLite database stored in the given persistence directory if no other database configuration exists. This is used for the 'run' command to change its default behavior from other commands.
func (*Root) TopologicalSortedSources ¶
Returns sources from the configuration ordered by requirements. Cycles are treated as errors. Missing requirements are ignored.
func (*Root) UnmarshalJSON ¶
func (*Root) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Marshaler interface for the Root struct. This lets us define OPA Control Plane resources in a more user-friendly way with mappings where keys are the resource names. It is also used to inject the secret store into each secret reference so that internal callers can resolve secret values as needed.
type SQLDatabase ¶
type Scope ¶
type Scope struct {
Role string `json:"role" enum:"administrator,viewer,owner,stack_owner"`
}
type Secret ¶
Secret defines the configuration for secrets/tokens used by OPA Control Plane for Git synchronization, datasources, etc.
Each secret is stored as a map of key-value pairs, where the keys and values are strings. Secret type is also declared in the config. For example, a secret for basic HTTP authentication might look like this (in YAML):
my_secret:
type: basic_auth username: myuser password: mypassword
Secrets may also refer to environment variables using the ${VAR_NAME} syntax. For example:
my_secret:
type: aws_auth
access_key_id: ${AWS_ACCESS_KEY_ID}
secret_access_key: ${AWS_SECRET_ACCESS_KEY}
session_token: ${AWS_SESSION_TOKEN}
In this case, the actual values for username and password will be read from the environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN.
Currently the following secret types are supported:
- "aws_auth" for AWS authentication. Values for keys "access_key_id", "secret_access_key", and optional "session_token" are expected.
- "azure_auth" for Azure authentication. Values for keys "account_name" and "account_key" are expected.
- "basic_auth" for HTTP basic authentication. Values for keys "username" and "password" are expected. "headers" (string array) is optional and can be used to set additional headers for the HTTP requests (currently only supported for git).
- "oidc_client_credentials" for OIDC Client Credentials flow. Values for either `issuer` OR `token_url`, and `client_id`, and `client_secret` are expected, `scopes` are optional (currently only supported for HTTP datasource).
- "gcp_auth" for Google Cloud authentication. Value for a key "api_key" or "credentials" is expected.
- "github_app_auth" for GitHub App authentication. Values for keys "integration_id", "installation_id", and "private_key" are expected.
- "password" for password authentication. Value for key "password" is expected.
- "ssh_key" for SSH private key authentication. Value for key "key" (private key) is expected. "fingerprints" (string array) and "passphrase" are optional.
- "token_auth" for HTTP bearer token authentication. Value for a key "token" is expected.
func (*Secret) MarshalJSON ¶
func (*Secret) MarshalYAML ¶
func (*Secret) UnmarshalJSON ¶
func (*Secret) UnmarshalYAML ¶
type SecretAPIKey ¶ added in v0.5.0
type SecretAPIKey struct {
Key string `json:"key"` // Header name or query param name (e.g., "X-API-Key")
Value string `json:"value"` // The API key value
In string `json:"in"` // Where to send the key: "header" or "query" (default: "header")
}
SecretAPIKey represents API key authentication for HTTP requests. The key can be sent via header or query parameter.
type SecretAzure ¶
type SecretBasicAuth ¶
type SecretGitHubApp ¶
type SecretOIDCClientCredentials ¶ added in v0.3.0
type SecretOIDCClientCredentials struct {
Issuer string `json:"issuer"` // OIDC issuer URL for automatic discovery (required if TokenURL is not provided)
TokenURL string `json:"token_endpoint"` // Explicit token endpoint URL (optional if Issuer is provided)
ClientID string `json:"client_id"` // OAuth2 client ID (required)
ClientSecret string `json:"client_secret"` // OAuth2 client secret (required)
Scopes []string `json:"scopes,omitempty"` // Optional OAuth2 scopes
}
SecretOIDCClientCredentials represents OIDC Client Credentials flow configuration. It supports both explicit token endpoint configuration and automatic discovery via issuer.
func (*SecretOIDCClientCredentials) Client ¶ added in v0.3.0
Client returns an HTTP client configured with OIDC Client Credentials flow authentication. The returned client automatically handles token acquisition and refresh.
func (*SecretOIDCClientCredentials) Token ¶ added in v0.4.0
func (value *SecretOIDCClientCredentials) Token(ctx context.Context) (string, error)
Token obtains and returns an access token using OIDC Client Credentials flow. This method is useful when you need just the token string rather than a configured HTTP client.
type SecretPassword ¶
type SecretPassword struct {
Password string `json:"password"` // Password for authentication.
}
type SecretRef ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type SecretSSHKey ¶
type SecretTLSCert ¶ added in v0.2.0
type SecretTLSCert struct {
RootCA string `json:"root_ca"` // Root CA certificate (PEM encoded)
TLSCert string `json:"tls_cert"` // TLS certificate (PEM encoded)
TLSKey string `json:"tls_key"` // TLS key (PEM encoded)
}
type SecretTokenAuth ¶
type SecretTokenAuth struct {
BearerToken string `json:"token"` // Bearer token for HTTP authentication.
}
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
func MustNewSelector ¶
func (Selector) MarshalJSON ¶
func (Selector) MarshalYAML ¶
func (*Selector) Matches ¶
Matches checks if the given labels match the selector. Empty selector value matches any label value
func (*Selector) PrepareJSONSchema ¶
func (*Selector) PrepareJSONSchema(schema *schemareflector.Schema) error
func (*Selector) PtrMatches ¶
func (*Selector) UnmarshalJSON ¶
func (*Selector) UnmarshalYAML ¶
type Service ¶
type Service struct {
// ApiPrefix prefixes all endpoints (including health and metrics) with its value. It is important to start with `/` and not end with `/`.
// For example `/my/path` will make health endpoint be accessible under `/my/path/health`
ApiPrefix string `json:"api_prefix,omitempty" pattern:"^/([^/].*[^/])?$"`
// contains filtered or unexported fields
}
type Source ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Sources ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Stack ¶
type Stack struct {
Name string `json:"name"`
Selector Selector `json:"selector"` // Schema validation overrides Selector to object of string array values.
ExcludeSelector *Selector `json:"exclude_selector,omitempty"`
Requirements Requirements `json:"requirements,omitempty"`
// contains filtered or unexported fields
}
Stack defines the configuration for an OPA Control Plane Stack.
type StringSet ¶
Type aliases for types now defined in pkg/config. These allow internal code to continue using the short names (e.g. config.Bundle) while the canonical definitions live in the public package.
type Token ¶
type Token struct {
Name string `json:"-"`
APIKey string `json:"api_key"`
Scopes []Scope `json:"scopes"`
// contains filtered or unexported fields
}
Token represents an API token to access the OPA Control Plane APIs.
type TokenSecret ¶ added in v0.4.0
TokenSecret is the shared type of those secrets that can become effective by returning a bearer token string. This is used for token-based authentication in various contexts like git repositories and HTTP requests.
type WorkerMetrics ¶ added in v0.7.0
type WorkerMetrics struct {
Enabled *bool `json:"enabled,omitempty"`
BundleBuildDuration *HistogramConfig `json:"bundle_build_duration,omitempty"`
BundleBuildCount *CounterConfig `json:"bundle_build_count,omitempty"`
// contains filtered or unexported fields
}
WorkerMetrics configures bundle build metrics.
func (*WorkerMetrics) GetCountEnabled ¶ added in v0.7.0
func (w *WorkerMetrics) GetCountEnabled() *bool
GetCountEnabled returns the Enabled pointer from the counter config, or nil if the receiver is nil.