config

package
v0.0.1-0...-8535732 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configurability for the entire application.

Index

Constants

View Source
const (
	// ParameterRequired indicates that the parameter is required, and must be
	// provided by the user.
	ParameterRequired parameterKind = iota + 1

	// ParameterOptional indicates that the parameter is optional, and may be
	// provided by the user.
	ParameterOptional

	// ParameterHardcoded indicates that the parameter is a hardcoded constant,
	// and must not be provided by the user.
	ParameterHardcoded
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthOidcConfig

type AuthOidcConfig struct {
	// Issuer is the full URL provided by OIDC provider. An example:
	// "https://auth.stage.redhat.com/auth/realms/EmployeeIDP".
	Issuer string `json:"issuer"`

	// ClientID is the client ID for the OIDC application integration.
	ClientID string `json:"clientID"`

	// ClientSecret is the client secret for the OIDC application integration.
	ClientSecret string `json:"clientSecret"`

	// Endpoint is the server hostname with optional port used for redirecting
	// requests back from OIDC provider. An example value would be
	// "localhost:8443" or "example.com".
	Endpoint string `json:"endpoint"`

	// SessionSecret is an arbitrary string used in the signing of session
	// tokens. Changing this value would invalidate current sessions.
	SessionSecret string `json:"sessionSecret"`

	// AccessTokenClaims are the list of defined claim rules used to validate
	// access token claims provided by the OIDC Provider.
	// All claims have to be fulfilled.
	AccessTokenClaims *claimrule.ClaimRules `json:"accessTokenClaims"`

	// TokenLifeTime is the duration for which generated service account tokens
	// shall be valid.
	TokenLifetime JSONDuration `json:"tokenLifetime"`
}

AuthOidcConfig represents the configuration for integrating with OIDC provider.

type BigQueryConfig

type BigQueryConfig struct {
	CredentialsFile string `json:"credentialsFile"`
	Environment     string `json:"environment"`
	Project         string `json:"project"`
	Dataset         string `json:"dataset"`
	CreationTable   string `json:"creationTable"`
	DeletionTable   string `json:"deletionTable"`
}

BigQueryConfig represents the configuration for integrating with Google BigQuery to record cluster lifetime.

type Config

type Config struct {
	// Server is the server and TLS configuration.
	Server ServerConfig `json:"server"`

	// Server administrator password.
	Password string `json:"password"`

	// Google BigQuery integration configuration
	BigQuery *BigQueryConfig `json:"bigQuery"`

	// Slack notification configuration.
	Slack *SlackConfig `json:"slack"`
}

Config represents the top-level configuration for infra-server.

func Load

func Load(filename string) (*Config, error)

Load reads and parses the given configuration file.

type FlavorConfig

type FlavorConfig struct {
	// ID is the unique, human type-able, ID for the flavor.
	ID string `json:"id"`

	// Name is a human readable name for the flavor.
	Name string `json:"name"`

	// Description is a human readable description for the flavor.
	Description string `json:"description"`

	// Availability is an availability classification level. One of "alpha",
	// "beta", "stable", or "default". Exactly 1 default flavor must be
	// configured.
	Availability string `json:"availability"`

	// Parameters is the list of parameters required for launching this flavor.
	Parameters []parameter `json:"parameters"`

	// Artifacts is the list of artifacts produced by this flavor.
	Artifacts []artifact `json:"artifacts"`

	// WorkflowFile is the filename of an Argo workflow definition.
	WorkflowFile string `json:"workflow"`

	// Aliases are alternative IDs of the flavor.
	Aliases []string `json:"aliases"`
}

FlavorConfig represents the configuration for a single automation flavor.

type JSONDuration

type JSONDuration time.Duration

JSONDuration represents a time.Duration that is able to be (JSON) marshaled into or unmarshaled from the more human-friendly duration format.

func (JSONDuration) Duration

func (d JSONDuration) Duration() time.Duration

Duration returns the internal time.Duration value.

func (JSONDuration) MarshalJSON

func (d JSONDuration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (JSONDuration) String

func (d JSONDuration) String() string

String returns a string representing the duration in the form "72h3m0.5s".

func (*JSONDuration) UnmarshalJSON

func (d *JSONDuration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ServerConfig

type ServerConfig struct {
	Port                    int    `json:"port"`
	CertFile                string `json:"cert"`
	KeyFile                 string `json:"key"`
	StaticDir               string `json:"static"`
	MetricsPort             int    `json:"metricsPort"`
	MetricsIncludeHistogram bool   `json:"metricsIncludeHistogram"`
}

ServerConfig represents the configuration used for running the HTTP & GRPC servers, and providing TLS.

type SlackConfig

type SlackConfig struct {
	// Token is the Slack App token provisioned when an App is registered.
	Token string `json:"token"`

	// Channel is the channel ID of where to send messages.
	Channel string `json:"channel"`
}

SlackConfig represents the configuration used for sending cluster lifecycle notifications via Slack.

Jump to

Keyboard shortcuts

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