Skip to content

Commit e06f8a9

Browse files
committed
init
Signed-off-by: Pavel Okhlopkov <[email protected]>
1 parent 78edf19 commit e06f8a9

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

internal/controller/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ func remapHookConfigToHookConfig(cfg *pkg.HookConfig) *gohook.HookConfig {
236236
newHookConfig.Schedule = append(newHookConfig.Schedule, gohook.ScheduleConfig{
237237
Name: scfg.Name,
238238
Crontab: scfg.Crontab,
239+
Queue: cfg.Queue,
239240
})
240241
}
241242

pkg/hook/dto.go

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,69 +62,71 @@ type ScheduleConfig struct {
6262
Name string `yaml:"name,omitempty" json:"name,omitempty"`
6363
// Crontab is a schedule config in crontab format. (5 or 6 fields)
6464
Crontab string `yaml:"crontab" json:"crontab"`
65+
66+
Queue string `yaml:"queue" json:"queue,omitempty"`
6567
}
6668

6769
type FilterResult any
6870

6971
type FilterFunc func(*unstructured.Unstructured) (FilterResult, error)
7072

7173
type NameSelector struct {
72-
MatchNames []string `json:"matchNames" yaml:"matchNames"`
74+
MatchNames []string `yaml:"matchNames" json:"matchNames"`
7375
}
7476

7577
type FieldSelectorRequirement struct {
76-
Field string `json:"field"`
77-
Operator string `json:"operator"`
78-
Value string `json:"value,omitempty"`
78+
Field string `yaml:"field" json:"field"`
79+
Operator string `yaml:"operator" json:"operator"`
80+
Value string `yaml:"value,omitempty" json:"value,omitempty"`
7981
}
8082

8183
type FieldSelector struct {
82-
MatchExpressions []FieldSelectorRequirement `json:"matchExpressions" yaml:"matchExpressions"`
84+
MatchExpressions []FieldSelectorRequirement `yaml:"matchExpressions" json:"matchExpressions"`
8385
}
8486

8587
type NamespaceSelector struct {
86-
NameSelector *NameSelector `json:"nameSelector,omitempty" yaml:"nameSelector,omitempty"`
87-
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty" yaml:"labelSelector,omitempty"`
88+
NameSelector *NameSelector `yaml:"nameSelector,omitempty" json:"nameSelector,omitempty"`
89+
LabelSelector *metav1.LabelSelector `yaml:"labelSelector,omitempty" json:"labelSelector,omitempty"`
8890
}
8991

9092
type KubernetesConfig struct {
91-
Name string `json:"name"`
93+
Name string `yaml:"name" json:"name"`
9294
// APIVersion of objects. "v1" is used if not set.
93-
APIVersion string `json:"apiVersion,omitempty"`
95+
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
9496
// Kind of objects.
95-
Kind string `json:"kind,omitempty"`
97+
Kind string `yaml:"kind,omitempty" json:"kind,omitempty"`
9698
// NameSelector used to subscribe on object by its name.
97-
NameSelector *NameSelector `json:"nameSelector,omitempty"`
99+
NameSelector *NameSelector `yaml:"nameSelector,omitempty" json:"nameSelector,omitempty"`
98100
// NamespaceSelector used to subscribe on objects in namespaces.
99-
NamespaceSelector *NamespaceSelector `json:"namespace,omitempty"`
101+
NamespaceSelector *NamespaceSelector `yaml:"namespace,omitempty" json:"namespace,omitempty"`
100102
// LabelSelector used to subscribe on objects by matching their labels.
101-
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
103+
LabelSelector *metav1.LabelSelector `yaml:"labelSelector,omitempty" json:"labelSelector,omitempty"`
102104
// FieldSelector used to subscribe on objects by matching specific fields (the list of fields is narrow, see shell-operator documentation).
103-
FieldSelector *FieldSelector `json:"fieldSelector,omitempty"`
105+
FieldSelector *FieldSelector `yaml:"fieldSelector,omitempty" json:"fieldSelector,omitempty"`
104106
// ExecuteHookOnEvents is true by default. Set to false if only snapshot update is needed.
105107
// *bool --> ExecuteHookOnEvents: [All events] || empty slice || nil
106-
ExecuteHookOnEvents *bool `json:"executeHookOnEvent,omitempty"`
108+
ExecuteHookOnEvents *bool `yaml:"executeHookOnEvent,omitempty" json:"executeHookOnEvent,omitempty"`
107109
// ExecuteHookOnSynchronization is true by default. Set to false if only snapshot update is needed.
108110
// true || false
109-
ExecuteHookOnSynchronization *bool `json:"executeHookOnSynchronization,omitempty"`
111+
ExecuteHookOnSynchronization *bool `yaml:"executeHookOnSynchronization,omitempty" json:"executeHookOnSynchronization,omitempty"`
110112
// WaitForSynchronization is true by default. Set to false if beforeHelm is not required this snapshot on start.
111113
// true || false
112-
WaitForSynchronization *bool `json:"waitForSynchronization,omitempty"`
114+
WaitForSynchronization *bool `yaml:"waitForSynchronization,omitempty" json:"waitForSynchronization,omitempty"`
113115
// false by default
114116
// if JQ filter is empty - KeepFullObjectsInMemory always true
115-
KeepFullObjectsInMemory *bool `json:"keepFullObjectsInMemory,omitempty"`
117+
KeepFullObjectsInMemory *bool `yaml:"keepFullObjectsInMemory,omitempty" json:"keepFullObjectsInMemory,omitempty"`
116118
// JQ filter to filter results from kubernetes objects
117-
JqFilter string `json:"jqFilter,omitempty"`
119+
JqFilter string `yaml:"jqFilter,omitempty" json:"jqFilter,omitempty"`
118120

119-
AllowFailure *bool `json:"allowFailure,omitempty"`
120-
ResynchronizationPeriod string `json:"resynchronizationPeriod,omitempty"`
121+
AllowFailure *bool `yaml:"allowFailure,omitempty" json:"allowFailure,omitempty"`
122+
ResynchronizationPeriod string `yaml:"resynchronizationPeriod,omitempty" json:"resynchronizationPeriod,omitempty"`
121123

122-
IncludeSnapshotsFrom []string `json:"includeSnapshotsFrom,omitempty"`
124+
IncludeSnapshotsFrom []string `yaml:"includeSnapshotsFrom,omitempty" json:"includeSnapshotsFrom,omitempty"`
123125

124-
Queue string `json:"queue,omitempty"`
126+
Queue string `yaml:"queue,omitempty" json:"queue,omitempty"`
125127
}
126128

127129
type Error struct {
128-
Message string `json:"message"`
129-
Code int `json:"code,omitempty"`
130+
Message string `yaml:"message" json:"message"`
131+
Code int `yaml:"code,omitempty" json:"code,omitempty"`
130132
}

0 commit comments

Comments
 (0)