unleash

package
v0.0.0-...-455c6d0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnleashCustomImageRepo    = "europe-north1-docker.pkg.dev/nais-io/nais/images/"
	UnleashCustomImageName    = "unleash-v4"
	UnleashRequestCPU         = "100m"
	UnleashRequestMemory      = "128Mi"
	UnleashLimitMemory        = "256Mi"
	SqlProxyRequestCPU        = "10m"
	SqlProxyRequestMemory     = "100Mi"
	SqlProxyLimitMemory       = "100Mi"
	DatabasePoolMax           = "3"
	DatabasePoolIdleTimeoutMs = "1000"
	LogLevel                  = "warn"
)

Variables

View Source
var FederationAllowedClusters = []string{"dev-gcp", "prod-gcp"}

Functions

func FQDNNetworkPolicyDefinition

func FQDNNetworkPolicyDefinition(name string, kubeNamespace string) fqdnV1alpha3.FQDNNetworkPolicy

func UnleashDefinition

func UnleashDefinition(c *config.Config, uc *UnleashConfig) unleashv1.Unleash

Types

type ISQLDatabasesService

type ISQLDatabasesService interface {
	Get(project string, instance string, database string) *admin.DatabasesGetCall
	Insert(project string, instance string, database *admin.Database) *admin.DatabasesInsertCall
	Delete(project string, instance string, database string) *admin.DatabasesDeleteCall
}

type ISQLUsersService

type ISQLUsersService interface {
	Get(project string, instance string, name string) *admin.UsersGetCall
	Insert(project string, instance string, user *admin.User) *admin.UsersInsertCall
	Delete(project string, instance string) *admin.UsersDeleteCall
}

type IUnleashService

type IUnleashService interface {
	List(ctx context.Context) ([]*UnleashInstance, error)
	Get(ctx context.Context, name string) (*UnleashInstance, error)
	Create(ctx context.Context, uc *UnleashConfig) error
	Update(ctx context.Context, uc *UnleashConfig) error
	Delete(ctx context.Context, name string) error
}

type UnleashConfig

type UnleashConfig struct {
	Name                      string `form:"name" validate:"required,hostname"`
	CustomVersion             string `form:"custom-version" validate:"omitempty"`
	EnableFederation          bool   `form:"enable-federation,default=true"`
	FederationNonce           string `validate:"required"`
	AllowedTeams              string `form:"allowed-teams" validate:"omitempty"`
	AllowedNamespaces         string `form:"allowed-namespaces" validate:"omitempty"`
	AllowedClusters           string `form:"allowed-clusters" validate:"omitempty"`
	LogLevel                  string `form:"loglevel,default=warn" validate:"required,oneof=debug info warn error fatal panic"`
	DatabasePoolMax           int    `form:"database-pool-max,default=3" validate:"required,min=1,max=10"`
	DatabasePoolIdleTimeoutMs int    `form:"database-pool-idle-timeout-ms,default=1000" validate:"required"`
}

func UnleashVariables

func UnleashVariables(server *unleashv1.Unleash, returnDefaults bool) *UnleashConfig

func (*UnleashConfig) Validate

func (uc *UnleashConfig) Validate() error

type UnleashError

type UnleashError struct {
	Reason string
	Err    error
}

func (*UnleashError) Error

func (e *UnleashError) Error() string

type UnleashInstance

type UnleashInstance struct {
	Name                 string
	KubernetesNamespace  string
	CreatedAt            metav1.Time
	ServerInstance       *unleashv1.Unleash
	DatabaseInstanceName string
	DatabaseProjectName  string
	Database             *admin.Database
	DatabaseUser         *admin.User
	DatabaseSecret       *corev1.Secret
}

func NewUnleashInstance

func NewUnleashInstance(serverInstance *unleashv1.Unleash) *UnleashInstance

func (UnleashInstance) Age

func (u UnleashInstance) Age() string

func (*UnleashInstance) ApiUrl

func (u *UnleashInstance) ApiUrl() string

func (*UnleashInstance) GetDatabase

func (u *UnleashInstance) GetDatabase(ctx context.Context, client *admin.DatabasesService) error

func (*UnleashInstance) GetDatabaseUser

func (u *UnleashInstance) GetDatabaseUser(ctx context.Context, client *admin.UsersService) error

func (*UnleashInstance) IsReady

func (u *UnleashInstance) IsReady() bool

func (*UnleashInstance) Status

func (u *UnleashInstance) Status() string

func (*UnleashInstance) StatusLabel

func (u *UnleashInstance) StatusLabel() string

func (*UnleashInstance) Version

func (u *UnleashInstance) Version() string

func (*UnleashInstance) WebUrl

func (u *UnleashInstance) WebUrl() string

type UnleashService

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

func NewUnleashService

func NewUnleashService(sqlDatabasesClient ISQLDatabasesService, sqlUsersClient ISQLUsersService, kubeClient ctrl.Client, config *config.Config, logger *logrus.Logger) *UnleashService

func (*UnleashService) Create

func (s *UnleashService) Create(ctx context.Context, uc *UnleashConfig) error

func (*UnleashService) Delete

func (s *UnleashService) Delete(ctx context.Context, name string) error

func (*UnleashService) Get

func (s *UnleashService) Get(ctx context.Context, name string) (*UnleashInstance, error)

func (*UnleashService) List

func (s *UnleashService) List(ctx context.Context) ([]*UnleashInstance, error)

func (*UnleashService) Update

func (s *UnleashService) Update(ctx context.Context, uc *UnleashConfig) error

Jump to

Keyboard shortcuts

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