scaleset

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Copyright 2025 Cloudbase Solutions SRL

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	ScaleSets map[uint]*scaleSet

	Entity params.ForgeEntity
	// contains filtered or unexported fields
}

Controller is responsible for managing scale sets for one github entity.

func NewController

func NewController(ctx context.Context, store dbCommon.Store, entity params.ForgeEntity, providers map[string]common.Provider) (*Controller, error)

func (*Controller) ConsolidateRunnerState

func (c *Controller) ConsolidateRunnerState(byScaleSetID map[int][]params.RunnerReference) error

ConsolidateRunnerState will send a list of existing github runners to each scale set worker. The scale set worker will then need to cross check the existing runners in Github with the sate in the database. Any inconsistencies will b reconciliated. This cleans up any manually removed runners in either github or the providers.

func (*Controller) Start

func (c *Controller) Start() (err error)

func (*Controller) Stop

func (c *Controller) Stop() error

type Worker

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

func NewWorker

func NewWorker(ctx context.Context, store dbCommon.Store, scaleSet params.ScaleSet, provider common.Provider) (*Worker, error)

func (*Worker) GetScaleSet

func (w *Worker) GetScaleSet() params.ScaleSet

func (*Worker) GetScaleSetClient

func (w *Worker) GetScaleSetClient() (*scalesets.ScaleSetClient, error)

func (*Worker) HandleJobsAvailable

func (w *Worker) HandleJobsAvailable(jobs []params.ScaleSetJobMessage) error

func (*Worker) HandleJobsCompleted

func (w *Worker) HandleJobsCompleted(jobs []params.ScaleSetJobMessage) (err error)

HandleJobCompleted handles a job completed message. If a job had a runner assigned and was not canceled before it had a chance to run, then we mark that runner as pending_delete.

func (*Worker) HandleJobsStarted

func (w *Worker) HandleJobsStarted(jobs []params.ScaleSetJobMessage) (err error)

HandleJobStarted updates the runners from idle to active in the DB and assigns the job to them.

func (*Worker) Owner

func (w *Worker) Owner() string

func (*Worker) SetDesiredRunnerCount

func (w *Worker) SetDesiredRunnerCount(count int) error

func (*Worker) SetLastMessageID

func (w *Worker) SetLastMessageID(id int64) error

func (*Worker) Start

func (w *Worker) Start() (err error)

func (*Worker) Stop

func (w *Worker) Stop() error

Jump to

Keyboard shortcuts

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