Documentation ¶
Index ¶
- Constants
- Variables
- func IsCronJob(processType string) bool
- type Address
- type App
- type AppListItem
- type AppOperations
- func (ops *AppOperations) ChangeTeam(appName, teamName string) error
- func (ops *AppOperations) CheckPermAndGet(user *database.User, appName string) (*App, error)
- func (ops *AppOperations) Create(user *database.User, app *App) (Err error)
- func (ops *AppOperations) Delete(user *database.User, appName string) error
- func (ops *AppOperations) DeletePods(user *database.User, appName string, podsNames []string) error
- func (ops *AppOperations) Get(appName string) (*App, error)
- func (ops *AppOperations) HasPermission(user *database.User, appName string) bool
- func (ops *AppOperations) Info(user *database.User, appName string) (*Info, error)
- func (ops *AppOperations) List(user *database.User) ([]*AppListItem, error)
- func (ops *AppOperations) ListByTeam(teamName string) ([]string, error)
- func (ops *AppOperations) Logs(user *database.User, appName string, opts *LogOptions) (io.ReadCloser, error)
- func (ops *AppOperations) SaveApp(app *App, lastUser string) error
- func (ops *AppOperations) SetAutoscale(user *database.User, appName string, as *Autoscale) error
- func (ops *AppOperations) SetEnv(user *database.User, appName string, evs []*EnvVar) error
- func (ops *AppOperations) SetReplicas(user *database.User, appName string, replicas int32) error
- func (ops *AppOperations) SetSecret(user *database.User, appName string, secrets []*EnvVar) error
- func (ops *AppOperations) SetSecretFile(user *database.User, appName, name string, content []byte) error
- func (ops *AppOperations) TeamName(appName string) (string, error)
- func (ops *AppOperations) UnsetEnv(user *database.User, appName string, evNames []string) error
- func (ops *AppOperations) UnsetSecret(user *database.User, appName string, secrets []string) error
- type Autoscale
- type EnvVar
- type FakeOperations
- func (f *FakeOperations) ChangeTeam(appName, teamName string) error
- func (f *FakeOperations) CheckPermAndGet(user *database.User, appName string) (*App, error)
- func (f *FakeOperations) Create(user *database.User, app *App) error
- func (f *FakeOperations) Delete(user *database.User, appName string) error
- func (f *FakeOperations) DeletePods(user *database.User, appName string, podsNames []string) error
- func (f *FakeOperations) Get(appName string) (*App, error)
- func (f *FakeOperations) HasPermission(user *database.User, appName string) bool
- func (f *FakeOperations) Info(user *database.User, appName string) (*Info, error)
- func (f *FakeOperations) List(user *database.User) ([]*AppListItem, error)
- func (f *FakeOperations) ListByTeam(teamName string) ([]string, error)
- func (f *FakeOperations) Logs(user *database.User, appName string, opts *LogOptions) (io.ReadCloser, error)
- func (f *FakeOperations) SaveApp(app *App, lastUser string) error
- func (f *FakeOperations) SetAutoscale(user *database.User, appName string, as *Autoscale) error
- func (f *FakeOperations) SetEnv(user *database.User, appName string, envVars []*EnvVar) error
- func (f *FakeOperations) SetReplicas(user *database.User, appName string, replicas int32) error
- func (f *FakeOperations) SetSecret(user *database.User, appName string, secrets []*EnvVar) error
- func (f *FakeOperations) SetSecretFile(user *database.User, appName, name string, content []byte) error
- func (f *FakeOperations) TeamName(appName string) (string, error)
- func (f *FakeOperations) UnsetEnv(user *database.User, appName string, envVars []string) error
- func (f *FakeOperations) UnsetSecret(user *database.User, appName string, secrets []string) error
- type Info
- type K8sOperations
- type LimitRangeQuantity
- type Limits
- type LogOptions
- type Operations
- type Pod
- type PodListOptions
- type Service
- func (s *Service) ChangeTeam(ctx context.Context, req *appb.ChangeTeamRequest) (*appb.Empty, error)
- func (s *Service) Create(ctx context.Context, req *appb.CreateRequest) (*appb.Empty, error)
- func (s *Service) Delete(ctx context.Context, req *appb.DeleteRequest) (*appb.Empty, error)
- func (s *Service) DeletePods(ctx context.Context, req *appb.DeletePodsRequest) (*appb.Empty, error)
- func (s *Service) Info(ctx context.Context, req *appb.InfoRequest) (*appb.InfoResponse, error)
- func (s *Service) List(ctx context.Context, _ *appb.Empty) (*appb.ListResponse, error)
- func (s *Service) Logs(req *appb.LogsRequest, stream appb.App_LogsServer) error
- func (s *Service) RegisterService(grpcServer *grpc.Server)
- func (s *Service) SetAutoscale(ctx context.Context, req *appb.SetAutoscaleRequest) (*appb.Empty, error)
- func (s *Service) SetEnv(ctx context.Context, req *appb.SetEnvRequest) (*appb.Empty, error)
- func (s *Service) SetReplicas(ctx context.Context, req *appb.SetReplicasRequest) (*appb.Empty, error)
- func (s *Service) SetSecret(ctx context.Context, req *appb.SetSecretRequest) (*appb.Empty, error)
- func (s *Service) UnsetEnv(ctx context.Context, req *appb.UnsetEnvRequest) (*appb.Empty, error)
- func (s *Service) UnsetSecret(ctx context.Context, req *appb.UnsetEnvRequest) (*appb.Empty, error)
- type Status
Constants ¶
View Source
const ( TeresaAnnotation = "teresa.io/app" TeresaTeamLabel = "teresa.io/team" TeresaLastUser = "teresa.io/last-user" TeresaAppSecrets = "teresa-secrets" )
View Source
const ( ProcessTypeWeb = "web" ProcessTypeCronPrefix = "cron" )
View Source
const SecretPath = "/teresa/secrets"
Variables ¶
View Source
var ( ErrAlreadyExists = status.Errorf(codes.AlreadyExists, "App already exists") ErrNotFound = status.Errorf(codes.NotFound, "App not found") ErrProtectedEnvVar = status.Errorf(codes.InvalidArgument, "Can't change protected env vars") ErrInvalidName = status.Errorf(codes.InvalidArgument, "Invalid App Name") ErrInvalidLimits = status.Errorf(codes.InvalidArgument, "Invalid Limits") ErrInvalidAutoscale = status.Errorf(codes.InvalidArgument, "Invalid Autoscale") ErrInvalidEnvVarName = status.Errorf(codes.InvalidArgument, "Invalid Env Var Name") ErrInvalidSecretName = status.Errorf(codes.InvalidArgument, "Invalid Secret Name") ErrInvalidActionForCronJob = status.Errorf(codes.InvalidArgument, "Invalid action for a cronjob app") ErrMissingVirtualHost = status.Errorf( codes.InvalidArgument, "Missing --vhost argument with the application domain", ) )
Functions ¶
Types ¶
type App ¶
type App struct { Name string `json:"name"` Team string `json:"-"` ProcessType string `json:"processType"` VirtualHost string `json:"virtualHost"` Limits *Limits `json:"-"` Autoscale *Autoscale `json:"-"` EnvVars []*EnvVar `json:"envVars"` Internal bool `json:"internal"` Secrets []string `json:"secrets"` SecretFiles []string `json:"secret_files"` Protocol string `json:"protocol"` }
type AppListItem ¶
type AppOperations ¶
type AppOperations struct {
// contains filtered or unexported fields
}
func (*AppOperations) ChangeTeam ¶ added in v0.10.0
func (ops *AppOperations) ChangeTeam(appName, teamName string) error
ChangeTeam changes current team name of an App (be sure the new team exists)
func (*AppOperations) CheckPermAndGet ¶ added in v0.8.0
func (*AppOperations) Create ¶
func (ops *AppOperations) Create(user *database.User, app *App) (Err error)
func (*AppOperations) Delete ¶ added in v0.8.0
func (ops *AppOperations) Delete(user *database.User, appName string) error
func (*AppOperations) DeletePods ¶ added in v0.13.0
func (*AppOperations) HasPermission ¶
func (ops *AppOperations) HasPermission(user *database.User, appName string) bool
func (*AppOperations) List ¶
func (ops *AppOperations) List(user *database.User) ([]*AppListItem, error)
func (*AppOperations) ListByTeam ¶ added in v0.10.0
func (ops *AppOperations) ListByTeam(teamName string) ([]string, error)
func (*AppOperations) Logs ¶
func (ops *AppOperations) Logs(user *database.User, appName string, opts *LogOptions) (io.ReadCloser, error)
func (*AppOperations) SaveApp ¶ added in v0.8.0
func (ops *AppOperations) SaveApp(app *App, lastUser string) error
func (*AppOperations) SetAutoscale ¶ added in v0.7.0
func (*AppOperations) SetReplicas ¶ added in v0.13.0
func (*AppOperations) SetSecretFile ¶ added in v0.25.0
func (*AppOperations) UnsetSecret ¶ added in v0.17.0
type FakeOperations ¶
func NewFakeOperations ¶
func NewFakeOperations() *FakeOperations
func (*FakeOperations) ChangeTeam ¶ added in v0.10.0
func (f *FakeOperations) ChangeTeam(appName, teamName string) error
func (*FakeOperations) CheckPermAndGet ¶ added in v0.8.0
func (*FakeOperations) Create ¶
func (f *FakeOperations) Create(user *database.User, app *App) error
func (*FakeOperations) Delete ¶ added in v0.8.0
func (f *FakeOperations) Delete(user *database.User, appName string) error
func (*FakeOperations) DeletePods ¶ added in v0.13.0
func (*FakeOperations) HasPermission ¶
func (f *FakeOperations) HasPermission(user *database.User, appName string) bool
func (*FakeOperations) List ¶
func (f *FakeOperations) List(user *database.User) ([]*AppListItem, error)
func (*FakeOperations) ListByTeam ¶ added in v0.10.0
func (f *FakeOperations) ListByTeam(teamName string) ([]string, error)
func (*FakeOperations) Logs ¶
func (f *FakeOperations) Logs(user *database.User, appName string, opts *LogOptions) (io.ReadCloser, error)
func (*FakeOperations) SaveApp ¶ added in v0.8.0
func (f *FakeOperations) SaveApp(app *App, lastUser string) error
func (*FakeOperations) SetAutoscale ¶ added in v0.7.0
func (*FakeOperations) SetReplicas ¶ added in v0.13.0
func (*FakeOperations) SetSecretFile ¶ added in v0.25.0
func (*FakeOperations) UnsetSecret ¶ added in v0.17.0
type K8sOperations ¶
type K8sOperations interface { NamespaceAnnotation(namespace, annotation string) (string, error) NamespaceLabel(namespace, label string) (string, error) PodList(namespace string, opts *PodListOptions) ([]*Pod, error) PodLogs(namespace, podName string, opts *LogOptions) (io.ReadCloser, error) CreateNamespace(app *App, userEmail string) error CreateQuota(app *App) error GetSecret(namespace, secretName string) (map[string][]byte, error) CreateOrUpdateSecret(appName, secretName string, data map[string][]byte) error CreateOrUpdateAutoscale(app *App) error AddressList(namespace string) ([]*Address, error) Status(namespace string) (*Status, error) Autoscale(namespace string) (*Autoscale, error) Limits(namespace, name string) (*Limits, error) IsNotFound(err error) bool IsAlreadyExists(err error) bool IsInvalid(err error) bool SetNamespaceAnnotations(namespace string, annotations map[string]string) error SetNamespaceLabels(namespace string, labels map[string]string) error DeleteDeployEnvVars(namespace, name string, evNames []string) error DeleteCronJobEnvVars(namespace, name string, evNames []string) error CreateOrUpdateDeployEnvVars(namespace, name string, evs []*EnvVar) error CreateOrUpdateCronJobEnvVars(namespace, name string, evs []*EnvVar) error CreateOrUpdateDeploySecretEnvVars(namespace, name, secretName string, secrets []string) error CreateOrUpdateCronJobSecretEnvVars(namespace, name, secretName string, secrets []string) error DeleteNamespace(namespace string) error NamespaceListByLabel(label, value string) ([]string, error) DeploySetReplicas(namespace, name string, replicas int32) error DeletePod(namespace, podName string) error HasIngress(namespace, name string) (bool, error) IngressEnabled() bool CreateOrUpdateDeploySecretFile(namespace, deploy, fileName string) error CreateOrUpdateCronJobSecretFile(namespace, cronjob, filename string) error DeleteDeploySecrets(namespace, deploy string, envVars, volKeys []string) error DeleteCronJobSecrets(namespace, cronjob string, envVars, volKeys []string) error }
type LimitRangeQuantity ¶
type Limits ¶
type Limits struct { Default []*LimitRangeQuantity DefaultRequest []*LimitRangeQuantity }
type LogOptions ¶ added in v0.16.0
type Operations ¶
type Operations interface { Create(user *database.User, app *App) error Logs(user *database.User, appName string, opts *LogOptions) (io.ReadCloser, error) Info(user *database.User, appName string) (*Info, error) TeamName(appName string) (string, error) Get(appName string) (*App, error) HasPermission(user *database.User, appName string) bool SetEnv(user *database.User, appName string, evs []*EnvVar) error UnsetEnv(user *database.User, appName string, evs []string) error SetSecret(user *database.User, appName string, secrets []*EnvVar) error UnsetSecret(user *database.User, appName string, secrets []string) error SetSecretFile(user *database.User, appName, name string, content []byte) error List(user *database.User) ([]*AppListItem, error) ListByTeam(teamName string) ([]string, error) SetAutoscale(user *database.User, appName string, as *Autoscale) error CheckPermAndGet(user *database.User, appName string) (*App, error) SaveApp(app *App, lastUser string) error Delete(user *database.User, appName string) error ChangeTeam(appName, teamName string) error SetReplicas(user *database.User, appName string, replicas int32) error DeletePods(user *database.User, appName string, podsNames []string) error }
func NewOperations ¶
func NewOperations(tops team.Operations, kops K8sOperations, st st.Storage) Operations
type PodListOptions ¶ added in v0.16.0
type PodListOptions struct {
PodName string
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(ops Operations) *Service
func (*Service) ChangeTeam ¶ added in v0.20.0
func (*Service) DeletePods ¶ added in v0.13.0
func (*Service) Info ¶
func (s *Service) Info(ctx context.Context, req *appb.InfoRequest) (*appb.InfoResponse, error)
func (*Service) Logs ¶
func (s *Service) Logs(req *appb.LogsRequest, stream appb.App_LogsServer) error
func (*Service) RegisterService ¶
func (*Service) SetAutoscale ¶ added in v0.7.0
func (*Service) SetReplicas ¶ added in v0.13.0
func (*Service) UnsetSecret ¶ added in v0.17.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.