mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-24 14:31:47 +01:00
Add Nomad provider
I modeled it off the Kubernetes provider a bit. It supports setting task config at group and task levels using services and meta attributes.
This commit is contained in:
28
internal/model/provider_nomad.go
Normal file
28
internal/model/provider_nomad.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/crazy-max/diun/v4/pkg/utl"
|
||||
)
|
||||
|
||||
// PrdNomad holds nomad provider configuration
|
||||
type PrdNomad struct {
|
||||
Address string `yaml:"address" json:"address,omitempty" validate:"omitempty"`
|
||||
Region string `yaml:"region,omitempty" json:"region,omitempty" validate:"omitempty"`
|
||||
SecretID string `yaml:"secretID,omitempty" json:"secretID,omitempty" validate:"omitempty"`
|
||||
Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty" validate:"omitempty"`
|
||||
TLSInsecure *bool `yaml:"tlsInsecure" json:"tlsInsecure,omitempty" validate:"required"`
|
||||
WatchByDefault *bool `yaml:"watchByDefault" json:"watchByDefault,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
// GetDefaults gets the default values
|
||||
func (s *PrdNomad) GetDefaults() *PrdNomad {
|
||||
n := &PrdNomad{}
|
||||
n.SetDefaults()
|
||||
return n
|
||||
}
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *PrdNomad) SetDefaults() {
|
||||
s.TLSInsecure = utl.NewFalse()
|
||||
s.WatchByDefault = utl.NewFalse()
|
||||
}
|
||||
@@ -7,6 +7,7 @@ type Providers struct {
|
||||
Kubernetes *PrdKubernetes `yaml:"kubernetes,omitempty" json:"kubernetes,omitempty" label:"allowEmpty" file:"allowEmpty"`
|
||||
File *PrdFile `yaml:"file,omitempty" json:"file,omitempty"`
|
||||
Dockerfile *PrdDockerfile `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
|
||||
Nomad *PrdNomad `yaml:"nomad,omitempty" json:"nomad,omitempty" label:"allowEmpty" file:"allowEmpty"`
|
||||
}
|
||||
|
||||
// GetDefaults gets the default values
|
||||
|
||||
Reference in New Issue
Block a user