app

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 95 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionSSOStateKey    = "sso_state"
	SessionSSOStateLength = 16
)
View Source
const (

	// assumes ui is running in-cluster
	DefaultPrometheusEndpoint = "http://prometheus:9090"
	DefaultSessionExpiration  = 72 * time.Hour
	DefaultServerAddress      = "127.0.0.1:8000"
)
View Source
const (
	// APIVersion of the app
	APIVersion = "1"
)

Variables

View Source
var (
	// Version of the app - usually injected during build
	Version = "dev"

	DefaultGracePeriodSeconds = int64(0)
	DefaultPropagationPolicy  = metav1.DeletePropagationBackground

	// DefaultDeleteOptions are the options used for deleting Kubernetes
	// resourcess in most typical cases
	DefaultDeleteOptions = metav1.DeleteOptions{
		GracePeriodSeconds: &DefaultGracePeriodSeconds,
		PropagationPolicy:  &DefaultPropagationPolicy,
		DryRun:             []string{},
	}
)

Functions

func CSRFWithConfig

func CSRFWithConfig(key []byte, config middleware.CSRFConfig) echo.MiddlewareFunc

CSRFWithConfig returns a CSRF middleware with config. See `CSRF()`.

func CreateUser

func CreateUser(ctx context.Context, cli client.Client, u v1alpha1.UserTemplate, mut ...func(*v1alpha1.UserRequest)) (*v1alpha1.UserRequest, error)

createUser creates the UserRequest CRD

func CreateUserPassword

func CreateUserPassword(ctx context.Context, cli client.Client, u *v1alpha1.UserRequest, password string) error

createUserPassword creates the User password Secret

func User

func User(c echo.Context) *v1alpha1.User

User returns the session user context

func UserOwnerReference

func UserOwnerReference(u *v1alpha1.UserRequest) metav1.OwnerReference

Types

type Claims

type Claims struct {
	User *v1alpha1.User `json:"user"`
	jwt.StandardClaims
}

type Config

type Config struct {
	KubeConfig            *rest.Config
	Scheme                *runtime.Scheme
	Debug                 bool          `env:"debug"`
	InCluster             bool          `env:"in_cluster"`
	PrometheusEndpoint    string        `env:"prometheus_endpoint"`
	SessionCookieName     string        `env:"session_cookie_name"`
	SessionKey            string        `env:"session_key"`
	SessionExpiration     time.Duration `env:"session_expiration"`
	MarketplaceNoAppsMsg  string        `env:"marketplace_no_apps_msg"`
	MarketplaceNoAppsLink string        `env:"marketplace_no_apps_link"`
	MarketplaceContact    string        `env:"marketplace_contact"`
	DisablePProf          bool          `env:"disable_pprof"`
	AssetsDir             string        `env:"assets_dir"`
	Address               string        `env:"address"`
	CertFile              string        `env:"cert_file"`
	KeyFile               string        `env:"key_file"`
}

func (*Config) FromEnv

func (c *Config) FromEnv() error

type Controller

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

Controller contains state for API request handlers

func New

func New(config Config) (*Controller, error)

func (*Controller) AppsDelete

func (x *Controller) AppsDelete(c echo.Context) error

AppsDelete - endpoint for deleting appspec deployment

func (*Controller) AppsDeploy

func (x *Controller) AppsDeploy(c echo.Context) error

AppsDeploy - route for deploying an app from the marketplace

func (*Controller) AppsUpdate

func (x *Controller) AppsUpdate(c echo.Context) error

AppsUpdate - endpoint for updating an app from marketplace

func (*Controller) CanUser

func (x *Controller) CanUser(verb, res string) echo.MiddlewareFunc

func (*Controller) CanUserNS

func (x *Controller) CanUserNS(verb, res, ns string) echo.MiddlewareFunc

func (*Controller) CheckUserAccess

func (x *Controller) CheckUserAccess(u *v1alpha1.User, ns, verb string, gvr schema.GroupResource) (bool, error)

func (*Controller) CheckUserClusterAccess

func (x *Controller) CheckUserClusterAccess(u *v1alpha1.User, verb string, gvr schema.GroupResource) (bool, error)

func (*Controller) ContainerStatus

func (x *Controller) ContainerStatus(c echo.Context) error

Container route

func (*Controller) ContainersListAll

func (x *Controller) ContainersListAll(c echo.Context) error

Containers route

func (*Controller) CreateKeyPair

func (x *Controller) CreateKeyPair(c echo.Context) error

func (*Controller) CreateStackAppFromNamespace

func (x *Controller) CreateStackAppFromNamespace(c echo.Context) error

func (*Controller) DexProxy

func (x *Controller) DexProxy(c echo.Context) error

func (*Controller) ExportStackApp

func (x *Controller) ExportStackApp(c echo.Context) error

func (*Controller) GenericCreate

func (x *Controller) GenericCreate(c echo.Context) error

