service

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-3-Clause Imports: 32 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// LieutenantInstanceFact defines the name of the fact which specifies the Lieutenant instance
	// a cluster was created on
	LieutenantInstanceFact = "lieutenant-instance"

	// LieutenantInstanceFactEnvVar is the env var name that's used to get the instance name
	LieutenantInstanceFactEnvVar = "LIEUTENANT_INSTANCE"
)
View Source
const (
	AuthScheme         = "Bearer"
	K8sCacheSizeEnvKey = "K8S_AUTH_CLIENT_CACHE_SIZE"
)

AuthScheme to be used in the Authorization header

View Source
const DefaultAPISecretRefNameEnvVar = "DEFAULT_API_SECRET_REF_NAME"

DefaultAPISecretRefNameEnvVar is the name of the env var which specifies the default APISecretRef name

Variables

View Source
var DefaultKubernetesAuth = &KubernetesAuth{
	CreateClientFunc: getClientFromToken,
	cache:            createCache(),
}

DefaultKubernetesAuth uses the JWT bearer token to authenticate

View Source
var (
	ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")
)

Functions

func NewAPIServer

func NewAPIServer(conf APIConfig, k8sMiddleware ...KubernetesAuth) (*echo.Echo, error)

NewAPIServer instantiates a new Echo API server

Types

type APIConfig added in v0.9.0

type APIConfig struct {
	APIVersion string

	Namespace string

	OidcDiscoveryURL string
	OidcCLientID     string

	VaultAddr        string
	VaultLoginMethod string
}

APIConfig holds the config options for the API

type APIContext

type APIContext struct {
	echo.Context
	// contains filtered or unexported fields
}

APIContext is a custom echo context

type APIImpl

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

APIImpl implements the API interface

func (*APIImpl) CreateCluster

func (s *APIImpl) CreateCluster(c echo.Context) error

CreateCluster creates a new cluster

func (*APIImpl) CreateTenant

func (s *APIImpl) CreateTenant(c echo.Context) error

CreateTenant creates a new tenant

func (*APIImpl) DeleteCluster

func (s *APIImpl) DeleteCluster(c echo.Context, clusterID api.ClusterIdParameter) error

DeleteCluster deletes a cluster

func (*APIImpl) DeleteTenant

func (s *APIImpl) DeleteTenant(c echo.Context, tenantID api.TenantIdParameter) error

DeleteTenant deletes a tenant

func (*APIImpl) Discovery added in v0.9.0

func (s *APIImpl) Discovery(ctx echo.Context) error

Discovery implements the API dicovery endpoint

func (*APIImpl) Docs added in v0.1.2

func (s *APIImpl) Docs(ctx echo.Context) error

Docs serves the swagger UI

func (*APIImpl) GetCluster

func (s *APIImpl) GetCluster(c echo.Context, clusterID api.ClusterIdParameter) error

GetCluster gets a cluster

func (*APIImpl) GetTenant

func (s *APIImpl) GetTenant(c echo.Context, tenantID api.TenantIdParameter) error

GetTenant gets a tenant

func (*APIImpl) Healthz

func (s *APIImpl) Healthz(ctx echo.Context) error

Healthz implements the API health check

func (*APIImpl) InstallSteward

func (s *APIImpl) InstallSteward(c echo.Context, params api.InstallStewardParams) error

InstallSteward returns the JSON to install Steward on a cluster

func (*APIImpl) ListClusters

func (s *APIImpl) ListClusters(c echo.Context, p api.ListClustersParams) error

ListClusters lists all clusters

func (*APIImpl) ListTenants

func (s *APIImpl) ListTenants(c echo.Context) error

ListTenants lists all tenants

func (*APIImpl) Openapi added in v0.1.2

func (s *APIImpl) Openapi(ctx echo.Context) error

Openapi serves the JSON spec

func (*APIImpl) PostClusterCompileMeta added in v0.12.0

func (s *APIImpl) PostClusterCompileMeta(c echo.Context, clusterID api.ClusterIdParameter) error

PostClusterCompileMeta compiles the meta data of a cluster

func (*APIImpl) PutCluster added in v0.8.0

func (s *APIImpl) PutCluster(c echo.Context, clusterID api.ClusterIdParameter) error

PutCluster updates the cluster or cleates it if it does not exist

func (*APIImpl) PutTenant added in v0.8.0

func (s *APIImpl) PutTenant(c echo.Context, tenantID api.TenantIdParameter) error

PutTenant udpates or creates a tenant

func (*APIImpl) QueryInventory

func (s *APIImpl) QueryInventory(ctx echo.Context, params api.QueryInventoryParams) error

QueryInventory queries the inventory

func (*APIImpl) UpdateCluster

func (s *APIImpl) UpdateCluster(c echo.Context, clusterID api.ClusterIdParameter) error

UpdateCluster updates a cluster

func (*APIImpl) UpdateInventory

func (s *APIImpl) UpdateInventory(ctx echo.Context) error

UpdateInventory updates an inventory entry

func (*APIImpl) UpdateTenant

func (s *APIImpl) UpdateTenant(c echo.Context, tenantID api.TenantIdParameter) error

UpdateTenant udpates a tenant

type KubernetesAuth

type KubernetesAuth struct {
	CreateClientFunc func(string) (client.Client, error)
	// contains filtered or unexported fields
}

KubernetesAuth provides middleware to authenticate with Kubernetes JWT tokens

func (*KubernetesAuth) JWTAuth

func (k *KubernetesAuth) JWTAuth(next echo.HandlerFunc) echo.HandlerFunc

JWTAuth makes sure a JWT bearer token is provided and creates a Kubernetes client

Jump to

Keyboard shortcuts

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