Newer
Older
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
// +kubebuilder:object:generate=true
type Settings struct {
*meta.ObjectMeta `json:"meta,omitempty"`
parameters.Parameters `json:"parameters,omitempty"`
}
func (s *Settings) GetParameters() *parameters.Parameters {
return &s.Parameters
}
func (s *Settings) GetObjects() []instance.Object {
objects := []instance.Object{}
// for _, param := range *s.Parameters {
// if len(param.Value) > 0 && len(param.Key) > 0 {
// if param.Type == "Secret" {
// objects = append(objects, secret)
// }
// objects = append(objects, secret)
// }
// }
return objects
}
func (s *Settings) GetConfigRefs() []string { return nil }
func (s *Settings) GetSecretRefs() []string { return nil }
func (s *Settings) SetDefaults(i instance.Instance) {
if s.ObjectMeta == nil {
s.ObjectMeta = new(meta.ObjectMeta)
}
if len(s.ObjectMeta.Labels) == 0 {
s.ObjectMeta.Labels = make(map[string]string)
}
instanceLabels := instance.InstanceLabels(i)
s.ObjectMeta.SetLabels(instanceLabels)
s.ObjectMeta.Labels["app.kubernetes.io/component"] = "settings"
if len(s.ObjectMeta.Name) == 0 {
s.ObjectMeta.Name = fmt.Sprintf("%v-%v", i.GetName(), "settings")
}
if len(s.ObjectMeta.Namespace) == 0 {
s.ObjectMeta.Namespace = i.GetNamespace()
}
}
func CreateAndInitSettings(i instance.Settings) *Settings {
return &Settings{
ObjectMeta: &meta.ObjectMeta{
Name: i.GetMeta().GetName(),
Namespace: i.GetMeta().GetNamespace(),
Labels: instance.InstanceLabels(i.GetMeta()),
},