Skip to content

Commit

Permalink
Update auto indexing service configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Feb 19, 2024
1 parent 47f200f commit 32ead97
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pkg/index/operator/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Data struct {
// Observability represents observability configurations.
Observability *config.Observability `json:"observability" yaml:"observability"`

// Creation represents auto indexing service configurations.
Creation *config.IndexOperator `json:"operator" yaml:"operator"`
// Operator represents auto indexing service configurations.
Operator *config.IndexOperator `json:"operator" yaml:"operator"`
}

// NewConfig load configurations from file path.
Expand Down Expand Up @@ -62,8 +62,8 @@ func NewConfig(path string) (cfg *Data, err error) {
cfg.Observability = new(config.Observability).Bind()
}

if cfg.Creation != nil {
_ = cfg.Creation.Bind()
if cfg.Operator != nil {
_ = cfg.Operator.Bind()
} else {
return nil, errors.ErrInvalidConfig
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/index/operator/service/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type operator struct {
}

// New returns Indexer object if no error occurs.
func New(opts ...Option) (o Operator, err error) {
func New(agentName string, opts ...Option) (o Operator, err error) {
operator := new(operator)
for _, opt := range append(defaultOpts, opts...) {
if err := opt(operator); err != nil {
Expand All @@ -58,6 +58,9 @@ func New(opts ...Option) (o Operator, err error) {
}

var k8sOpts []k8s.Option
podLabelSelector := map[string]string{
"app": agentName,
}
podOpts := k8s.WithResourceController(pod.New(
pod.WithControllerName("pod reconciler for index operator"),
pod.WithOnErrorFunc(func(err error) {
Expand All @@ -68,8 +71,7 @@ func New(opts ...Option) (o Operator, err error) {
pod.WithOnReconcileFunc(func(podList map[string][]pod.Pod) {
log.Debugf("reconciled pod list: %v", podList)
}),
// pod.WithFields(selector.GetPodFields()),
// pod.WithLabels(selector.GetPodLabels()),
pod.WithLabels(podLabelSelector),
))
k8sOpts = append(k8sOpts, podOpts)

Expand Down
3 changes: 1 addition & 2 deletions pkg/index/operator/usecase/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ type run struct {
// New returns Runner instance.
func New(cfg *config.Data) (_ runner.Runner, err error) {
eg := errgroup.Get()

operator, err := service.New()
operator, err := service.New(cfg.Operator.AgentName)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 32ead97

Please sign in to comment.