Documentation ¶
Index ¶
- Constants
- Variables
- func NewAPIServer(conf APIConfig, k8sMiddleware ...KubernetesAuth) (*echo.Echo, error)
- type APIConfig
- type APIContext
- type APIImpl
- func (s *APIImpl) CreateCluster(c echo.Context) error
- func (s *APIImpl) CreateTenant(c echo.Context) error
- func (s *APIImpl) DeleteCluster(c echo.Context, clusterID api.ClusterIdParameter) error
- func (s *APIImpl) DeleteTenant(c echo.Context, tenantID api.TenantIdParameter) error
- func (s *APIImpl) Discovery(ctx echo.Context) error
- func (s *APIImpl) Docs(ctx echo.Context) error
- func (s *APIImpl) GetCluster(c echo.Context, clusterID api.ClusterIdParameter) error
- func (s *APIImpl) GetTenant(c echo.Context, tenantID api.TenantIdParameter) error
- func (s *APIImpl) Healthz(ctx echo.Context) error
- func (s *APIImpl) InstallSteward(c echo.Context, params api.InstallStewardParams) error
- func (s *APIImpl) ListClusters(c echo.Context, p api.ListClustersParams) error
- func (s *APIImpl) ListTenants(c echo.Context) error
- func (s *APIImpl) Openapi(ctx echo.Context) error
- func (s *APIImpl) PostClusterCompileMeta(c echo.Context, clusterID api.ClusterIdParameter) error
- func (s *APIImpl) PutCluster(c echo.Context, clusterID api.ClusterIdParameter) error
- func (s *APIImpl) PutTenant(c echo.Context, tenantID api.TenantIdParameter) error
- func (s *APIImpl) QueryInventory(ctx echo.Context, params api.QueryInventoryParams) error
- func (s *APIImpl) UpdateCluster(c echo.Context, clusterID api.ClusterIdParameter) error
- func (s *APIImpl) UpdateInventory(ctx echo.Context) error
- func (s *APIImpl) UpdateTenant(c echo.Context, tenantID api.TenantIdParameter) error
- type KubernetesAuth
Constants ¶
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" )
const ( AuthScheme = "Bearer" K8sCacheSizeEnvKey = "K8S_AUTH_CLIENT_CACHE_SIZE" )
AuthScheme to be used in the Authorization header
const DefaultAPISecretRefNameEnvVar = "DEFAULT_API_SECRET_REF_NAME"
DefaultAPISecretRefNameEnvVar is the name of the env var which specifies the default APISecretRef name
Variables ¶
var DefaultKubernetesAuth = &KubernetesAuth{
CreateClientFunc: getClientFromToken,
cache: createCache(),
}
DefaultKubernetesAuth uses the JWT bearer token to authenticate
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 }
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 ¶
CreateCluster creates a new cluster
func (*APIImpl) CreateTenant ¶
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) 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) 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 ¶
ListTenants lists all tenants
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 ¶
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