server

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MPL-2.0 Imports: 56 Imported by: 3

Documentation

Index

Constants

View Source
const (
	OctetStreamType = "application/octet-stream"
	JsonType        = "application/json"
)
View Source
const (
	AuthEnabledFeatureFlag = "WEAVE_GITOPS_AUTH_ENABLED"
)
View Source
const DefaultPort = "9001"

Variables

View Source
var (
	ErrEmptyAccessToken = errors.New("access token is empty")
	ErrBadProvider      = errors.New("wrong provider name")
)
View Source
var (
	KustomizeNameKey      = fmt.Sprintf("%s/name", kustomizev2.GroupVersion.Group)
	KustomizeNamespaceKey = fmt.Sprintf("%s/namespace", kustomizev2.GroupVersion.Group)
	HelmNameKey           = fmt.Sprintf("%s/name", helmv2.GroupVersion.Group)
	HelmNamespaceKey      = fmt.Sprintf("%s/namespace", helmv2.GroupVersion.Group)
)

Flux owner labels

Functions

func AuthEnabled added in v0.6.1

func AuthEnabled() bool

func MatchGRPCError added in v0.2.5

func MatchGRPCError(code interface{}, err interface{}) types.GomegaMatcher

func NewApplicationsServer

func NewApplicationsServer(cfg *ApplicationsConfig, setters ...ApplicationsOption) pb.ApplicationsServer

NewApplicationsServer creates a grpc Applications server

func NewHandlers added in v0.6.0

func NewHandlers(ctx context.Context, cfg *Config) (http.Handler, error)

func NewProfilesServer added in v0.6.0

func NewProfilesServer(config ProfilesConfig) pb.ProfilesServer

Types

type ApplicationsConfig added in v0.2.3

type ApplicationsConfig struct {
	Logger           logr.Logger
	Factory          services.Factory
	JwtClient        auth.JWTClient
	GithubAuthClient auth.GithubAuthClient
	FetcherFactory   FetcherFactory
	GitlabAuthClient auth.GitlabAuthClient
	ClusterConfig    ClusterConfig
}

An ApplicationsConfig allows for the customization of an ApplicationsServer. Use the DefaultConfig() to use the default dependencies.

func DefaultApplicationsConfig added in v0.6.0

func DefaultApplicationsConfig() (*ApplicationsConfig, error)

DefaultApplicationsConfig creates a populated config with the dependencies for a Server

type ApplicationsOption added in v0.6.1

type ApplicationsOption func(*ApplicationsOptions)

ApplicationsOption defines the signature of a function that can be used to set an option for an ApplicationsServer.

func WithClientGetter added in v0.6.1

func WithClientGetter(clientGetter ClientGetter) ApplicationsOption

WithClientGetter allows for setting a ClientGetter.

type ApplicationsOptions added in v0.6.1

type ApplicationsOptions struct {
	ClientGetter ClientGetter
}

ApplicationsOptions includes all the options that can be set for an ApplicationsServer.

type ClientGetter added in v0.6.1

type ClientGetter interface {
	Client(ctx context.Context) (client.Client, error)
}

ClientGetter implementations should create a Kubernetes client from a context.

type ClusterConfig added in v0.6.1

type ClusterConfig struct {
	DefaultConfig *rest.Config
	ClusterName   string
}

ClusterConfig is used to hold the default *rest.Config and the cluster name.

type Config added in v0.6.0

type Config struct {
	AppConfig      *ApplicationsConfig
	AppOptions     []ApplicationsOption
	ProfilesConfig ProfilesConfig
	AuthServer     *auth.AuthServer
}

type ConfigGetter added in v0.6.1

type ConfigGetter interface {
	Config(ctx context.Context) *rest.Config
}

ConfigGetter implementations should extract the details from a context and create a *rest.Config for use in clients.

type DefaultClientGetter added in v0.6.1

type DefaultClientGetter struct {
	// contains filtered or unexported fields
}

DefaultClientGetter implements the ClientGetter interface and uses a ConfigGetter to get a *rest.Config and create a Kubernetes client.

func (*DefaultClientGetter) Client added in v0.6.1

Client creates a new Kubernetes client using the *rest.Config returned from its ConfigGetter.

type DefaultFetcherFactory added in v0.6.1

type DefaultFetcherFactory struct {
}

DefaultFetcherFactory creates applicationv2.Fetcher objects from a Kubernetes client

func (*DefaultFetcherFactory) Create added in v0.6.1

Create uses a Kubernetes client to create an applicationv2.Fetcher object.

type FetcherFactory added in v0.6.1

type FetcherFactory interface {
	Create(client client.Client) applicationv2.Fetcher
}

FetcherFactory implementations should create applicationv2.Fetcher objects from a Kubernetes client.

func NewDefaultFetcherFactory added in v0.6.1

func NewDefaultFetcherFactory() FetcherFactory

NewDefaultFetcherFactory returns a new DefaultFetcherFactory

type ImpersonatingConfigGetter added in v0.6.1

type ImpersonatingConfigGetter struct {
	// contains filtered or unexported fields
}

ImpersonatingConfigGetter is an implementation of the ConfigGetter interface that returns configs based on a base one. It inspects the context for a principal and if it finds one, it configures the *rest.Config to impersonate that principal. Otherwise it returns a copy of the base config.

func NewImpersonatingConfigGetter added in v0.6.1

func NewImpersonatingConfigGetter(cfg *rest.Config, insecure bool) *ImpersonatingConfigGetter

NewImpersonatingConfigGetter creates and returns a ConfigGetter with a known config.

func (*ImpersonatingConfigGetter) Config added in v0.6.1

Config returns a *rest.Config configured to impersonate a user or use the default service account credentials.

type ProfilesConfig added in v0.6.0

type ProfilesConfig struct {
	// contains filtered or unexported fields
}

func NewProfilesConfig added in v0.6.0

func NewProfilesConfig(kubeClient client.Client, helmCache cache.Cache, helmRepoNamespace, helmRepoName string) ProfilesConfig

type ProfilesServer added in v0.6.0

type ProfilesServer struct {
	pb.UnimplementedProfilesServer

	KubeClient        client.Client
	Log               logr.Logger
	HelmRepoName      string
	HelmRepoNamespace string
	HelmCache         cache.Cache
}

func (*ProfilesServer) GetProfileValues added in v0.6.0

func (s *ProfilesServer) GetProfileValues(ctx context.Context, msg *pb.GetProfileValuesRequest) (*httpbody.HttpBody, error)

func (*ProfilesServer) GetProfiles added in v0.6.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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