func (*Controller) GenericDelete

func (x *Controller) GenericDelete(c echo.Context) error

func (*Controller) GenericDeleteAll

func (x *Controller) GenericDeleteAll(c echo.Context) error

func (*Controller) GenericDeleteSelected

func (x *Controller) GenericDeleteSelected(c echo.Context) error

func (*Controller) GenericGet

func (x *Controller) GenericGet(c echo.Context) error

func (*Controller) GenericListAll

func (x *Controller) GenericListAll(c echo.Context) error

func (*Controller) GenericPatch

func (x *Controller) GenericPatch(c echo.Context) error

func (*Controller) GenericUpdate

func (x *Controller) GenericUpdate(c echo.Context) error

func (*Controller) GetSSOConfig

func (x *Controller) GetSSOConfig(k kubernetes.Interface) (sso.Config, error)

func (*Controller) GetUserKubeConfig

func (x *Controller) GetUserKubeConfig(c echo.Context) error

func (*Controller) GetUserKubeConfigCallback

func (x *Controller) GetUserKubeConfigCallback(c echo.Context) error

func (*Controller) ImpersonationClient

func (x *Controller) ImpersonationClient(next echo.HandlerFunc) echo.HandlerFunc

func (*Controller) KubeProxy

func (x *Controller) KubeProxy(c echo.Context) error

KubeProxy will proxy all websocket connections between the server and kubernetes.

func (*Controller) KubeWebSocketConnect

func (x *Controller) KubeWebSocketConnect(ctx context.Context, user *usersv1alpha1.User, origin, wsPath, wsProtocol string) (*websocket.Conn, error)

KubeWebSocketConnect is used to communicate with the k8s apiserver

func (*Controller) ListGroupRoles

func (x *Controller) ListGroupRoles(c echo.Context) error

func (*Controller) ListMyAccess

func (x *Controller) ListMyAccess(c echo.Context) error

func (*Controller) ListNamespaceResources

func (x *Controller) ListNamespaceResources(c echo.Context) error

func (*Controller) ListUserAccess

func (x *Controller) ListUserAccess(c echo.Context) error

func (*Controller) ListUserNamespaces

func (x *Controller) ListUserNamespaces(ctx context.Context, k kubernetes.Interface) ([]corev1.Namespace, error)

func (*Controller) ListUserRoles

func (x *Controller) ListUserRoles(c echo.Context) error

func (*Controller) ListUsers

func (x *Controller) ListUsers(c echo.Context) error

func (*Controller) Login

func (x *Controller) Login(c echo.Context) error

Login route

func (*Controller) Logout

func (x *Controller) Logout(c echo.Context) error

TODO(ktravis): check for sso, and log out "officially"

func (*Controller) MachinesCreate

func (x *Controller) MachinesCreate(c echo.Context) error

func (*Controller) MachinesListAll

func (x *Controller) MachinesListAll(c echo.Context) error

func (*Controller) MachinesSchema

func (x *Controller) MachinesSchema(c echo.Context) error

func (*Controller) MarketplaceAppDetail

func (x *Controller) MarketplaceAppDetail(c echo.Context) error

func (*Controller) MarketplaceAppsListAll

func (x *Controller) MarketplaceAppsListAll(c echo.Context) error

MarkeplaceApps returns all applications in the cluster catalog optionally filtered by category or source

func (*Controller) MustUser

func (x *Controller) MustUser(next echo.HandlerFunc) echo.HandlerFunc

func (*Controller) NamespaceUsers

func (x *Controller) NamespaceUsers(c echo.Context) error

NamespaceUsers returns a list of users that belong to a given namespace

func (*Controller) NodeMetrics

func (x *Controller) NodeMetrics(c echo.Context) error

NodeMetrics returns usage metrics for the provided node and metrics type.

func (*Controller) PodMetrics

func (x *Controller) PodMetrics(c echo.Context) error

PodMetrics returns usage metrics for the provided pod/container and metrics type.

func (*Controller) ProxyRun

func (x *Controller) ProxyRun(proxy string, client, server *websocket.Conn) error

ProxyRun will handle all input/output for websocket connections

func (*Controller) RBACCheckAccess

func (x *Controller) RBACCheckAccess(c echo.Context) error

func (*Controller) ReleaseSecret

func (x *Controller) ReleaseSecret(c echo.Context) error

func (*Controller) ResetPassword

func (x *Controller) ResetPassword(c echo.Context) error

ResetPassword allows a super admin or admin to reset a users password.

func (*Controller) Run

func (x *Controller) Run(ctx context.Context) error

func (*Controller) SSOCallback

func (x *Controller) SSOCallback(c echo.Context) error

func (*Controller) SSOLoginRedirect

func (x *Controller) SSOLoginRedirect(c echo.Context) error

SSOLoginRedirect redirects the client to the appropriate URL for an SSO login

func (*Controller) SSOSettingDelete

