Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[addon-operator] feat/minor improvements two #578

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/addon-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,25 @@ func start(logger *log.Logger) func(_ *kingpin.ParseContext) error {
}
}

// run initializes and starts the addon operator, blocking until it receives an OS signal to shutdown.
func run(ctx context.Context, operator *addon_operator.AddonOperator) error {
// Create a ConfigMap-based backend for storing configuration
bk := configmap.New(operator.KubeClient(), operator.DefaultNamespace, app.ConfigMapName, operator.Logger.Named("kube-config-manager"))
// Configure the operator to use this backend for configuration management
operator.SetupKubeConfigManager(bk)

// Setup the operator (initialize controllers, register hooks, etc.)
if err := operator.Setup(); err != nil {
operator.Logger.Fatal("setup failed", log.Err(err))
}

// Start the operator (begin watching for events and executing hooks)
if err := operator.Start(ctx); err != nil {
operator.Logger.Fatal("start failed", log.Err(err))
}

// Block action by waiting signals from OS.
// Block the main goroutine until the process receives a termination signal
// When a signal is received, stop the operator gracefully before exiting
utils_signal.WaitForProcessInterruption(func() {
operator.Stop()
os.Exit(0)
Expand Down
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ require (
github.com/dominikbraun/graph v0.23.0
github.com/ettle/strcase v0.2.0
github.com/flant/kube-client v1.2.3-0.20250320122654-cc319665c656
github.com/flant/shell-operator v1.6.1
github.com/flant/shell-operator v1.6.2-0.20250401061538-619451412119
github.com/go-chi/chi/v5 v5.2.1
github.com/go-openapi/loads v0.19.5
github.com/go-openapi/spec v0.19.8
github.com/go-openapi/strfmt v0.19.5
github.com/go-openapi/swag v0.22.5
github.com/go-openapi/validate v0.19.12
github.com/goccy/go-graphviz v0.1.3
github.com/goccy/go-graphviz v0.2.9
github.com/gofrs/uuid/v5 v5.3.1
github.com/hashicorp/go-multierror v1.1.1
github.com/kennygrant/sanitize v1.2.4
Expand Down Expand Up @@ -59,6 +59,7 @@ require (
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.1.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
Expand All @@ -74,6 +75,7 @@ require (
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flant/libjq-go v1.6.3-0.20201126171326-c46a40ff22ee // indirect
github.com/flopp/go-findfont v0.1.0 // indirect
github.com/fogleman/gg v1.3.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
Expand Down Expand Up @@ -147,6 +149,7 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tetratelabs/wazero v1.8.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All @@ -161,7 +164,7 @@ require (
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/image v0.21.0 // indirect
golang.org/x/net v0.36.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.11.0 // indirect
Expand Down
27 changes: 17 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpS
github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/corona10/goimagehash v1.0.2 h1:pUfB0LnsJASMPGEZLj7tGY251vF+qLGqOgEP4rUs6kA=
github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI=
github.com/corona10/goimagehash v1.1.0 h1:teNMX/1e+Wn/AYSbLHX8mj+mF9r60R1kBeqE9MkoYwI=
github.com/corona10/goimagehash v1.1.0/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
Expand All @@ -93,6 +93,8 @@ github.com/deckhouse/module-sdk v0.2.0 h1:MOK03UZ88T7T52bk+lmAz0bRJiljtN5ysq7y8F
github.com/deckhouse/module-sdk v0.2.0/go.mod h1:fbs0X7myE8zrPKxs3eoIoFWf68E7r1tZ64uJfYJCsKc=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/distribution/distribution/v3 v3.0.0-beta.1 h1:X+ELTxPuZ1Xe5MsD3kp2wfGUhc8I+MPfRis8dZ818Ic=
github.com/distribution/distribution/v3 v3.0.0-beta.1/go.mod h1:O9O8uamhHzWWQVTjuQpyYUVm/ShPHPUDgvQMpHGVBDs=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
Expand Down Expand Up @@ -140,8 +142,10 @@ github.com/flant/kube-client v1.2.3-0.20250320122654-cc319665c656 h1:4KJJsnfhb9a
github.com/flant/kube-client v1.2.3-0.20250320122654-cc319665c656/go.mod h1:kuIr5aVjXzJaMRth/wEHYwLXz9qt28B6M+zhidk7S04=
github.com/flant/libjq-go v1.6.3-0.20201126171326-c46a40ff22ee h1:evii83J+/6QGNvyf6tjQ/p27DPY9iftxIBb37ALJRTg=
github.com/flant/libjq-go v1.6.3-0.20201126171326-c46a40ff22ee/go.mod h1:f+REaGl/+pZR97rbTcwHEka/MAipoQQ2Mc0iQUj4ak0=
github.com/flant/shell-operator v1.6.1 h1:3S4dCAeJVWZjv8EmRMVTt0P/ftKzQ7xMrXUS3LeBo5s=
github.com/flant/shell-operator v1.6.1/go.mod h1:u+xooEDFHvkxfpmQie7rMnaFedH8dkGoKaL2V3ZqK54=
github.com/flant/shell-operator v1.6.2-0.20250401061538-619451412119 h1:vMvy5aN7S/fyp4yY8wJWesTocVshd1BV5hNueWqea6E=
github.com/flant/shell-operator v1.6.2-0.20250401061538-619451412119/go.mod h1:u+xooEDFHvkxfpmQie7rMnaFedH8dkGoKaL2V3ZqK54=
github.com/flopp/go-findfont v0.1.0 h1:lPn0BymDUtJo+ZkV01VS3661HL6F4qFlkhcJN55u6mU=
github.com/flopp/go-findfont v0.1.0/go.mod h1:wKKxRDjD024Rh7VMwoU90i6ikQRCr+JTHB5n4Ejkqvw=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI=
Expand Down Expand Up @@ -243,8 +247,8 @@ github.com/gobuffalo/packr/v2 v2.8.3/go.mod h1:0SahksCVcx4IMnigTjiFuyldmTrdTctXs
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-graphviz v0.1.3 h1:Pkt8y4FBnBNI9tfSobpoN5qy1qMNqRXPQYvLhaSUasY=
github.com/goccy/go-graphviz v0.1.3/go.mod h1:pMYpbAqJT10V8dzV1JN/g/wUlG/0imKPzn3ZsrchGCI=
github.com/goccy/go-graphviz v0.2.9 h1:4yD2MIMpxNt+sOEARDh5jTE2S/jeAKi92w72B83mWGg=
github.com/goccy/go-graphviz v0.2.9/go.mod h1:hssjl/qbvUXGmloY81BwXt2nqoApKo7DFgDj5dLJGb8=
github.com/gofrs/uuid/v5 v5.3.1 h1:aPx49MwJbekCzOyhZDjJVb0hx3A0KLjlbLx6p2gY0p0=
github.com/gofrs/uuid/v5 v5.3.1/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down Expand Up @@ -443,8 +447,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM=
Expand Down Expand Up @@ -544,6 +548,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550=
github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
Expand Down Expand Up @@ -630,8 +636,9 @@ golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0Y
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
34 changes: 32 additions & 2 deletions pkg/addon-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@ import (
"github.com/flant/addon-operator/pkg/kube_config_manager"
"github.com/flant/addon-operator/pkg/kube_config_manager/backend"
"github.com/flant/addon-operator/pkg/module_manager"
taskservice "github.com/flant/addon-operator/pkg/task/service"
shapp "github.com/flant/shell-operator/pkg/app"
"github.com/flant/shell-operator/pkg/debug"
shell_operator "github.com/flant/shell-operator/pkg/shell-operator"
)

// Bootstrap inits all dependencies for a full-fledged AddonOperator instance.
// It initializes the debug server and assembles all components needed for operation.
func (op *AddonOperator) bootstrap() error {
// Log application startup message
log.Info(shapp.AppStartMessage)

// Log the path where modules will be searched
log.Info("Search modules",
slog.String("path", app.ModulesDir))

// Log the namespace in which the operator will work
log.Info("Addon-operator namespace",
slog.String("namespace", op.DefaultNamespace))

// Debug server.
// Initialize the debug server for troubleshooting and monitoring
// TODO: rewrite shapp global variables to the addon-operator ones
var err error
op.DebugServer, err = shell_operator.RunDefaultDebugServer(shapp.DebugUnixSocket, shapp.DebugHttpServerAddr, op.Logger.Named("debug-server"))
Expand All @@ -34,34 +39,58 @@ func (op *AddonOperator) bootstrap() error {
return fmt.Errorf("start Debug server: %w", err)
}

// Assemble all operator components including routes, admission server, metrics updaters, and module management
err = op.Assemble(op.DebugServer)
if err != nil {
log.Error("Fatal", log.Err(err))
return fmt.Errorf("assemble Debug server: %w", err)
}

cfg := &taskservice.TaskHandlerServiceConfig{
Engine: op.engine,
ParallelTaskChannels: op.parallelTaskChannels,
Helm: op.Helm,
HelmResourcesManager: op.HelmResourcesManager,
ModuleManager: op.ModuleManager,
MetricStorage: op.MetricStorage,
KubeConfigManager: op.KubeConfigManager,
ConvergeState: op.ConvergeState,
CRDExtraLabels: op.CRDExtraLabels,
}

op.TaskService = taskservice.NewTaskHandlerService(op.ctx, cfg, op.Logger)

return nil
}

// Assemble initializes and connects components of the AddonOperator.
// It sets up debugging http endpoints, starts netrics services, and initializes the module manager.
func (op *AddonOperator) Assemble(debugServer *debug.Server) error {
// Register default HTTP routes for the operator
op.registerDefaultRoutes()

// Start the admission server if enabled in application configuration
if app.AdmissionServerEnabled {
op.AdmissionServer.start(op.ctx)
}

// Start background updaters for metrics
StartLiveTicksUpdater(op.engine.MetricStorage)
StartTasksQueueLengthUpdater(op.engine.MetricStorage, op.engine.TaskQueues)

// Register routes in debug server.
// Register debug HTTP endpoints to inspect internal state
op.engine.RegisterDebugQueueRoutes(debugServer)
op.engine.RegisterDebugConfigRoutes(debugServer, op.runtimeConfig)
op.RegisterDebugGlobalRoutes(debugServer)
op.RegisterDebugModuleRoutes(debugServer)
op.RegisterDiscoveryRoute(debugServer)

// Initialize the module manager which handles modules lifecycle
if err := op.InitModuleManager(); err != nil {
return err
}

// Register graph visualization routes after module manager is initialized
op.RegisterDebugGraphRoutes(debugServer)

return nil
Expand All @@ -86,6 +115,7 @@ func (op *AddonOperator) SetupModuleManager(modulesDir string, globalHooksDir st
TempDir: tempDir,
ChrootDir: app.ShellChrootDir,
}

deps := module_manager.ModuleManagerDependencies{
KubeObjectPatcher: op.engine.ObjectPatcher,
KubeEventsManager: op.engine.KubeEventsManager,
Expand Down
15 changes: 11 additions & 4 deletions pkg/addon-operator/converge/converge.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package converge

import (
"fmt"
"sync"
"time"

Expand All @@ -13,7 +14,7 @@ type ConvergeState struct {
PhaseLock sync.RWMutex
Phase ConvergePhase

FirstRunPhase firstConvergePhase
FirstRunPhase FirstRunPhaseType
FirstRunDoneC chan struct{}
StartedAt int64
Activation string
Expand All @@ -30,10 +31,10 @@ const (
WaitAfterAll ConvergePhase = "WaitAfterAll"
)

type firstConvergePhase int
type FirstRunPhaseType int

const (
FirstNotStarted firstConvergePhase = iota
FirstNotStarted FirstRunPhaseType = iota
FirstStarted
FirstDone
)
Expand All @@ -46,7 +47,7 @@ func NewConvergeState() *ConvergeState {
}
}

func (cs *ConvergeState) SetFirstRunPhase(ph firstConvergePhase) {
func (cs *ConvergeState) SetFirstRunPhase(ph FirstRunPhaseType) {
cs.FirstRunPhase = ph
if ph == FirstDone {
close(cs.FirstRunDoneC)
Expand All @@ -55,8 +56,14 @@ func (cs *ConvergeState) SetFirstRunPhase(ph firstConvergePhase) {

const ConvergeEventProp = "converge.event"

var _ fmt.Stringer = (*ConvergeEvent)(nil)

type ConvergeEvent string

func (e ConvergeEvent) String() string {
return string(e)
}

const (
// OperatorStartup is a first converge during startup.
OperatorStartup ConvergeEvent = "OperatorStartup"
Expand Down
Loading
Loading