Newer
Older
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
package instance
import (
"github.com/presslabs/controller-util/syncer"
"k8s.io/apimachinery/pkg/labels"
interfaces "k8s.libre.sh/interfaces"
)
type Component interface {
// settings.Interface
// mutate.ObjectMeta
Meta
// GetName() string
SetDefaults(i Instance)
GetObjects() map[int]Object
// HasCommonSettings() bool
}
func GenComponentLabels(c Component) map[string]string {
labels := labels.Set{
"app.kubernetes.io/component": c.GetName(),
}
return labels
}
func NewSyncer(i Component, r interfaces.Reconcile, owner interfaces.Object) (syncers []syncer.Interface) {
mutators := i.GetObjects()
// labels := InstanceLabels(i)
for _, m := range mutators {
// m.SetLabels(labels)
// m.SetName(i.GetName())
// m.SetNamespace(i.GetNamespace())
syncers = append(syncers, NewObjectSyncer(m, owner, r))
}
return syncers
}