-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
kluctl_project.go
71 lines (60 loc) · 2.67 KB
/
kluctl_project.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package types
import (
"github.com/kluctl/kluctl/pkg/utils/uo"
"github.com/kluctl/kluctl/pkg/yaml"
)
type DynamicArg struct {
Name string `yaml:"name" validate:"required"`
Pattern *string `yaml:"pattern,omitempty"`
}
type ExternalTargetConfig struct {
Project *GitProject `yaml:"project,omitempty"`
// Ref Branch/Tag to be used. Can't be combined with 'refPattern'. If 'branch' and 'branchPattern' are not used, 'branch' defaults to the default branch of targetConfig.project
Ref *string `yaml:"ref,omitempty"`
// RefPattern If set, multiple dynamic targets are created, each with 'ref' being set to the ref that matched the given pattern.
RefPattern *string `yaml:"refPattern,omitempty"`
// File defaults to 'target-config.yml'
File *string `yaml:"file,omitempty"`
}
type SealingConfig struct {
// DynamicSealing Set this to false if you want to disable sealing for every dynamic target
DynamicSealing *bool `yaml:"dynamicSealing,omitempty"`
Args *uo.UnstructuredObject `yaml:"args,omitempty"`
SecretSets []string `yaml:"secretSets,omitempty"`
}
type Target struct {
Name string `yaml:"name" validate:"required"`
Cluster string `yaml:"cluster" validate:"required"`
Args *uo.UnstructuredObject `yaml:"args,omitempty"`
DynamicArgs []DynamicArg `yaml:"dynamicArgs,omitempty"`
TargetConfig *ExternalTargetConfig `yaml:"targetConfig,omitempty"`
SealingConfig *SealingConfig `yaml:"sealingConfig,omitempty"`
Images []FixedImage `yaml:"images,omitempty"`
}
type DynamicTarget struct {
Target *Target `yaml:"target" validate:"required"`
BaseTargetName string `yaml:"baseTargetName"`
}
type SecretSet struct {
Name string `yaml:"name" validate:"required"`
Sources []SecretSource `yaml:"sources" validate:"required,gt=0"`
}
type GlobalSealedSecretsConfig struct {
Bootstrap *bool `yaml:"bootstrap,omitempty"`
Namespace *string `yaml:"namespace,omitempty"`
ControllerName *string `yaml:"controllerName,omitempty"`
}
type SecretsConfig struct {
SealedSecrets *GlobalSealedSecretsConfig `yaml:"sealedSecrets,omitempty"`
SecretSets []SecretSet `yaml:"secretSets,omitempty"`
}
type KluctlProject struct {
Deployment *ExternalProject `yaml:"deployment,omitempty"`
SealedSecrets *ExternalProject `yaml:"sealedSecrets,omitempty"`
Clusters ExternalProjects `yaml:"clusters,omitempty"`
Targets []*Target `yaml:"targets,omitempty"`
SecretsConfig *SecretsConfig `yaml:"secretsConfig,omitempty"`
}
func init() {
yaml.Validator.RegisterStructValidation(ValidateSecretSource, SecretSource{})
}