Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyQuota(requestedQuotaOrig *v1.ResourceQuota, defaultQuota *v1.ResourceQuota, ...) *v1.ResourceQuota
- func CountAvailable[T AvailabilityMarker](resources []T) int
- func CountOlder(duration time.Duration, accounts []Resource) (int, error)
- func CountToCleanup[T AvailabilityMarker](resources []T) int
- func CountUsed[T AvailabilityMarker](resources []T) int
- func DNSguessNextGuid(origGuid string, serviceUuid string, dbpool *pgxpool.Pool, multiple bool, ...) (string, error)
- func DeletePlacementByServiceUuid(dbpool *pgxpool.Pool, awsProvider AwsAccountProvider, ...) error
- func FilterByReservation[T AvailabilityMarker](resources []T, reservation string) []T
- func GetJobBody[T any](job Job) (T, error)
- func IBMResourceGroupSandboxGuessNextGuid(origGuid string, serviceUuid string, dbpool *pgxpool.Pool, ctx context.Context) (string, error)
- func SetJobBody[T any](job *Job, details T) error
- func Sort[T Sortable](accounts []T, by string) []T
- func Used[T AvailabilityMarker](resources []T) []T
- type APIKeyResponse
- type Account
- type Annotations
- type AvailabilityMarker
- type AwsAccount
- func (a AwsAccount) CloseAccount() error
- func (a AwsAccount) GetLastStatus(dbpool *pgxpool.Pool) (*LifecycleResourceJob, error)
- func (a AwsAccount) GetReservation() string
- func (a AwsAccount) GetUpdatedAt() time.Time
- func (a AwsAccount) NameInt() int
- func (a *AwsAccount) Render(w http.ResponseWriter, r *http.Request) error
- func (a AwsAccount) Start(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
- func (a AwsAccount) Status(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) (Status, error)
- func (a AwsAccount) Stop(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
- type AwsAccountProvider
- type AwsAccountWithCreds
- type AwsAccounts
- type AwsIamKey
- type ByWeight
- type ClusterRelation
- type DNSAccountConfiguration
- func (p *DNSAccountConfiguration) Bind(r *http.Request) error
- func (p *DNSAccountConfiguration) Delete() error
- func (p *DNSAccountConfiguration) Disable() error
- func (p *DNSAccountConfiguration) Enable() error
- func (p *DNSAccountConfiguration) GetAccountCount() (int, error)
- func (p *DNSAccountConfiguration) Render(w http.ResponseWriter, r *http.Request) error
- func (p *DNSAccountConfiguration) Save() error
- func (p *DNSAccountConfiguration) Update() error
- type DNSAccountConfigurations
- type DNSSandbox
- type DNSSandboxProvider
- func (a *DNSSandboxProvider) FetchAll() ([]DNSSandbox, error)
- func (a *DNSSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]DNSSandbox, error)
- func (a *DNSSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]DNSSandboxWithCreds, error)
- func (p *DNSSandboxProvider) FetchById(id int) (DNSSandbox, error)
- func (p *DNSSandboxProvider) FetchByName(name string) (DNSSandbox, error)
- func (p *DNSSandboxProvider) GetDNSAccountConfigurationByAnnotations(annotations map[string]string) ([]DNSAccountConfiguration, error)
- func (p *DNSSandboxProvider) GetDNSAccountConfigurationByName(name string) (DNSAccountConfiguration, error)
- func (p *DNSSandboxProvider) GetDNSAccountConfigurations() (DNSAccountConfigurations, error)
- func (a *DNSSandboxProvider) GetSchedulableAccounts(cloud_selector map[string]string) (DNSAccountConfigurations, error)
- func (a *DNSSandboxProvider) Release(service_uuid string) error
- func (a *DNSSandboxProvider) Request(serviceUuid string, cloud_selector map[string]string, ...) (DNSSandboxWithCreds, error)
- type DNSSandboxWithCreds
- func (sandbox *DNSSandboxWithCreds) Delete() error
- func (a *DNSSandboxWithCreds) GetStatus() (string, error)
- func (a *DNSSandboxWithCreds) IncrementCleanupCount() error
- func (a *DNSSandboxWithCreds) MarkForCleanup() error
- func (a *DNSSandboxWithCreds) Reload() error
- func (a *DNSSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
- func (a *DNSSandboxWithCreds) Save() error
- func (a *DNSSandboxWithCreds) SetStatus(status string) error
- func (a *DNSSandboxWithCreds) Update() error
- type DNSSandboxes
- type DNSServiceAccount
- type Deletable
- type IBMResourceGroupSandbox
- type IBMResourceGroupSandboxConfiguration
- func (p *IBMResourceGroupSandboxConfiguration) Bind(r *http.Request) error
- func (p *IBMResourceGroupSandboxConfiguration) Delete() error
- func (p *IBMResourceGroupSandboxConfiguration) Disable() error
- func (p *IBMResourceGroupSandboxConfiguration) Enable() error
- func (p *IBMResourceGroupSandboxConfiguration) GetAccountCount() (int, error)
- func (p *IBMResourceGroupSandboxConfiguration) Render(w http.ResponseWriter, r *http.Request) error
- func (p *IBMResourceGroupSandboxConfiguration) Save() error
- func (p *IBMResourceGroupSandboxConfiguration) Update() error
- type IBMResourceGroupSandboxConfigurations
- type IBMResourceGroupSandboxProvider
- func (a *IBMResourceGroupSandboxProvider) FetchAll() ([]IBMResourceGroupSandbox, error)
- func (a *IBMResourceGroupSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]IBMResourceGroupSandbox, error)
- func (a *IBMResourceGroupSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]IBMResourceGroupSandboxWithCreds, error)
- func (p *IBMResourceGroupSandboxProvider) FetchById(id int) (IBMResourceGroupSandbox, error)
- func (p *IBMResourceGroupSandboxProvider) FetchByName(name string) (IBMResourceGroupSandbox, error)
- func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByAnnotations(annotations map[string]string) ([]IBMResourceGroupSandboxConfiguration, error)
- func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByName(name string) (IBMResourceGroupSandboxConfiguration, error)
- func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurations() (IBMResourceGroupSandboxConfigurations, error)
- func (a *IBMResourceGroupSandboxProvider) GetSchedulableAccounts(cloud_selector map[string]string) (IBMResourceGroupSandboxConfigurations, error)
- func (a *IBMResourceGroupSandboxProvider) Release(service_uuid string) error
- func (a *IBMResourceGroupSandboxProvider) Request(serviceUuid string, cloud_selector map[string]string, ...) (IBMResourceGroupSandboxWithCreds, error)
- type IBMResourceGroupSandboxWithCreds
- func (account *IBMResourceGroupSandboxWithCreds) Delete() error
- func (a *IBMResourceGroupSandboxWithCreds) GetStatus() (string, error)
- func (a *IBMResourceGroupSandboxWithCreds) IncrementCleanupCount() error
- func (a *IBMResourceGroupSandboxWithCreds) MarkForCleanup() error
- func (a *IBMResourceGroupSandboxWithCreds) Reload() error
- func (a *IBMResourceGroupSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
- func (a *IBMResourceGroupSandboxWithCreds) Save() error
- func (a *IBMResourceGroupSandboxWithCreds) SetStatus(status string) error
- func (a *IBMResourceGroupSandboxWithCreds) Update() error
- type IBMResourceGroupSandboxes
- type IBMResourceGroupServiceAccount
- type Instance
- type Job
- type JobStore
- func (s *JobStore) CreateJob(ctx context.Context, job *Job) error
- func (s *JobStore) DeleteJob(ctx context.Context, id int) error
- func (s *JobStore) GetJobByID(ctx context.Context, id int) (*Job, error)
- func (s *JobStore) GetJobByRequestID(ctx context.Context, requestID string) (*Job, error)
- func (s *JobStore) GetJobsByType(ctx context.Context, jobType string) ([]*Job, error)
- func (s *JobStore) GetLatestJobByType(ctx context.Context, jobType string) (*Job, error)
- func (s *JobStore) SaveJob(ctx context.Context, job *Job) error
- func (s *JobStore) SetJobStatus(ctx context.Context, job *Job, status string) error
- func (s *JobStore) UpdateJob(ctx context.Context, job *Job) error
- type KeycloakCredential
- type LifecyclePlacementJob
- type LifecycleResourceJob
- type Model
- type OcpClusterStatusBody
- type OcpFleetStatusBody
- type OcpSandbox
- type OcpSandboxProvider
- func (a *OcpSandboxProvider) CreateOcpFleetStatusJob(ctx context.Context) (*Job, error)
- func (a *OcpSandboxProvider) FetchAll() ([]OcpSandbox, error)
- func (a *OcpSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]OcpSandbox, error)
- func (a *OcpSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]OcpSandboxWithCreds, error)
- func (p *OcpSandboxProvider) FetchById(id int) (OcpSandbox, error)
- func (p *OcpSandboxProvider) FetchByName(name string) (OcpSandbox, error)
- func (a *OcpSandboxProvider) FleetStatus(ctx context.Context, job *Job)
- func (a *OcpSandboxProvider) GetOcpFleetStatusJob(ctx context.Context) (*Job, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations(annotations map[string]string) ([]OcpSharedClusterConfiguration, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByName(name string) (OcpSharedClusterConfiguration, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurations() (OcpSharedClusterConfigurations, error)
- func (a *OcpSandboxProvider) GetSchedulableClusters(cloudSelector map[string]string, clusterRelation []ClusterRelation, ...) (OcpSharedClusterConfigurations, error)
- func (a *OcpSandboxProvider) IsOcpFleetStatusInProgress(ctx context.Context) bool
- func (a *OcpSandboxProvider) OcpSharedClusterStatus(ctx context.Context, job *Job, conf OcpSharedClusterConfiguration)
- func (a *OcpSandboxProvider) Release(service_uuid string) error
- func (a *OcpSandboxProvider) Request(serviceUuid string, cloudSelector map[string]string, ...) (OcpSandboxWithCreds, error)
- func (a *OcpSandboxProvider) SelfHealStaleFleetStatusJobs(ctx context.Context) error
- type OcpSandboxWithCreds
- func (account *OcpSandboxWithCreds) Delete() error
- func (a *OcpSandboxWithCreds) GetStatus() (string, error)
- func (a *OcpSandboxWithCreds) IncrementCleanupCount() error
- func (a *OcpSandboxWithCreds) MarkForCleanup() error
- func (a *OcpSandboxWithCreds) Reload() error
- func (a *OcpSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
- func (a *OcpSandboxWithCreds) Save() error
- func (a *OcpSandboxWithCreds) SetStatus(status string) error
- func (a *OcpSandboxWithCreds) Update() error
- type OcpSandboxes
- type OcpServiceAccount
- type OcpSharedClusterConfiguration
- func (p *OcpSharedClusterConfiguration) Bind(r *http.Request) error
- func (a *OcpSharedClusterConfiguration) CreateRestConfig() (*rest.Config, error)
- func (p *OcpSharedClusterConfiguration) Delete() error
- func (p *OcpSharedClusterConfiguration) Disable() error
- func (p *OcpSharedClusterConfiguration) Enable() error
- func (p *OcpSharedClusterConfiguration) GetAccountCount() (int, error)
- func (p *OcpSharedClusterConfiguration) Render(w http.ResponseWriter, r *http.Request) error
- func (p *OcpSharedClusterConfiguration) Save() error
- func (a *OcpSharedClusterConfiguration) TestConnection() error
- func (p *OcpSharedClusterConfiguration) Update() error
- func (p *OcpSharedClusterConfiguration) WithoutCredentials() OcpSharedClusterConfiguration
- type OcpSharedClusterConfigurations
- type OperatorInfo
- type Placement
- func (p *Placement) Create() error
- func (p *Placement) Delete(accountProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, ...)
- func (p *Placement) GetLastStatus() ([]*LifecycleResourceJob, error)
- func (p *Placement) LoadActiveResources(awsProvider AwsAccountProvider) error
- func (p *Placement) LoadActiveResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, ...) error
- func (p *Placement) LoadResources(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, ...) error
- func (p *Placement) MarkForCleanup() error
- func (p *Placement) Render(w http.ResponseWriter, r *http.Request) error
- func (p *Placement) SetStatus(status string) error
- type PlacementWithCreds
- type Placements
- type PolicyDocument
- type PolicyStatement
- type Reservation
- func (r *Reservation) Delete(dbpool *pgxpool.Pool) error
- func (r *Reservation) Initialize(dbpool *pgxpool.Pool, a AwsAccountProvider)
- func (r *Reservation) Remove(dbpool *pgxpool.Pool, a AwsAccountProvider)
- func (r *Reservation) Rename(dbpool *pgxpool.Pool, a AwsAccountProvider, name string)
- func (o *Reservation) Render(w http.ResponseWriter, r *http.Request) error
- func (r *Reservation) Save(dbpool *pgxpool.Pool) error
- func (r *Reservation) Update(dbpool *pgxpool.Pool, a AwsAccountProvider, req ReservationRequest)
- func (r *Reservation) UpdateStatus(dbpool *pgxpool.Pool, status string) error
- type ReservationRequest
- type Reservations
- type Resource
- type ResourceRequest
- type ResourceWithCreds
- type Sortable
- type Status
- type Token
- type TokenResponse
- type Tokens
Constants ¶
const ( DebugForceFailKey contextKey = "debug_force_fail" DebugForceTimeoutKey contextKey = "debug_force_timeout" FleetStatusTimeoutKey contextKey = "fleet_status_timeout" // Fleet status operation timeout FleetStatusTimeout = 3 * time.Minute // Individual cluster status timeout ClusterStatusTimeout = 2 * time.Minute )
Variables ¶
var DNSErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
var DNSErrNoSchedule error = errors.New("No DNS account configuration found")
var DNSnameRegex = regexp.MustCompile(`^[a-zA-Z0-9-]+$`)
var ErrAccountNotFound = errors.New("account not found")
var ErrNoClaim = errors.New("no claim")
var ErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
var (
ErrNoJobFound = errors.New("no job found for type")
)
Sentinel errors for jobs
var ErrNoSchedule error = errors.New("No OCP shared cluster configuration found")
var IBMErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
var IBMErrNoSchedule error = errors.New("No IBM resource group account configuration found")
var IBMResourceGroupSandboxNameRegex = regexp.MustCompile(`^[a-zA-Z0-9-]+$`)
var OcpErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
Functions ¶
func ApplyQuota ¶ added in v1.0.0
func ApplyQuota(requestedQuotaOrig *v1.ResourceQuota, defaultQuota *v1.ResourceQuota, strictDefaultSandboxQuota bool) *v1.ResourceQuota
func CountAvailable ¶
func CountAvailable[T AvailabilityMarker](resources []T) int
CountAvailable return the number of resources not in use
func CountOlder ¶
CountOlder returns the number of accounts in use for more than N day
func CountToCleanup ¶
func CountToCleanup[T AvailabilityMarker](resources []T) int
CountToCleanup return the number of accounts to cleanup
func CountUsed ¶
func CountUsed[T AvailabilityMarker](resources []T) int
CountUsed return the number of resources in use
func DNSguessNextGuid ¶ added in v1.1.0
func DeletePlacementByServiceUuid ¶
func DeletePlacementByServiceUuid(dbpool *pgxpool.Pool, awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, dnsProvider DNSSandboxProvider, ibmProvider IBMResourceGroupSandboxProvider, serviceUuid string) error
DeletePlacementByServiceUuid deletes a placement by ServiceUuid
func FilterByReservation ¶ added in v0.3.5
func FilterByReservation[T AvailabilityMarker](resources []T, reservation string) []T
func GetJobBody ¶ added in v1.1.8
GetJobBody is a generic function that can parse any body type 'T'.
func IBMResourceGroupSandboxGuessNextGuid ¶ added in v1.1.0
func SetJobBody ¶ added in v1.1.8
SetJobBody is a generic function that takes any struct 'T' and sets it as the job's body in the map[string]any format.
Types ¶
type APIKeyResponse ¶ added in v1.1.0
type APIKeyResponse struct {
AccessAPIKey string `json:"access_apikey"`
}
type Annotations ¶ added in v0.3.17
func (Annotations) Merge ¶ added in v0.3.17
func (a Annotations) Merge(b Annotations) Annotations
type AvailabilityMarker ¶
type AvailabilityMarker interface {
GetReservation() string
// contains filtered or unexported methods
}
type AwsAccount ¶
type AwsAccount struct {
Account
Kind string `json:"kind"` // "AwsSandbox"
Name string `json:"name"`
Reservation string `json:"reservation,omitempty"`
AccountID string `json:"account_id"`
Zone string `json:"zone"`
HostedZoneID string `json:"hosted_zone_id"`
ConanStatus string `json:"conan_status,omitempty"`
ConanTimestamp time.Time `json:"conan_timestamp,omitempty"`
ConanHostname string `json:"conan_hostname,omitempty"`
ConanCleanupCount int `json:"conan_cleanup_count,omitempty"`
}
func (AwsAccount) CloseAccount ¶ added in v0.3.16
func (a AwsAccount) CloseAccount() error
func (AwsAccount) GetLastStatus ¶ added in v0.3.0
func (a AwsAccount) GetLastStatus(dbpool *pgxpool.Pool) (*LifecycleResourceJob, error)
func (AwsAccount) GetReservation ¶ added in v0.3.5
func (a AwsAccount) GetReservation() string
func (AwsAccount) GetUpdatedAt ¶
func (a AwsAccount) GetUpdatedAt() time.Time
func (AwsAccount) NameInt ¶
func (a AwsAccount) NameInt() int
func (*AwsAccount) Render ¶ added in v0.3.5
func (a *AwsAccount) Render(w http.ResponseWriter, r *http.Request) error
func (AwsAccount) Start ¶ added in v0.3.0
func (a AwsAccount) Start(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
Start method starts all the stopped instances in the account
func (AwsAccount) Status ¶ added in v0.3.0
func (a AwsAccount) Status(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) (Status, error)
Status method returns the status of all the instances in the account
func (AwsAccount) Stop ¶ added in v0.3.0
func (a AwsAccount) Stop(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
Stop method stops all the running instances in the account
type AwsAccountProvider ¶
type AwsAccountProvider interface {
//Annotations(account AwsAccount) (map[string]string, error)
CountAll() (int, error)
CountReservation(reservation string) (int, error)
CountReservationAvailable(reservation string) (int, error)
DecryptSecret(encrypted string) (string, error)
Delete(name string) error
FetchAll() ([]AwsAccount, error)
FetchAllActiveByServiceUuid(serviceUuid string) ([]AwsAccount, error)
FetchAllActiveByServiceUuidWithCreds(serviceUuid string) ([]AwsAccountWithCreds, error)
FetchAllAvailable() ([]AwsAccount, error)
FetchAllByReservation(reservation string) ([]AwsAccount, error)
FetchAllByServiceUuid(serviceUuid string) ([]AwsAccount, error)
FetchAllByServiceUuidWithCreds(serviceUuid string) ([]AwsAccountWithCreds, error)
FetchAllSorted(by string) ([]AwsAccount, error)
FetchAllToCleanup() ([]AwsAccount, error)
FetchByName(name string) (AwsAccount, error)
MarkForCleanup(name string) error
MarkForCleanupByServiceUuid(serviceUuid string) error
Request(service_uuid string, reservation string, count int, annotations Annotations) ([]AwsAccountWithCreds, error)
GetCandidates(reservation string, count int) ([]AwsAccount, error)
Reserve(reservation string, count int) ([]AwsAccount, error)
ScaleDownReservation(reservation string, count int) error
RenameReservation(oldName, newName string) error
}
AwsAccountProvider interface to interact with different databases: dynamodb and postgresql
type AwsAccountWithCreds ¶
type AwsAccountWithCreds struct {
AwsAccount
Credentials []any `json:"credentials"`
Provider AwsAccountProvider `json:"-"`
}
func (*AwsAccountWithCreds) Delete ¶ added in v0.3.17
func (a *AwsAccountWithCreds) Delete() error
func (*AwsAccountWithCreds) Render ¶ added in v0.3.17
func (a *AwsAccountWithCreds) Render(w http.ResponseWriter, r *http.Request) error
type AwsAccounts ¶ added in v0.3.5
type AwsAccounts []AwsAccount
func (*AwsAccounts) Render ¶ added in v0.3.5
func (a *AwsAccounts) Render(w http.ResponseWriter, r *http.Request) error
type ByWeight ¶ added in v1.1.0
type ByWeight []OcpSharedClusterConfiguration
type ClusterRelation ¶ added in v1.1.0
type DNSAccountConfiguration ¶ added in v1.1.0
type DNSAccountConfiguration struct {
ID int `json:"id"`
Name string `json:"name"`
AwsAccessKeyID string `json:"aws_access_key_id"`
AwsSecretAccessKey string `json:"aws_secret_access_key"`
Zone string `json:"zone"`
HostedZoneID string `json:"hosted_zone_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Annotations map[string]string `json:"annotations"`
Valid bool `json:"valid"`
AdditionalVars map[string]any `json:"additional_vars,omitempty"`
DbPool *pgxpool.Pool `json:"-"`
VaultSecret string `json:"-"`
}
func MakeDNSAccountConfiguration ¶ added in v1.1.0
func MakeDNSAccountConfiguration() *DNSAccountConfiguration
MakeDNSAccountConfiguration creates a new DNSAccountConfiguration with default values
func (*DNSAccountConfiguration) Bind ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Bind(r *http.Request) error
Bind and Render
func (*DNSAccountConfiguration) Delete ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Delete() error
func (*DNSAccountConfiguration) Disable ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Disable() error
Disable an DNSAccountConfiguration
func (*DNSAccountConfiguration) Enable ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Enable() error
Enable an DNSAccountConfiguration
func (*DNSAccountConfiguration) GetAccountCount ¶ added in v1.1.0
func (p *DNSAccountConfiguration) GetAccountCount() (int, error)
CountAccounts returns the number of accounts for an DNSAccountConfiguration
func (*DNSAccountConfiguration) Render ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Render(w http.ResponseWriter, r *http.Request) error
func (*DNSAccountConfiguration) Save ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Save() error
func (*DNSAccountConfiguration) Update ¶ added in v1.1.0
func (p *DNSAccountConfiguration) Update() error
type DNSAccountConfigurations ¶ added in v1.1.0
type DNSAccountConfigurations []DNSAccountConfiguration
func (*DNSAccountConfigurations) Render ¶ added in v1.1.0
func (p *DNSAccountConfigurations) Render(w http.ResponseWriter, r *http.Request) error
Bind and Render for DNSAccountConfigurations
type DNSSandbox ¶ added in v1.1.0
type DNSSandbox struct {
Account
Name string `json:"name"`
Kind string `json:"kind"` // "DNSSandbox"
ServiceUuid string `json:"service_uuid"`
DNSAccountConfigurationName string `json:"dns_account"`
Annotations map[string]string `json:"annotations"`
Status string `json:"status"`
ErrorMessage string `json:"error_message,omitempty"`
CleanupCount int `json:"cleanup_count"`
AdditionalVars map[string]any `json:"additional_vars,omitempty"`
ToCleanup bool `json:"to_cleanup"`
}
func (*DNSSandbox) Delete ¶ added in v1.1.0
func (sandbox *DNSSandbox) Delete() error
func (*DNSSandbox) Render ¶ added in v1.1.0
func (a *DNSSandbox) Render(w http.ResponseWriter, r *http.Request) error
type DNSSandboxProvider ¶ added in v1.1.0
func NewDNSSandboxProvider ¶ added in v1.1.0
func NewDNSSandboxProvider(dbpool *pgxpool.Pool, vaultSecret string) DNSSandboxProvider
func (*DNSSandboxProvider) FetchAll ¶ added in v1.1.0
func (a *DNSSandboxProvider) FetchAll() ([]DNSSandbox, error)
func (*DNSSandboxProvider) FetchAllByServiceUuid ¶ added in v1.1.0
func (a *DNSSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]DNSSandbox, error)
func (*DNSSandboxProvider) FetchAllByServiceUuidWithCreds ¶ added in v1.1.0
func (a *DNSSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]DNSSandboxWithCreds, error)
func (*DNSSandboxProvider) FetchById ¶ added in v1.1.0
func (p *DNSSandboxProvider) FetchById(id int) (DNSSandbox, error)
func (*DNSSandboxProvider) FetchByName ¶ added in v1.1.0
func (p *DNSSandboxProvider) FetchByName(name string) (DNSSandbox, error)
func (*DNSSandboxProvider) GetDNSAccountConfigurationByAnnotations ¶ added in v1.1.0
func (p *DNSSandboxProvider) GetDNSAccountConfigurationByAnnotations(annotations map[string]string) ([]DNSAccountConfiguration, error)
GetDNSAccountConfigurationByAnnotations returns a list of DNSAccountConfiguration by annotations
func (*DNSSandboxProvider) GetDNSAccountConfigurationByName ¶ added in v1.1.0
func (p *DNSSandboxProvider) GetDNSAccountConfigurationByName(name string) (DNSAccountConfiguration, error)
GetDNSAccountConfigurationByName returns an DNSAccountConfiguration by name
func (*DNSSandboxProvider) GetDNSAccountConfigurations ¶ added in v1.1.0
func (p *DNSSandboxProvider) GetDNSAccountConfigurations() (DNSAccountConfigurations, error)
GetDNSAccountConfigurations returns the full list of DNSAccountConfiguration
func (*DNSSandboxProvider) GetSchedulableAccounts ¶ added in v1.1.0
func (a *DNSSandboxProvider) GetSchedulableAccounts(cloud_selector map[string]string) (DNSAccountConfigurations, error)
func (*DNSSandboxProvider) Release ¶ added in v1.1.0
func (a *DNSSandboxProvider) Release(service_uuid string) error
type DNSSandboxWithCreds ¶ added in v1.1.0
type DNSSandboxWithCreds struct {
DNSSandbox
Credentials []any `json:"credentials,omitempty"`
Provider *DNSSandboxProvider `json:"-"`
}
func (*DNSSandboxWithCreds) Delete ¶ added in v1.1.0
func (sandbox *DNSSandboxWithCreds) Delete() error
func (*DNSSandboxWithCreds) GetStatus ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) GetStatus() (string, error)
func (*DNSSandboxWithCreds) IncrementCleanupCount ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) IncrementCleanupCount() error
func (*DNSSandboxWithCreds) MarkForCleanup ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) MarkForCleanup() error
func (*DNSSandboxWithCreds) Reload ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) Reload() error
func (*DNSSandboxWithCreds) Render ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
func (*DNSSandboxWithCreds) Save ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) Save() error
func (*DNSSandboxWithCreds) SetStatus ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) SetStatus(status string) error
func (*DNSSandboxWithCreds) Update ¶ added in v1.1.0
func (a *DNSSandboxWithCreds) Update() error
type DNSSandboxes ¶ added in v1.1.0
type DNSSandboxes []DNSSandbox
type DNSServiceAccount ¶ added in v1.1.0
type DNSServiceAccount struct {
Kind string `json:"kind"` // "DNSServiceAccount"
AwsAccessKeyID string `json:"aws_access_key_id"`
AwsSecretAccessKey string `json:"aws_secret_access_key"`
Zone string `json:"zone"`
HostedZoneID string `json:"hosted_zone_id"`
}
Credential for service account
type IBMResourceGroupSandbox ¶ added in v1.1.0
type IBMResourceGroupSandbox struct {
Account
Name string `json:"name"`
Kind string `json:"kind"` // "IBMResourceGroupSandbox"
ServiceUuid string `json:"service_uuid"`
IBMResourceGroupSandboxConfigurationName string `json:"ibm_resource_group_account"`
Annotations map[string]string `json:"annotations"`
Status string `json:"status"`
ErrorMessage string `json:"error_message,omitempty"`
ResourceGroup string `json:"resourcegroup"`
CleanupCount int `json:"cleanup_count"`
DeployerAdditionalVars map[string]any `json:"additional_vars,omitempty"`
ToCleanup bool `json:"to_cleanup"`
}
func (*IBMResourceGroupSandbox) Render ¶ added in v1.1.0
func (a *IBMResourceGroupSandbox) Render(w http.ResponseWriter, r *http.Request) error
type IBMResourceGroupSandboxConfiguration ¶ added in v1.1.0
type IBMResourceGroupSandboxConfiguration struct {
ID int `json:"id"`
Name string `json:"name"`
APIKey string `json:"apikey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Annotations map[string]string `json:"annotations"`
Valid bool `json:"valid"`
AdditionalVars map[string]any `json:"additional_vars,omitempty"`
DbPool *pgxpool.Pool `json:"-"`
VaultSecret string `json:"-"`
}
func MakeIBMResourceGroupSandboxConfiguration ¶ added in v1.1.0
func MakeIBMResourceGroupSandboxConfiguration() *IBMResourceGroupSandboxConfiguration
MakeIBMResourceGroupSandboxConfiguration creates a new IBMResourceGroupSandboxConfiguration with default values
func (*IBMResourceGroupSandboxConfiguration) Bind ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Bind(r *http.Request) error
Bind and Render
func (*IBMResourceGroupSandboxConfiguration) Delete ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Delete() error
func (*IBMResourceGroupSandboxConfiguration) Disable ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Disable() error
Disable an IBMResourceGroupSandboxConfiguration
func (*IBMResourceGroupSandboxConfiguration) Enable ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Enable() error
Enable an IBMResourceGroupSandboxConfiguration
func (*IBMResourceGroupSandboxConfiguration) GetAccountCount ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) GetAccountCount() (int, error)
CountAccounts returns the number of accounts for an IBMResourceGroupSandboxConfiguration
func (*IBMResourceGroupSandboxConfiguration) Render ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Render(w http.ResponseWriter, r *http.Request) error
func (*IBMResourceGroupSandboxConfiguration) Save ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Save() error
func (*IBMResourceGroupSandboxConfiguration) Update ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfiguration) Update() error
type IBMResourceGroupSandboxConfigurations ¶ added in v1.1.0
type IBMResourceGroupSandboxConfigurations []IBMResourceGroupSandboxConfiguration
func (*IBMResourceGroupSandboxConfigurations) Render ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxConfigurations) Render(w http.ResponseWriter, r *http.Request) error
Bind and Render for IBMResourceGroupSandboxConfigurations
type IBMResourceGroupSandboxProvider ¶ added in v1.1.0
type IBMResourceGroupSandboxProvider struct {
DbPool *pgxpool.Pool `json:"-"`
VaultSecret string `json:"-"`
}
func NewIBMResourceGroupSandboxProvider ¶ added in v1.1.0
func NewIBMResourceGroupSandboxProvider(dbpool *pgxpool.Pool, vaultSecret string) IBMResourceGroupSandboxProvider
func (*IBMResourceGroupSandboxProvider) FetchAll ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxProvider) FetchAll() ([]IBMResourceGroupSandbox, error)
func (*IBMResourceGroupSandboxProvider) FetchAllByServiceUuid ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]IBMResourceGroupSandbox, error)
func (*IBMResourceGroupSandboxProvider) FetchAllByServiceUuidWithCreds ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]IBMResourceGroupSandboxWithCreds, error)
func (*IBMResourceGroupSandboxProvider) FetchById ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxProvider) FetchById(id int) (IBMResourceGroupSandbox, error)
func (*IBMResourceGroupSandboxProvider) FetchByName ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxProvider) FetchByName(name string) (IBMResourceGroupSandbox, error)
func (*IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByAnnotations ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByAnnotations(annotations map[string]string) ([]IBMResourceGroupSandboxConfiguration, error)
GetIBMResourceGroupSandboxConfigurationByAnnotations returns a list of IBMResourceGroupSandboxConfiguration by annotations
func (*IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByName ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurationByName(name string) (IBMResourceGroupSandboxConfiguration, error)
GetIBMResourceGroupSandboxConfigurationByName returns an IBMResourceGroupSandboxConfiguration by name
func (*IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurations ¶ added in v1.1.0
func (p *IBMResourceGroupSandboxProvider) GetIBMResourceGroupSandboxConfigurations() (IBMResourceGroupSandboxConfigurations, error)
GetIBMResourceGroupSandboxConfigurations returns the full list of IBMResourceGroupSandboxConfiguration
func (*IBMResourceGroupSandboxProvider) GetSchedulableAccounts ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxProvider) GetSchedulableAccounts(cloud_selector map[string]string) (IBMResourceGroupSandboxConfigurations, error)
func (*IBMResourceGroupSandboxProvider) Release ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxProvider) Release(service_uuid string) error
type IBMResourceGroupSandboxWithCreds ¶ added in v1.1.0
type IBMResourceGroupSandboxWithCreds struct {
IBMResourceGroupSandbox
Credentials []any `json:"credentials,omitempty"`
Provider *IBMResourceGroupSandboxProvider `json:"-"`
}
func (*IBMResourceGroupSandboxWithCreds) Delete ¶ added in v1.1.0
func (account *IBMResourceGroupSandboxWithCreds) Delete() error
func (*IBMResourceGroupSandboxWithCreds) GetStatus ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) GetStatus() (string, error)
func (*IBMResourceGroupSandboxWithCreds) IncrementCleanupCount ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) IncrementCleanupCount() error
func (*IBMResourceGroupSandboxWithCreds) MarkForCleanup ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) MarkForCleanup() error
func (*IBMResourceGroupSandboxWithCreds) Reload ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) Reload() error
func (*IBMResourceGroupSandboxWithCreds) Render ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
func (*IBMResourceGroupSandboxWithCreds) Save ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) Save() error
func (*IBMResourceGroupSandboxWithCreds) SetStatus ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) SetStatus(status string) error
func (*IBMResourceGroupSandboxWithCreds) Update ¶ added in v1.1.0
func (a *IBMResourceGroupSandboxWithCreds) Update() error
type IBMResourceGroupSandboxes ¶ added in v1.1.0
type IBMResourceGroupSandboxes []IBMResourceGroupSandbox
type IBMResourceGroupServiceAccount ¶ added in v1.1.0
type IBMResourceGroupServiceAccount struct {
Name string `json:"name"`
APIKey string `json:"apikey"`
}
Credential for service account
type Job ¶ added in v1.1.8
type Job struct {
Model
RequestID string `json:"request_id,omitempty"`
ParentJobID int `json:"parent_job_id,omitempty"`
PlacementID int `json:"placement_id,omitempty"`
Locality string `json:"locality,omitempty"`
Status string `json:"status,omitempty"`
JobType string `json:"job_type,omitempty"`
Body map[string]any `json:"body,omitempty"`
CompletedAt time.Time `json:"completed_at"`
}
Generic job
type JobStore ¶ added in v1.1.8
func NewJobStore ¶ added in v1.1.8
func (*JobStore) GetJobByID ¶ added in v1.1.8
func (*JobStore) GetJobByRequestID ¶ added in v1.1.8
func (*JobStore) GetJobsByType ¶ added in v1.1.8
GetJobsByType retrieves all jobs of a specific type from the database.
func (*JobStore) GetLatestJobByType ¶ added in v1.1.8
func (*JobStore) SaveJob ¶ added in v1.1.8
SaveJob saves a job to the database, creating it if it doesn't exist or updating it if it does.
func (*JobStore) SetJobStatus ¶ added in v1.1.8
SetJobStatus updates the status of a job in the database.
type KeycloakCredential ¶ added in v1.1.4
type KeycloakCredential struct {
Kind string `json:"kind"` // "KeycloakCredential"
Username string `json:"username"`
Password string `json:"password"`
}
Credential for keycloak account
type LifecyclePlacementJob ¶ added in v0.3.0
type LifecyclePlacementJob struct {
Model
PlacementID int `json:"placement_id"`
Status string `json:"status"`
Action string `json:"lifecycle_action"`
Request any `json:"request,omitempty"`
RequestID string `json:"request_id,omitempty"`
DbPool *pgxpool.Pool `json:"-"`
Locality string `json:"locality,omitempty"`
}
func GetLifecyclePlacementJob ¶ added in v0.3.0
func GetLifecyclePlacementJob(dbpool *pgxpool.Pool, id int) (*LifecyclePlacementJob, error)
GetLifecyclePlacementJob returns a LifecyclePlacementJob by ID
func GetLifecyclePlacementJobByRequestID ¶ added in v0.3.3
func GetLifecyclePlacementJobByRequestID(dbpool *pgxpool.Pool, requestID string) (*LifecyclePlacementJob, error)
GetLifecyclePlacementJob returns a LifecyclePlacementJob by ID
func (*LifecyclePlacementJob) Claim ¶ added in v0.3.0
func (j *LifecyclePlacementJob) Claim() error
ClaimPlacementJob claims a placement job by setting the status to initializing
func (*LifecyclePlacementJob) Create ¶ added in v0.3.3
func (j *LifecyclePlacementJob) Create() error
Create creates a new LifecyclePlacementJob by inserting it into the database
func (*LifecyclePlacementJob) GlobalStatus ¶ added in v0.3.3
func (j *LifecyclePlacementJob) GlobalStatus() (string, error)
GlobalStatus returns the status of a LifecyclePlacementJob considering all it's children
func (*LifecyclePlacementJob) SetStatus ¶ added in v0.3.0
func (j *LifecyclePlacementJob) SetStatus(status string) error
SetLifecycleResourceJobStatus sets the status of a LifecycleResourceJob
type LifecycleResourceJob ¶ added in v0.3.0
type LifecycleResourceJob struct {
Model
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
ParentID int `json:"parent_id,omitempty"`
Status string `json:"status"`
Action string `json:"lifecycle_action"`
Request any `json:"request,omitempty"`
RequestID string `json:"request_id,omitempty"`
DbPool *pgxpool.Pool `json:"-"`
Result Status `json:"lifecycle_result,omitempty"`
Locality string `json:"locality,omitempty"`
}
func GetLifecycleResourceJob ¶ added in v0.3.0
func GetLifecycleResourceJob(dbpool *pgxpool.Pool, id int) (*LifecycleResourceJob, error)
GetLifecycleResourceJob returns a LifecycleResourceJob by ID
func GetLifecycleResourceJobByRequestID ¶ added in v0.3.3
func GetLifecycleResourceJobByRequestID(dbpool *pgxpool.Pool, requestID string) (*LifecycleResourceJob, error)
func (*LifecycleResourceJob) Claim ¶ added in v0.3.0
func (j *LifecycleResourceJob) Claim() error
ClaimResourceJob claims a resource job by setting the status to initializing
func (*LifecycleResourceJob) Create ¶ added in v0.3.0
func (j *LifecycleResourceJob) Create() error
Create creates a new LifecycleResourceJob by inserting it into the database
func (*LifecycleResourceJob) SetStatus ¶ added in v0.3.0
func (j *LifecycleResourceJob) SetStatus(status string) error
SetLifecycleResourceJobStatus sets the status of a LifecycleResourceJob
type OcpClusterStatusBody ¶ added in v1.1.8
type OcpClusterStatusBody struct {
ClusterName string `json:"cluster_name"`
OCPVersion string `json:"ocp_version,omitempty"`
OCPUpdateHistory []any `json:"ocp_update_history,omitempty"`
NodeSummary map[string]int `json:"node_summary"`
OperatorStatus map[string]OperatorInfo `json:"operator_status"`
Configuration OcpSharedClusterConfiguration `json:"configuration"`
Message string `json:"message,omitempty"`
}
A struct to hold the status results for a single cluster
type OcpFleetStatusBody ¶ added in v1.1.8
type OcpFleetStatusBody struct {
Clusters map[string]OcpClusterStatusBody `json:"clusters,omitempty"`
Message string `json:"message,omitempty"`
}
OcpFleetStatusBody holds the aggregated status for all OCP clusters.
type OcpSandbox ¶ added in v0.3.17
type OcpSandbox struct {
Account
Name string `json:"name"`
Kind string `json:"kind"` // "OcpSandbox"
ServiceUuid string `json:"service_uuid"`
OcpIngressDomain string `json:"ingress_domain"`
OcpApiUrl string `json:"api_url"`
OcpConsoleUrl string `json:"console_url,omitempty"`
Annotations map[string]string `json:"annotations"`
Status string `json:"status"`
ErrorMessage string `json:"error_message,omitempty"`
CleanupCount int `json:"cleanup_count"`
Namespace string `json:"namespace"`
ClusterAdditionalVars map[string]any `json:"cluster_additional_vars,omitempty"`
ToCleanup bool `json:"to_cleanup"`
Quota v1.ResourceList `json:"quota,omitempty"`
LimitRange *v1.LimitRange `json:"limit_range,omitempty"`
Alias string `json:"alias,omitempty"`
}
func (*OcpSandbox) Render ¶ added in v0.3.17
func (a *OcpSandbox) Render(w http.ResponseWriter, r *http.Request) error
type OcpSandboxProvider ¶ added in v0.3.17
func NewOcpSandboxProvider ¶ added in v0.3.17
func NewOcpSandboxProvider(dbpool *pgxpool.Pool, vaultSecret string) OcpSandboxProvider
func (*OcpSandboxProvider) CreateOcpFleetStatusJob ¶ added in v1.1.8
func (a *OcpSandboxProvider) CreateOcpFleetStatusJob(ctx context.Context) (*Job, error)
func (*OcpSandboxProvider) FetchAll ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAll() ([]OcpSandbox, error)
func (*OcpSandboxProvider) FetchAllByServiceUuid ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]OcpSandbox, error)
func (*OcpSandboxProvider) FetchAllByServiceUuidWithCreds ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]OcpSandboxWithCreds, error)
func (*OcpSandboxProvider) FetchById ¶ added in v0.3.17
func (p *OcpSandboxProvider) FetchById(id int) (OcpSandbox, error)
func (*OcpSandboxProvider) FetchByName ¶ added in v0.3.17
func (p *OcpSandboxProvider) FetchByName(name string) (OcpSandbox, error)
func (*OcpSandboxProvider) FleetStatus ¶ added in v1.1.8
func (a *OcpSandboxProvider) FleetStatus(ctx context.Context, job *Job)
FleetStatus checks the status of all OCP shared clusters. It loops through all OCP shared cluster configurations and creates a job for each one. For each shared cluster, the job will check the following: - The status of the cluster - The OCP Version - versions of the installed operators - Number and type of nodes/workers - The status of the nodes/workers Once all jobs are done, the status of the fleetStatus is set to "success" or "error". This function is executed in a goroutine, so it can be run asynchronously. Each individual cluster check has a timeout of 2m after which it will be killed and marked as "error". The entire fleet status operation has a timeout of 3m to prevent stuck jobs.
func (*OcpSandboxProvider) GetOcpFleetStatusJob ¶ added in v1.1.8
func (a *OcpSandboxProvider) GetOcpFleetStatusJob(ctx context.Context) (*Job, error)
GetOcpFleetStatusJob retrieves the status of all OCP shared clusters.
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations(annotations map[string]string) ([]OcpSharedClusterConfiguration, error)
GetOcpSharedClusterConfigurationByAnnotations returns a list of OcpSharedClusterConfiguration by annotations
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurationByName ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByName(name string) (OcpSharedClusterConfiguration, error)
GetOcpSharedClusterConfigurationByName returns an OcpSharedClusterConfiguration by name
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurations ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurations() (OcpSharedClusterConfigurations, error)
GetOcpSharedClusterConfigurations returns the full list of OcpSharedClusterConfiguration
func (*OcpSandboxProvider) GetSchedulableClusters ¶ added in v0.3.17
func (a *OcpSandboxProvider) GetSchedulableClusters( cloudSelector map[string]string, clusterRelation []ClusterRelation, multipleAccounts []OcpSandboxWithCreds, alias string, ) (OcpSharedClusterConfigurations, error)
func (*OcpSandboxProvider) IsOcpFleetStatusInProgress ¶ added in v1.1.8
func (a *OcpSandboxProvider) IsOcpFleetStatusInProgress(ctx context.Context) bool
func (*OcpSandboxProvider) OcpSharedClusterStatus ¶ added in v1.1.8
func (a *OcpSandboxProvider) OcpSharedClusterStatus(ctx context.Context, job *Job, conf OcpSharedClusterConfiguration)
OcpSharedClusterStatus checks: - The status of the cluster - The OCP Version - versions of the installed operators - Number and type of nodes/workers - The status of the nodes/workers
func (*OcpSandboxProvider) Release ¶ added in v0.3.17
func (a *OcpSandboxProvider) Release(service_uuid string) error
func (*OcpSandboxProvider) Request ¶ added in v0.3.17
func (a *OcpSandboxProvider) Request( serviceUuid string, cloudSelector map[string]string, cloudPreference map[string]string, annotations map[string]string, requestedQuota *v1.ResourceList, requestedLimitRange *v1.LimitRange, multiple bool, multipleAccounts []OcpSandboxWithCreds, ctx context.Context, asyncRequest bool, alias string, clusterRelation []ClusterRelation, ) (OcpSandboxWithCreds, error)
func (*OcpSandboxProvider) SelfHealStaleFleetStatusJobs ¶ added in v1.1.14
func (a *OcpSandboxProvider) SelfHealStaleFleetStatusJobs(ctx context.Context) error
SelfHealStaleFleetStatusJobs checks for stale fleet status jobs and marks them as error. This is called before creating a new fleet status job to ensure we don't get stuck with zombie jobs blocking new requests.
type OcpSandboxWithCreds ¶ added in v0.3.17
type OcpSandboxWithCreds struct {
OcpSandbox
Credentials []any `json:"credentials,omitempty"`
Provider *OcpSandboxProvider `json:"-"`
}
func (*OcpSandboxWithCreds) Delete ¶ added in v0.3.17
func (account *OcpSandboxWithCreds) Delete() error
func (*OcpSandboxWithCreds) GetStatus ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) GetStatus() (string, error)
func (*OcpSandboxWithCreds) IncrementCleanupCount ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) IncrementCleanupCount() error
func (*OcpSandboxWithCreds) MarkForCleanup ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) MarkForCleanup() error
func (*OcpSandboxWithCreds) Reload ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Reload() error
func (*OcpSandboxWithCreds) Render ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
func (*OcpSandboxWithCreds) Save ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Save() error
func (*OcpSandboxWithCreds) SetStatus ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) SetStatus(status string) error
func (*OcpSandboxWithCreds) Update ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Update() error
type OcpSandboxes ¶ added in v0.3.17
type OcpSandboxes []OcpSandbox
type OcpServiceAccount ¶ added in v0.3.17
type OcpServiceAccount struct {
Kind string `json:"kind"` // "ServiceAccount"
Name string `json:"name"`
Token string `json:"token"`
}
Credential for service account
type OcpSharedClusterConfiguration ¶ added in v0.3.17
type OcpSharedClusterConfiguration struct {
// for an OcpSandbox, a default ResourceQuota will be set.
// This quota is designed to be large enough to accommodate general needs.
// Additionally, content developers can specify custom quotas in agnosticV
// based on the requirements of specific Labs/Demos.
DefaultSandboxQuota *v1.ResourceQuota `json:"default_sandbox_quota"`
// should be strictly enforced. If set to true, the default sandbox quota will be
// enforced as a hard limit. Requested quota not be allowed to exceed the default.
// If set to false, the default sandbox will be updated
// to the requested quota.
StrictDefaultSandboxQuota bool `json:"strict_default_sandbox_quota"`
// for an OcpSandbox.
// If set to true, a quota must be provided in the request.
// If set to false, a quota will be created based on the default sandbox quota.
// By default it's false.
QuotaRequired bool `json:"quota_required"`
// if set to true, the sandbox quota will not be created
// if set to false, the sandbox quota will be created, depending on the value of QuotaRequired, DefaultSandboxQuota and StrictDefaultSandboxQuota
// By default it's true.
// TODO: change the default value to false
SkipQuota bool `json:"skip_quota"`
// This allows to set the default limit and request for pods
// see https://kubernetes.io/docs/concepts/policy/limit-range/
LimitRange *v1.LimitRange `json:"limit_range,omitempty"`
// Higher value means the cluster will be prioritized
// The cloud_preference field in the ResourceRequest will increase
// the value if the labels match. More matching labels means higher weight.
// The clusters with the highest weight will be selected first.
Weight int `json:"weight,omitempty"`
}
func ApplyPriorityWeight ¶ added in v1.1.0
func ApplyPriorityWeight( clusters []OcpSharedClusterConfiguration, preferences map[string]string, weight int, ) []OcpSharedClusterConfiguration
ApplyPriorityWeight function sorts the clusters by applying weight using the passed preferences. Then the list is sorted using the weight
func MakeOcpSharedClusterConfiguration ¶ added in v1.0.0
func MakeOcpSharedClusterConfiguration() *OcpSharedClusterConfiguration
MakeOcpSharedClusterConfiguration creates a new OcpSharedClusterConfiguration with default values
func (*OcpSharedClusterConfiguration) Bind ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Bind(r *http.Request) error
Bind and Render
func (*OcpSharedClusterConfiguration) CreateRestConfig ¶ added in v0.3.20
func (a *OcpSharedClusterConfiguration) CreateRestConfig() (*rest.Config, error)
func (*OcpSharedClusterConfiguration) Delete ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Delete() error
func (*OcpSharedClusterConfiguration) Disable ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Disable() error
Disable an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) Enable ¶ added in v0.3.26
func (p *OcpSharedClusterConfiguration) Enable() error
Enable an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) GetAccountCount ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) GetAccountCount() (int, error)
CountAccounts returns the number of accounts for an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) Render ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Render(w http.ResponseWriter, r *http.Request) error
func (*OcpSharedClusterConfiguration) Save ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Save() error
func (*OcpSharedClusterConfiguration) TestConnection ¶ added in v1.0.1
func (a *OcpSharedClusterConfiguration) TestConnection() error
func (*OcpSharedClusterConfiguration) Update ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Update() error
func (*OcpSharedClusterConfiguration) WithoutCredentials ¶ added in v1.1.8
func (p *OcpSharedClusterConfiguration) WithoutCredentials() OcpSharedClusterConfiguration
WithoutCredentials Method to return the OcpSharedClusterConfiguration without any credentials or sensitive information.
type OcpSharedClusterConfigurations ¶ added in v0.3.17
type OcpSharedClusterConfigurations []OcpSharedClusterConfiguration
func (*OcpSharedClusterConfigurations) Render ¶ added in v0.3.17
func (p *OcpSharedClusterConfigurations) Render(w http.ResponseWriter, r *http.Request) error
Bind and Render for OcpSharedClusterConfigurations
type OperatorInfo ¶ added in v1.1.8
type OperatorInfo struct {
Status string `json:"status"`
Version string `json:"version,omitempty"`
}
OperatorInfo holds the status and version for a single OCP Operator.
type Placement ¶
type Placement struct {
Model
ServiceUuid string `json:"service_uuid"`
Status string `json:"status"`
ToCleanup bool `json:"to_cleanup"`
Annotations map[string]string `json:"annotations"`
Resources []any `json:"resources,omitempty"`
Request any `json:"request"`
DbPool *pgxpool.Pool `json:"-"`
FailOnDelete bool `json:"-"` // plumbing for testing
}
func GetPlacement ¶
GetPlacement returns a placement by ID
func GetPlacementByServiceUuid ¶
GetPlacementByServiceUuid returns a placement by service_uuid
func (*Placement) Delete ¶
func (p *Placement) Delete(accountProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, dnsProvider DNSSandboxProvider, ibmProvider IBMResourceGroupSandboxProvider)
Delete deletes a placement
func (*Placement) GetLastStatus ¶ added in v0.3.3
func (p *Placement) GetLastStatus() ([]*LifecycleResourceJob, error)
func (*Placement) LoadActiveResources ¶ added in v0.3.5
func (p *Placement) LoadActiveResources(awsProvider AwsAccountProvider) error
func (*Placement) LoadActiveResourcesWithCreds ¶ added in v0.3.5
func (p *Placement) LoadActiveResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, dnsProvider DNSSandboxProvider, ibmProvider IBMResourceGroupSandboxProvider) error
func (*Placement) LoadResources ¶
func (p *Placement) LoadResources(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, dnsProvider DNSSandboxProvider, ibmProvider IBMResourceGroupSandboxProvider) error
func (*Placement) MarkForCleanup ¶ added in v0.3.19
type PlacementWithCreds ¶
type PlacementWithCreds struct {
Placement
}
func (*PlacementWithCreds) LoadResourcesWithCreds ¶ added in v1.1.9
func (p *PlacementWithCreds) LoadResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, dnsProvider DNSSandboxProvider, ibmProvider IBMResourceGroupSandboxProvider) error
func (*PlacementWithCreds) Render ¶ added in v1.1.9
func (p *PlacementWithCreds) Render(w http.ResponseWriter, r *http.Request) error
type Placements ¶
type Placements []Placement
func GetAllPlacements ¶
func GetAllPlacements(dbpool *pgxpool.Pool) (Placements, error)
func (Placements) Render ¶
func (p Placements) Render(w http.ResponseWriter, r *http.Request) error
type PolicyDocument ¶ added in v1.1.0
type PolicyDocument struct {
Version string
Statement []PolicyStatement
}
PolicyDocument defines a policy document as a Go struct that can be serialized to JSON.
type PolicyStatement ¶ added in v1.1.0
type PolicyStatement struct {
Effect string `json:"Effect"`
Action interface{} `json:"Action"`
Principal map[string]string `json:",omitempty"`
Resource interface{} `json:",omitempty"`
}
PolicyStatement defines a statement in a policy document.
type Reservation ¶ added in v0.3.5
type Reservation struct {
Model
Name string `json:"name"`
Status string `json:"status"`
Request ReservationRequest `json:"request"`
}
func GetReservationByName ¶ added in v0.3.5
func GetReservationByName(dbpool *pgxpool.Pool, name string) (*Reservation, error)
GetReservationByName fetches a reservation by its name returns the reservation and an error
func (*Reservation) Delete ¶ added in v0.3.5
func (r *Reservation) Delete(dbpool *pgxpool.Pool) error
Delete deletes a reservation from the DB
func (*Reservation) Initialize ¶ added in v0.3.5
func (r *Reservation) Initialize(dbpool *pgxpool.Pool, a AwsAccountProvider)
Initialize initializes a reservation It's an async operation that takes care of keeping the resources reserved Status up to date and also update the resources to match what's defined in Request. When everything is in sync, Status is set to 'success' If something goes wrong, Status is set to 'error'
func (*Reservation) Remove ¶ added in v0.3.5
func (r *Reservation) Remove(dbpool *pgxpool.Pool, a AwsAccountProvider)
Delete deletes a reservation This is an async operation that goes through all the reserved resources and unmark them. Then the reservation is deleted from the DB if all goes well. If something goes wrong, the reservation is marked as 'error'
func (*Reservation) Rename ¶ added in v1.1.1
func (r *Reservation) Rename(dbpool *pgxpool.Pool, a AwsAccountProvider, name string)
func (*Reservation) Render ¶ added in v0.3.5
func (o *Reservation) Render(w http.ResponseWriter, r *http.Request) error
func (*Reservation) Save ¶ added in v0.3.5
func (r *Reservation) Save(dbpool *pgxpool.Pool) error
Save saves a reservation to the database Reservations implies async operations. This function is low level and doesn't deal with async operations. For that, see the Initialize and Synchronize methods
func (*Reservation) Update ¶ added in v0.3.5
func (r *Reservation) Update(dbpool *pgxpool.Pool, a AwsAccountProvider, req ReservationRequest)
Update is an async operation to update a reservation from a reservationRequest
func (*Reservation) UpdateStatus ¶ added in v0.3.5
func (r *Reservation) UpdateStatus(dbpool *pgxpool.Pool, status string) error
UpdateStatus updates the status of a reservation
type ReservationRequest ¶ added in v0.3.5
type ReservationRequest struct {
Name string `json:"name"`
Resources []ResourceRequest `json:"resources"`
}
func (*ReservationRequest) Bind ¶ added in v0.3.5
func (r *ReservationRequest) Bind(r2 *http.Request) error
func (*ReservationRequest) Validate ¶ added in v0.3.5
func (r *ReservationRequest) Validate(h AwsAccountProvider) (string, error)
func (*ReservationRequest) ValidateWithCurrent ¶ added in v1.1.12
func (r *ReservationRequest) ValidateWithCurrent(h AwsAccountProvider, currentReservation *Reservation) (string, error)
type Reservations ¶ added in v0.3.5
type Reservations []Reservation
func (Reservations) Render ¶ added in v0.3.5
func (o Reservations) Render(w http.ResponseWriter, r *http.Request) error
type ResourceRequest ¶ added in v0.3.5
type ResourceWithCreds ¶
type Status ¶ added in v0.3.0
type Status struct {
AccountName string `json:"account_name"`
AccountKind string `json:"account_kind"`
Instances []Instance `json:"instances"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Status string `json:"status,omitempty"`
}
Status type
func MakeStatus ¶ added in v0.3.3
func MakeStatus(job *LifecycleResourceJob) Status
type Token ¶
type Token struct {
Model
Kind string `json:"kind"`
Name string `json:"name"`
Role string `json:"role"`
Iat int64 `json:"iat"`
Exp int64 `json:"exp"`
Expiration time.Time `json:"expiration"`
Valid bool `json:"valid"`
}
func (Token) Invalidate ¶
Invalidate the token
type TokenResponse ¶ added in v0.3.17
type TokenResponse struct {
AccessToken string `json:"access_token"`
}