Documentation
¶
Index ¶
- Constants
- Variables
- func NewValidationError(message string, validationError error) error
- func NewValidationErrorMessage(message string) error
- type ApiKey
- type ApiKeyRepository
- type App
- type AppRepository
- type AppStatus
- type Deployment
- type DeploymentConfig
- type DeploymentContext
- type DeploymentDoc
- type DeploymentDocker
- type DeploymentRecord
- type DeploymentRepository
- type DeploymentReservation
- type DeploymentReservationRepository
- type DeploymentRevisionStatus
- type DeploymentStatus
- type DeploymentTrafficStatus
- type Environment
- type EnvironmentConfig
- type EnvironmentDoc
- type EnvironmentRepository
- type EnvironmentStatus
- type FakeApiKeyRepository
- type FakeAppRepository
- type FakeDeploymentRepository
- func (f *FakeDeploymentRepository) Create(newDeployment *DeploymentRecord) error
- func (f *FakeDeploymentRepository) Delete(name *NamespacedName, envName string) error
- func (fake *FakeDeploymentRepository) FindByApp(appId uuid.UUID) ([]Deployment, error)
- func (f *FakeDeploymentRepository) GetByName(name *NamespacedName, envName string) (*Deployment, error)
- func (f *FakeDeploymentRepository) GetByReservation(reservationId uuid.UUID, envName string) (*Deployment, error)
- func (fake *FakeDeploymentRepository) IncrementRevision(name *NamespacedName, envName string) (int64, error)
- func (fake *FakeDeploymentRepository) RollbackRevision(name *NamespacedName, envName string, failedRevision int64) (int64, error)
- func (fake *FakeDeploymentRepository) UpdateStatus(name *NamespacedName, envName string, status *DeploymentStatus) error
- func (fake *FakeDeploymentRepository) UpdateTraffic(name *NamespacedName, envName string, riserRevision int64, ...) error
- type FakeDeploymentReservationRepository
- type FakeEnvironmentRepository
- type FakeNamespaceRepository
- type FakeSecretMetaRepository
- type FakeUserRepository
- type Namespace
- type NamespaceRepository
- type NamespacedName
- type NewUser
- type ResourceFile
- type RuntimeConfig
- type SecretMeta
- type SecretMetaRepository
- type StatusProblem
- type TrafficConfig
- type TrafficConfigRule
- type User
- type UserDoc
- type UserRepository
- type ValidationError
Constants ¶
const DefaultNamespace = "apps"
const (
LoginTypeAPIKey = "APIKey"
)
Variables ¶
var ErrConflictNewerVersion = errors.New("a newer version of the object exists")
var ErrNotFound = errors.New("the object could not be found")
Functions ¶
func NewValidationError ¶
NewValidationError creates a ValidationError conditional on the type of error passed in. It is expected that validationError is typically of type ozzo-validation.Errors object, containing a key/value pair of string/errors, but it can be of any type of error that is consumable by a client.
func NewValidationErrorMessage ¶ added in v0.0.8
NewValidationErrorMessage creates a ValidationError without an underlying error.
Types ¶
type ApiKeyRepository ¶
type AppRepository ¶
type AppStatus ¶
type AppStatus struct {
EnvironmentStatus []EnvironmentStatus
// Deployments returns the whole deployment. We should probably use a different type here with less data, but we can't just pass
// Deployment.Doc.Status as we also need the DeploymentName and the environment.
Deployments []Deployment
}
type Deployment ¶
type Deployment struct {
DeploymentReservation
DeploymentRecord
}
Deployment represents a deployment in a particular environment
type DeploymentConfig ¶
type DeploymentConfig struct {
Name string
Namespace string
EnvironmentName string
Docker DeploymentDocker
// TODO: Move to core and remove api/v1/model dependency
App *model.AppConfig
Traffic TrafficConfig
ManualRollout bool
}
type DeploymentContext ¶
type DeploymentContext struct {
DeploymentConfig *DeploymentConfig
EnvironmentConfig *EnvironmentConfig
RiserRevision int64
Secrets []SecretMeta
ManualRollout bool
}
type DeploymentDoc ¶
type DeploymentDoc struct {
Status *DeploymentStatus `json:"status,omitempty"`
Traffic []TrafficConfigRule `json:"traffic"`
}
func (*DeploymentDoc) Scan ¶
func (a *DeploymentDoc) Scan(value interface{}) error
Needed for sql.Scanner interface
type DeploymentDocker ¶
type DeploymentDocker struct {
Tag string `json:"tag"`
}
type DeploymentRecord ¶ added in v0.0.10
type DeploymentRecord struct {
Id uuid.UUID
ReservationId uuid.UUID
EnvironmentName string
// RiserRevision is for tracking deployment changes and has no relation to a k8s deployment revision
RiserRevision int64
DeletedAt *time.Time
Doc DeploymentDoc
}
DeploymentRecord represents the database fields specific for a deployment
type DeploymentRepository ¶
type DeploymentRepository interface {
Create(newDeployment *DeploymentRecord) error
Delete(name *NamespacedName, envName string) error
GetByReservation(reservationId uuid.UUID, envName string) (*Deployment, error)
GetByName(name *NamespacedName, envName string) (*Deployment, error)
FindByApp(appId uuid.UUID) ([]Deployment, error)
UpdateStatus(name *NamespacedName, envName string, status *DeploymentStatus) error
UpdateTraffic(name *NamespacedName, envName string, riserRevision int64, traffic TrafficConfig) error
IncrementRevision(name *NamespacedName, envName string) (int64, error)
RollbackRevision(name *NamespacedName, envName string, failedRevision int64) (int64, error)
}
type DeploymentReservation ¶ added in v0.0.10
type DeploymentReservation struct {
Id uuid.UUID
AppId uuid.UUID
Name string
// At the time of writing the namespace should never be different from the app's namespace as we do not allow a deployment
// to be deployed to a different namespace than the app. This may change in the future
Namespace string
}
DeploymentReservation represents a reservation of a deployment name to an app
type DeploymentReservationRepository ¶ added in v0.0.10
type DeploymentReservationRepository interface {
Create(reservation *DeploymentReservation) error
GetByName(name *NamespacedName) (*DeploymentReservation, error)
}
type DeploymentRevisionStatus ¶ added in v0.0.6
type DeploymentRevisionStatus struct {
Name string `json:"name"`
AvailableReplicas int32 `json:"availableReplicas"`
DockerImage string `json:"dockerImage"`
RiserRevision int64 `json:"riserRevision"`
RevisionStatus string `json:"revisionStatus"`
RevisionStatusReason string `json:"revisionStatusReason"`
}
type DeploymentStatus ¶
type DeploymentStatus struct {
ObservedRiserRevision int64 `json:"observedRiserRevision"`
LastUpdated time.Time `json:"lastUpdated"`
Revisions []DeploymentRevisionStatus `json:"revisions"`
LatestReadyRevisionName string `json:"latestReadyRevisionName"`
LatestCreatedRevisionName string `json:"latestCreatedRevisionName"`
Traffic []DeploymentTrafficStatus `json:"traffic"`
}
type DeploymentTrafficStatus ¶ added in v0.0.6
type Environment ¶ added in v0.0.17
type Environment struct {
Name string
Doc EnvironmentDoc
}
type EnvironmentConfig ¶ added in v0.0.17
type EnvironmentDoc ¶ added in v0.0.17
type EnvironmentDoc struct {
LastPing time.Time `json:"lastPing"`
Config EnvironmentConfig `json:"config"`
}
func (*EnvironmentDoc) Scan ¶ added in v0.0.17
func (a *EnvironmentDoc) Scan(value interface{}) error
Needed for sql.Scanner interface
type EnvironmentRepository ¶ added in v0.0.17
type EnvironmentRepository interface {
Get(name string) (*Environment, error)
List() ([]Environment, error)
Save(environment *Environment) error
}
type EnvironmentStatus ¶ added in v0.0.17
type FakeApiKeyRepository ¶
type FakeApiKeyRepository struct {
GetByUserIdFn func(uuid.UUID) ([]ApiKey, error)
CreateFn func(uuid.UUID, []byte) error
CreateCallCount int
}
func (*FakeApiKeyRepository) Create ¶
func (r *FakeApiKeyRepository) Create(userId uuid.UUID, keyHash []byte) error
func (*FakeApiKeyRepository) GetByUserId ¶
func (r *FakeApiKeyRepository) GetByUserId(userId uuid.UUID) ([]ApiKey, error)
type FakeAppRepository ¶
type FakeAppRepository struct {
GetFn func(id uuid.UUID) (*App, error)
GetCallCount int
GetByNameFn func(*NamespacedName) (*App, error)
GetByNameCallCount int
CreateFn func(app *App) error
ListAppsFn func() ([]App, error)
}
func (*FakeAppRepository) Create ¶
func (fake *FakeAppRepository) Create(app *App) error
func (*FakeAppRepository) GetByName ¶ added in v0.0.10
func (fake *FakeAppRepository) GetByName(name *NamespacedName) (*App, error)
func (*FakeAppRepository) ListApps ¶
func (fake *FakeAppRepository) ListApps() ([]App, error)
type FakeDeploymentRepository ¶
type FakeDeploymentRepository struct {
CreateFn func(newDeployment *DeploymentRecord) error
CreateCallCount int
DeleteFn func(name *NamespacedName, envName string) error
DeleteCallCount int
GetByNameFn func(name *NamespacedName, envName string) (*Deployment, error)
GetByReservationFn func(reservationId uuid.UUID, envName string) (*Deployment, error)
GetByReservationCallCount int
FindByAppFn func(uuid.UUID) ([]Deployment, error)
IncrementRevisionFn func(name *NamespacedName, envName string) (int64, error)
IncrementRevisionCallCount int
RollbackRevisionFn func(name *NamespacedName, envName string, failedRevision int64) (int64, error)
UpdateStatusFn func(name *NamespacedName, envName string, status *DeploymentStatus) error
UpdateStatusCallCount int
UpdateTrafficFn func(name *NamespacedName, envName string, riserRevision int64, traffic TrafficConfig) error
UpdateTrafficCallCount int
}
func (*FakeDeploymentRepository) Create ¶
func (f *FakeDeploymentRepository) Create(newDeployment *DeploymentRecord) error
func (*FakeDeploymentRepository) Delete ¶ added in v0.0.7
func (f *FakeDeploymentRepository) Delete(name *NamespacedName, envName string) error
func (*FakeDeploymentRepository) FindByApp ¶
func (fake *FakeDeploymentRepository) FindByApp(appId uuid.UUID) ([]Deployment, error)
func (*FakeDeploymentRepository) GetByName ¶ added in v0.0.10
func (f *FakeDeploymentRepository) GetByName(name *NamespacedName, envName string) (*Deployment, error)
func (*FakeDeploymentRepository) GetByReservation ¶ added in v0.0.10
func (f *FakeDeploymentRepository) GetByReservation(reservationId uuid.UUID, envName string) (*Deployment, error)
func (*FakeDeploymentRepository) IncrementRevision ¶ added in v0.0.7
func (fake *FakeDeploymentRepository) IncrementRevision(name *NamespacedName, envName string) (int64, error)
func (*FakeDeploymentRepository) RollbackRevision ¶ added in v0.0.7
func (fake *FakeDeploymentRepository) RollbackRevision(name *NamespacedName, envName string, failedRevision int64) (int64, error)
func (*FakeDeploymentRepository) UpdateStatus ¶
func (fake *FakeDeploymentRepository) UpdateStatus(name *NamespacedName, envName string, status *DeploymentStatus) error
func (*FakeDeploymentRepository) UpdateTraffic ¶ added in v0.0.6
func (fake *FakeDeploymentRepository) UpdateTraffic(name *NamespacedName, envName string, riserRevision int64, traffic TrafficConfig) error
type FakeDeploymentReservationRepository ¶ added in v0.0.10
type FakeDeploymentReservationRepository struct {
CreateFn func(reservation *DeploymentReservation) error
CreateCallCount int
GetByNameFn func(name *NamespacedName) (*DeploymentReservation, error)
}
func (*FakeDeploymentReservationRepository) Create ¶ added in v0.0.10
func (f *FakeDeploymentReservationRepository) Create(reservation *DeploymentReservation) error
func (*FakeDeploymentReservationRepository) GetByName ¶ added in v0.0.10
func (f *FakeDeploymentReservationRepository) GetByName(name *NamespacedName) (*DeploymentReservation, error)
type FakeEnvironmentRepository ¶ added in v0.0.17
type FakeEnvironmentRepository struct {
GetFn func(string) (*Environment, error)
GetCallCount int
ListFn func() ([]Environment, error)
ListCallCount int
SaveFn func(*Environment) error
SaveCallCount int
}
func (*FakeEnvironmentRepository) Get ¶ added in v0.0.17
func (fake *FakeEnvironmentRepository) Get(name string) (*Environment, error)
func (*FakeEnvironmentRepository) List ¶ added in v0.0.17
func (fake *FakeEnvironmentRepository) List() ([]Environment, error)
func (*FakeEnvironmentRepository) Save ¶ added in v0.0.17
func (fake *FakeEnvironmentRepository) Save(environment *Environment) error
type FakeNamespaceRepository ¶ added in v0.0.10
type FakeNamespaceRepository struct {
CreateFn func(namespace *Namespace) error
GetFn func(namespaceName string) (*Namespace, error)
GetCallCount int
ListFn func() ([]Namespace, error)
}
func (*FakeNamespaceRepository) Create ¶ added in v0.0.10
func (fake *FakeNamespaceRepository) Create(namespace *Namespace) error
func (*FakeNamespaceRepository) Get ¶ added in v0.0.10
func (fake *FakeNamespaceRepository) Get(namespaceName string) (*Namespace, error)
func (*FakeNamespaceRepository) List ¶ added in v0.0.10
func (fake *FakeNamespaceRepository) List() ([]Namespace, error)
type FakeSecretMetaRepository ¶
type FakeSecretMetaRepository struct {
CommitFn func(*SecretMeta) error
CommitCallCount int
SaveFn func(*SecretMeta) (int64, error)
SaveCallCount int
ListByAppInEnvironmentFn func(*NamespacedName, string) ([]SecretMeta, error)
}
func (*FakeSecretMetaRepository) Commit ¶ added in v0.0.8
func (fake *FakeSecretMetaRepository) Commit(secretMeta *SecretMeta) error
func (*FakeSecretMetaRepository) ListByAppInEnvironment ¶ added in v0.0.17
func (fake *FakeSecretMetaRepository) ListByAppInEnvironment(appName *NamespacedName, envName string) ([]SecretMeta, error)
func (*FakeSecretMetaRepository) Save ¶
func (fake *FakeSecretMetaRepository) Save(secretMeta *SecretMeta) (int64, error)
type FakeUserRepository ¶
type FakeUserRepository struct {
GetByApiKeyFn func(keyHash []byte) (*User, error)
GetByUsernameFn func(username string) (*User, error)
CreateFn func(newUser *NewUser) error
CreateCallCount int
GetActiveCountFn func() (int, error)
}
func (*FakeUserRepository) Create ¶
func (r *FakeUserRepository) Create(newUser *NewUser) error
func (*FakeUserRepository) GetActiveCount ¶
func (r *FakeUserRepository) GetActiveCount() (int, error)
func (*FakeUserRepository) GetByApiKey ¶
func (r *FakeUserRepository) GetByApiKey(keyHash []byte) (*User, error)
func (*FakeUserRepository) GetByUsername ¶
func (r *FakeUserRepository) GetByUsername(username string) (*User, error)
type NamespaceRepository ¶ added in v0.0.10
type NamespacedName ¶ added in v0.0.10
func NewNamespacedName ¶ added in v0.0.10
func NewNamespacedName(name, namespace string) *NamespacedName
func ParseNamespacedName ¶ added in v0.0.10
func ParseNamespacedName(namespacedName string) *NamespacedName
func (*NamespacedName) String ¶ added in v0.0.10
func (v *NamespacedName) String() string
type ResourceFile ¶
type RuntimeConfig ¶
type RuntimeConfig struct {
BootstrapApikey string `split_words:"true"`
BindAddress string `split_words:"true" default:":8000"`
DeveloperMode bool `split_words:"true"`
GitUrl string `split_words:"true" required:"true"`
GitDir string `split_words:"true" default:"/tmp/riser/git/"`
GitBranch string `split_words:"true" default:"master"`
GitUsername string `split_words:"true"`
GitPassword string `split_words:"true"`
PostgresUrl string `split_words:"true" default:"postgres://postgres.riser-system.svc.cluster.local/riserdb?sslmode=disable&connect_timeout=3"`
PostgresUsername string `split_words:"true" required:"true"`
PostgresPassword string `split_words:"true" required:"true"`
PostgresMigrateOnStartup bool `split_words:"true" default:"true"`
}
RuntimeConfig provides config for the srver.
type SecretMeta ¶
type SecretMeta struct {
Name string
App *NamespacedName
EnvironmentName string
Revision int64
}
type SecretMetaRepository ¶
type SecretMetaRepository interface {
// Commit commits a secretmeta at the specified revision. This is an acknowledgement that the secret has been committed to the underlying
// resource (e.g. the git state repo)
Commit(secretMeta *SecretMeta) error
// Save saves the secret meta and returns a new revision. It is up to the caller to modify the secretMeta with the new revision.
// Important: You must call r.Commit to validate that the object has been committed. Uncommitted secrets are not applied to deployments
Save(secretMeta *SecretMeta) (revision int64, err error)
ListByAppInEnvironment(appName *NamespacedName, envName string) ([]SecretMeta, error)
}
type StatusProblem ¶ added in v0.0.6
type TrafficConfig ¶ added in v0.0.6
type TrafficConfig []TrafficConfigRule
Needed for serialization to postgres since we do partial updates on traffic
type TrafficConfigRule ¶ added in v0.0.6
type UserRepository ¶
type ValidationError ¶
type ValidationError struct {
Message string
// ValidationError represents the validation error that ocurred. See the API errorHandler for how this is returned to the client.
ValidationError error
// contains filtered or unexported fields
}
ValidationError provides an error consumable by a client. This is safe to return to the API as the errorHandler is aware of this error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Source Files
¶
- apikey_repository.go
- apikey_types.go
- app_repository.go
- app_types.go
- deployment_repository.go
- deployment_types.go
- deploymentreservation_repository.go
- deploymentreservation_types.go
- environment_repository.go
- environment_types.go
- errors.go
- json_util.go
- namespace_repository.go
- namespace_types.go
- resourcefile.go
- runtime_types.go
- secretmeta_repository.go
- secretmeta_types.go
- user_repository.go
- user_types.go