ucp

package
v0.42.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

ucp holds the configuration and options types for UCP. See the packages nested inside this one for the UCP implementation.

Index

Constants

View Source
const (
	// AuthUCPCredential is the authentication method via UCP Credential API.
	AuthUCPCredential = "UCPCredential"

	// AuthDefault is the default authentication method, such as environment variables.
	AuthDefault = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Database is the configuration for the database used for resource data.
	Database databaseprovider.Options `yaml:"databaseProvider"`

	// Environment is the configuration for the hosting environment.
	Environment hostoptions.EnvironmentOptions `yaml:"environment"`

	// Identity is the configuration for authenticating with external systems like Azure and AWS.
	Identity IdentityConfig `yaml:"identity"`

	// Initialization is the configuration for initializing the UCP server.
	Initialization InitializationConfig `yaml:"initialization"`

	// Logging is the configuration for the logging system.
	Logging ucplog.LoggingOptions `yaml:"logging"`

	// Metrics is the configuration for the metrics endpoint.
	Metrics metricsservice.Options `yaml:"metricsProvider"`

	// Profiler is the configuration for the profiler endpoint.
	Profiler profilerservice.Options `yaml:"profilerProvider"`

	// Routing is the configuration for UCP routing.
	Routing RoutingConfig `yaml:"routing"`

	// Queue is the configuration for the message queue.
	Queue queueprovider.QueueProviderOptions `yaml:"queueProvider"`

	// Secrets is the configuration for the secret storage system.
	Secrets secretprovider.SecretProviderOptions `yaml:"secretProvider"`

	// Server is the configuration for the HTTP server.
	Server hostoptions.ServerOptions `yaml:"server"`

	// Tracing is the configuration for the tracing system.
	Tracing traceservice.Options `yaml:"tracerProvider"`

	// UCPConfig is the configuration for the connection to UCP.
	UCP ucpconfig.UCPOptions `yaml:"ucp"`

	// Worker is the configuration for the backend worker server.
	Worker hostoptions.WorkerServerOptions `yaml:"workerServer"`
}

Config defines the configuration for the UCP server.

For testability, all fields on this struct MUST be parsable from YAML without any further initialization required.

func LoadConfig

func LoadConfig(bs []byte) (*Config, error)

LoadConfig loads a Config from bytes.

type IdentityConfig

type IdentityConfig struct {
	// AuthMethod represents the method of authentication for authenticating with external systems like Azure and AWS.
	AuthMethod string `yaml:"authMethod"`
}

Identity represents configuration options for authenticating with external systems like Azure and AWS.

type InitializationConfig

type InitializationConfig struct {
	// Planes is a list of planes to create at startup.
	Planes []Plane `yaml:"planes,omitempty"`
}

InitializeConfig defines the configuration for initializing the UCP server.

This includes resources that are added to UCP's data on startup.

TODO: this will be generalized as part of the UDT work. Right now it only handles planes, and we need to support other kinds of resources.

type Options

type Options struct {
	// Config is the configuration for the server.
	Config *Config

	// DatabaseProvider provides access to the database used for resource data.
	DatabaseProvider *databaseprovider.DatabaseProvider

	// Modules is the list of modules to initialize. This will default to nil (implying the default set), and
	// can be overridden by tests.
	Modules []modules.Initializer

	// QueueProvider provides access to the message queue client.
	QueueProvider *queueprovider.QueueProvider

	// SecretProvider provides access to secret store used for secret data.
	SecretProvider *secretprovider.SecretProvider

	// SpecLoader is the loader for the OpenAPI spec.
	SpecLoader *validator.Loader

	// StatusManager implements operations on async operation statuses.
	StatusManager statusmanager.StatusManager

	// UCP is the connection to UCP
	UCP sdk.Connection
}

Options holds the configuration options and shared services for the UCP server.

For testability, all fields on this struct MUST be constructed from the NewOptions function without any additional initialization required.

func NewOptions

func NewOptions(ctx context.Context, config *Config) (*Options, error)

NewOptions creates a new Options instance from the given configuration.

type Plane

type Plane struct {
	// ID is the resource ID of the plane.
	ID string `json:"id" yaml:"id"`

	// Type is the resource type of the plane.
	Type string `json:"type" yaml:"type"`

	// Name is the resource name of the plane.
	Name string `json:"name" yaml:"name"`

	// Properties is the properties of the plane.
	Properties PlaneProperties `json:"properties" yaml:"properties"`
}

Plane is a configuration entry for a plane resource. This is used to create a plane resource at startup.

type PlaneProperties

type PlaneProperties struct {
	// ResourceProviders is a map of resource provider namespaces to their respective addresses.
	//
	// This is part of legacy (non-UDT) support for planes and will be removed.
	ResourceProviders map[string]string `json:"resourceProviders" yaml:"resourceProviders"`

	// Kind is the legacy UCP plane type.
	Kind string `json:"kind" yaml:"kind"`

	// URL is the downsteam URL for the plane.
	URL string `json:"url" yaml:"url"`
}

type RoutingConfig

type RoutingConfig struct {
	// DefaultDownstreamEndpoint is the default destination when a resource provider does not provide a downstream endpoint.
	// In practice, this points to the URL of dynamic-rp.
	DefaultDownstreamEndpoint string `yaml:"defaultDownstreamEndpoint"`
}

RoutingConfig provides configuration for UCP routing.

Directories

Path Synopsis
api
aws
frontend
api
aws
integrationtests contains integration tests that run UCP using an in-memory server and in-memory data stores.
integrationtests contains integration tests that run UCP using an in-memory server and in-memory data stores.
aws
aws
package aws defines utility functions and constants for working with AWS types and UCP resource IDs.
package aws defines utility functions and constants for working with AWS types and UCP resource IDs.
azure
package azure defines utility functions and constants for working with Azure types and UCP resource IDs.
package azure defines utility functions and constants for working with Azure types and UCP resource IDs.
kubernetes
package kubernetes defines utility functions and constants for working with Kubernetes types and UCP resource IDs.
package kubernetes defines utility functions and constants for working with Kubernetes types and UCP resource IDs.
radius
package radius defines utility functions and constants for working with Radius types and UCP resource IDs.
package radius defines utility functions and constants for working with Radius types and UCP resource IDs.
testhost provides an implementation of a test server for UCP.
testhost provides an implementation of a test server for UCP.
package trackedresource provides utility functionality for working with tracked resources.
package trackedresource provides utility functionality for working with tracked resources.

Jump to

Keyboard shortcuts

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