func (x *Controller) SSOSettingDelete(c echo.Context) error

SSOSettingDelete clears the sso-config configmap

func (*Controller) SSOSettingGet

func (x *Controller) SSOSettingGet(c echo.Context) error

SSOSettingGet displays the current settings

func (*Controller) SSOSettingUpdate

func (x *Controller) SSOSettingUpdate(c echo.Context) error

SSOSettingUpdate is for admin user to update the configurations

func (*Controller) SSOStatus

func (x *Controller) SSOStatus(c echo.Context) error

SSOStatus returns configuration information for the current SSO provider, if present. Used by frontend code to control the login screen.

func (*Controller) SecretsKubeconfig

func (x *Controller) SecretsKubeconfig(c echo.Context) error

SecretsKubeconfig endpoint

func (*Controller) SelfSubjectRulesReview

func (x *Controller) SelfSubjectRulesReview(k kubernetes.Interface, ns string) ([]authorizationv1.ResourceRule, error)

func (*Controller) ServerGroupsAndResources

func (x *Controller) ServerGroupsAndResources(ctx context.Context) ([]*metav1.APIGroup, []*metav1.APIResourceList, error)

func (*Controller) ServerPreferredResources

func (x *Controller) ServerPreferredResources(ctx context.Context) ([]*metav1.APIResourceList, error)

func (*Controller) ServerResources

func (x *Controller) ServerResources(ctx context.Context) ([]*metav1.APIResourceList, error)

func (*Controller) ServerResourcesForGroupVersion

func (x *Controller) ServerResourcesForGroupVersion(ctx context.Context, groupVersion string) (*metav1.APIResourceList, error)

func (*Controller) SetDefaultDexConnector

func (x *Controller) SetDefaultDexConnector(c echo.Context) error

func (*Controller) UIConfigHandler

func (x *Controller) UIConfigHandler(c echo.Context) error

UIConfigHandler returns an overall cluster config JSON object to expose knowledge of feature gates to the UI

func (*Controller) UpdateDefaultNamespace

func (x *Controller) UpdateDefaultNamespace(c echo.Context) error

UpdateDefaultNamespace will change the user's default namespace

func (*Controller) UpdateDexConnector

func (x *Controller) UpdateDexConnector(c echo.Context) error

func (*Controller) UpdateSSOConfig

func (x *Controller) UpdateSSOConfig(k kubernetes.Interface, conf sso.Config) error

func (*Controller) UploadAvatar

func (x *Controller) UploadAvatar(c echo.Context) error

UploadAvatar will resize and save a new user avatar

func (*Controller) UploadFiles

func (x *Controller) UploadFiles(c echo.Context) error

func (*Controller) UploadSigningKey

func (x *Controller) UploadSigningKey(c echo.Context) error

func (*Controller) UserAdd

func (x *Controller) UserAdd(c echo.Context) error

UserAdd adds a new user to the system

func (*Controller) UserChangePassword

func (x *Controller) UserChangePassword(c echo.Context) error

UserChangePassword will update the users password if the current password is valid

func (*Controller) UserClient

func (x *Controller) UserClient(c echo.Context) kubernetes.Interface

func (*Controller) UserShell

func (x *Controller) UserShell(c echo.Context) error

func (*Controller) WatchNamespaceResources

func (x *Controller) WatchNamespaceResources(c echo.Context) error

type DeleteSelectedOptions

type DeleteSelectedOptions struct {
	All           bool
	Items         []string
	DeleteOptions *metav1.DeleteOptions
	ListOptions   metav1.ListOptions
}

DeleteSelectedOptions is used to delete selected items from a table

type InformerCaches

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

type Map

type Map = map[string]interface{}

type Metric

type Metric struct {
	Timestamp time.Time `json:"timestamp"`
	Value     string    `json:"value"`
}

func (*Metric) MarshalJSON

func (m *Metric) MarshalJSON() ([]byte, error)

type WebsocketAction

type WebsocketAction string
const (
	WatchNodesAction      WebsocketAction = "watch-nodes"
	WatchResourceAction   WebsocketAction = "watch-resource"
	ContainerLogsAction   WebsocketAction = "container-logs"
	ContainerExecAction   WebsocketAction = "container-exec"
	ContainerAttachAction WebsocketAction = "container-attach"
)

type WebsocketRequest

type WebsocketRequest struct {
	Action   WebsocketAction
	Protocol string
	Params   url.Values
	// contains filtered or unexported fields
}

func ParseWebsocketRequest

func ParseWebsocketRequest(u *url.URL) (*WebsocketRequest, error)

func (*WebsocketRequest) Path

func (r *WebsocketRequest) Path(ns string) string

func (*WebsocketRequest) PathParams

func (r *WebsocketRequest) PathParams(ns string) string

func (*WebsocketRequest) QueryParams

func (r *WebsocketRequest) QueryParams() url.Values

Jump to

Keyboard shortcuts

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