mirror of
https://github.com/siderolabs/omni.git
synced 2025-08-06 17:46:59 +02:00
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-omni-upgrade (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
- Bump some deps, namely cosi-runtime and Talos machinery. - Update `auditState` to implement the new methods in COSI's `state.State`. - Bump default Talos and Kubernetes versions to their latest. - Rekres, which brings Go 1.24.5. Also update it in go.mod files. - Fix linter errors coming from new linters. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package models
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cosi-project/runtime/pkg/resource"
|
|
"github.com/hashicorp/go-multierror"
|
|
|
|
"github.com/siderolabs/omni/client/pkg/omni/resources/omni"
|
|
)
|
|
|
|
// KindWorkers is Workers model kind.
|
|
const KindWorkers = "Workers"
|
|
|
|
// Workers describes Cluster worker nodes.
|
|
type Workers struct {
|
|
MachineSet `yaml:",inline"`
|
|
}
|
|
|
|
// Validate the model.
|
|
func (workers *Workers) Validate() error {
|
|
var multiErr error
|
|
|
|
if workers.Name == omni.ControlPlanesIDSuffix {
|
|
multiErr = multierror.Append(multiErr, fmt.Errorf("name %q cannot be used in workers", omni.ControlPlanesIDSuffix))
|
|
}
|
|
|
|
if workers.BootstrapSpec != nil {
|
|
multiErr = multierror.Append(multiErr, fmt.Errorf("bootstrapSpec is not allowed in workers"))
|
|
}
|
|
|
|
multiErr = joinErrors(multiErr, workers.MachineSet.Validate(), workers.Machines.Validate(), workers.Patches.Validate())
|
|
if multiErr != nil {
|
|
return fmt.Errorf("workers is invalid: %w", multiErr)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Translate the model.
|
|
func (workers *Workers) Translate(ctx TranslateContext) ([]resource.Resource, error) {
|
|
var nameSuffix string
|
|
|
|
if workers.Name == "" {
|
|
nameSuffix = omni.DefaultWorkersIDSuffix
|
|
} else {
|
|
nameSuffix = workers.Name
|
|
}
|
|
|
|
return workers.translate(ctx, nameSuffix, omni.LabelWorkerRole)
|
|
}
|
|
|
|
func init() {
|
|
register[Workers](KindWorkers)
|
|
}
|