Documentation ¶
Index ¶
- Constants
- func RoundDuration(duration time.Duration) string
- type ClientConfig
- type ClientContext
- type Config
- func (c *Config) ClusterFlagSet() *flag.FlagSet
- func (c *Config) ClusterName() string
- func (c *Config) Finalize() error
- func (c *Config) KVFlagSet() *flag.FlagSet
- func (c *Config) KVKubeconfig() string
- func (c *Config) KVNamespace() string
- func (c *Config) LogFlagSet() *flag.FlagSet
- func (c *Config) Logger() *slog.Logger
- func (c *Config) NewTopLevelLogger() *slog.Logger
- func (c *Config) Printf(format string, a ...any)
- func (c *Config) Println(a ...any)
- func (c *Config) ProvisionerClientset() (kubernetes.Interface, error)
- func (c *Config) ServerFlagSet() *flag.FlagSet
- func (c *Config) Stderr() io.Writer
- func (c *Config) Stdin() io.Reader
- func (c *Config) Stdout() io.Writer
- func (c *Config) TxtarFlagSet() *flag.FlagSet
- func (c *Config) TxtarIndex() int
- func (c *Config) Vet() error
- func (c *Config) Write(p []byte)
- func (c *Config) WriteFlagSet() *flag.FlagSet
- func (c *Config) WriteTo() string
- type Option
- type ServerConfig
- func (c *ServerConfig) AuthHeader() string
- func (c *ServerConfig) DatabaseURI() string
- func (c *ServerConfig) FlagSet() *flag.FlagSet
- func (c *ServerConfig) ListenAndServe() bool
- func (c *ServerConfig) ListenPort() int
- func (c *ServerConfig) MetricsPort() int
- func (c *ServerConfig) OIDCAudiences() []string
- func (c *ServerConfig) OIDCIssuer() string
- type StringSlice
Constants ¶
const DefaultProvisionerNamespace = "secrets"
Variables ¶
This section is empty.
Functions ¶
func RoundDuration ¶ added in v0.90.0
RoundDuration rounds a duration to the nearest unit based on its length.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
// contains filtered or unexported fields
}
ClientConfig configures the holos rpc client.
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
func (*ClientConfig) FlagSet ¶
func (c *ClientConfig) FlagSet() *flag.FlagSet
func (*ClientConfig) Server ¶
func (c *ClientConfig) Server() string
type ClientContext ¶
type ClientContext struct { // OrgID is the organization id of the current context. OrgID string `json:"org_id"` // UserID is the user id of the current context. UserID string `json:"user_id"` }
ClientContext represents the context the holos api is working in. Used to store and recall values from the filesystem.
func NewClientContext ¶
func NewClientContext(ctx context.Context) *ClientContext
NewClientContext loads a ClientContext from the file system if it exists, otherwise returns a ClientContext with default values.
func (*ClientContext) Exists ¶
func (cc *ClientContext) Exists() bool
Exists returns true if the client context file exists.
type Config ¶
type Config struct { ClientConfig *ClientConfig ServerConfig *ServerConfig // contains filtered or unexported fields }
Config holds configuration for the whole program, used by main(). The config should be initialized early at a well known location in the program lifecycle then remain immutable.
func (*Config) ClusterFlagSet ¶
ClusterFlagSet returns a *flag.FlagSet wired to c *Config. Useful for commands scoped to one cluster.
func (*Config) ClusterName ¶
ClusterName returns the cluster name configured by flags.
func (*Config) Finalize ¶
Finalize validates the config and finalizes the startup lifecycle based on user configuration.
func (*Config) KVKubeconfig ¶
KVKubeconfig returns the provisioner cluster kubeconfig path.
func (*Config) KVNamespace ¶
KVNamespace returns the configured namespace to operate against in the provisioner cluster.
func (*Config) LogFlagSet ¶
LogFlagSet returns the logging *flag.FlagSet for use by the command handler.
func (*Config) Logger ¶
Logger returns a *slog.Logger configured by the user or the default logger if no logger has been configured by the user.
func (*Config) NewTopLevelLogger ¶
NewTopLevelLogger returns a *slog.Logger with a handler that filters source attributes. Useful as a top level error logger in main().
func (*Config) ProvisionerClientset ¶
func (c *Config) ProvisionerClientset() (kubernetes.Interface, error)
ProvisionerClientset returns a kubernetes client set for the provisioner cluster.
func (*Config) ServerFlagSet ¶
func (*Config) TxtarFlagSet ¶
TxtarFlagSet returns the *flag.FlagSet for txtar related commands.
func (*Config) WriteFlagSet ¶
WriteFlagSet returns a *flag.FlagSet wired to c *Config. Useful for commands that write files.
type Option ¶
type Option func(o *options)
An Option configures a Config using [functional options](https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html).
func ClusterClientset ¶
func ClusterClientset(clientset *kubernetes.Clientset) Option
ClusterClientset sets the kubernetes Clientset, useful for test fake.
func ProvisionerClientset ¶
func ProvisionerClientset(clientset kubernetes.Interface) Option
ProvisionerClientset sets the kubernetes Clientset, useful for test fake.
type ServerConfig ¶
type ServerConfig struct {
// contains filtered or unexported fields
}
func (*ServerConfig) AuthHeader ¶
func (c *ServerConfig) AuthHeader() string
func (*ServerConfig) DatabaseURI ¶
func (c *ServerConfig) DatabaseURI() string
DatabaseURI represents the database connection uri.
func (*ServerConfig) FlagSet ¶
func (c *ServerConfig) FlagSet() *flag.FlagSet
func (*ServerConfig) ListenAndServe ¶
func (c *ServerConfig) ListenAndServe() bool
ListenAndServe returns true if the server should listen for and serve requests.
func (*ServerConfig) ListenPort ¶
func (c *ServerConfig) ListenPort() int
ListenPort returns the port of the main server.
func (*ServerConfig) MetricsPort ¶
func (c *ServerConfig) MetricsPort() int
MetricsPort returns the port of the prometheus /metrics scrape endpoint configured by a flag.
func (*ServerConfig) OIDCAudiences ¶
func (c *ServerConfig) OIDCAudiences() []string
OIDCAudiences returns the configured allowed id token aud claim values.
func (*ServerConfig) OIDCIssuer ¶
func (c *ServerConfig) OIDCIssuer() string
OIDCIssuer returns the configured oidc issuer url.
type StringSlice ¶
type StringSlice []string
StringSlice represents zero or more flag values.
func (*StringSlice) Set ¶
func (i *StringSlice) Set(value string) error
Set implements the flag.Value interface.
func (*StringSlice) String ¶
func (i *StringSlice) String() string
String implements the flag.Value interface.
func (*StringSlice) Type ¶
func (i *StringSlice) Type() string
Type implements the pflag.Value interface and describes the type.