Skip to content
Draft
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
92860cf
refactor: drop unnecessary sudoer isolation
bcho Feb 12, 2026
2d802d9
ci: suppress nosec warning temporary
bcho Feb 12, 2026
c2361a0
Merge branch 'hbc/drop-sudoer' into hbc/kubeadm
bcho Feb 12, 2026
b7dfcb5
Merge remote-tracking branch 'origin/main' into hbc/kubeadm
bcho Feb 13, 2026
5c3c585
feat: init kubeadm join executor
bcho Feb 13, 2026
12f877d
refactor: take ca cert as raw []byte
bcho Feb 13, 2026
debd246
Revert "refactor: take ca cert as raw []byte"
bcho Feb 13, 2026
3b25027
feat: minimal poc
bcho Feb 13, 2026
3264cc2
feat: check systemd unit status
bcho Feb 13, 2026
261f4b3
feat: prepare kubelet systemd unit
bcho Feb 13, 2026
28872ab
feat: write files with renameio
bcho Feb 13, 2026
f6705d6
refactor: simplify tar.gz download handling
bcho Feb 13, 2026
5038808
refactor: download via remoteio
bcho Feb 13, 2026
d9350a4
refactor: download with remoteio
bcho Feb 13, 2026
5c62f92
refactor: download with DownloadToLocalFile
bcho Feb 13, 2026
abfd0ac
refactor: rename to utilio
bcho Feb 13, 2026
4e23009
refactor: consolidate to utilio
bcho Feb 13, 2026
610dd2c
refactor: consolidate to utilio
bcho Feb 13, 2026
4e79976
fix: restrict mkdir permissions
bcho Feb 13, 2026
d75f1e6
refactor: stricter validation
bcho Feb 13, 2026
79d49b7
refactor: refactor and harden io operations
bcho Feb 13, 2026
5c09409
doc: TODO note
bcho Feb 13, 2026
d9fee6c
lint: fix lint issues
bcho Feb 13, 2026
e9a265a
lint: exclude error check
bcho Feb 13, 2026
c8c269d
fix: debug log
bcho Feb 13, 2026
c7972ee
Merge remote-tracking branch 'origin/hbc/io' into hbc/kubeadm
bcho Feb 13, 2026
faecbcf
poc
bcho Feb 13, 2026
98bbd92
Merge remote-tracking branch 'origin/main' into hbc/kubeadm
bcho Feb 13, 2026
cb57ee8
feat: define components action model
bcho Feb 13, 2026
6cc46ce
feat: quick impl for kube binaries download action
bcho Feb 14, 2026
ed1d17c
chore: refine filter logic
bcho Feb 14, 2026
d74f7eb
feat: return status
bcho Feb 14, 2026
3ac463e
feat: imlpement cri binaries download action
bcho Feb 14, 2026
5e51f12
refactor: simplify GetArch impl
bcho Feb 14, 2026
b2072b4
feat: implement containerd service start action
bcho Feb 14, 2026
62d9c75
feat: add minimal os configuration
bcho Feb 17, 2026
e2598dd
feat: install required packages
bcho Feb 17, 2026
f9ab721
fix: update kubelet version check
bcho Feb 17, 2026
0718790
chore: minimal progress ui
bcho Feb 17, 2026
d41a920
doc: describe component api
bcho Feb 17, 2026
4686bdb
fix: exec with utilexec
bcho Feb 17, 2026
d9a8f2b
fix: drop unused file
bcho Feb 17, 2026
de9eef1
doc: revert change
bcho Feb 17, 2026
34767ed
doc: update sample
bcho Feb 17, 2026
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ aks-flex-node version
> **Important:** All commands below assume you are running as root (`sudo su`). The agent installs and configures system-level components (containerd, kubelet, CNI) and manages systemd services, all of which require root privileges.

```bash
# Start the agent
aks-flex-node agent --config /etc/aks-flex-node/config.json
# Start the agent (requires root)
sudo aks-flex-node agent --config /etc/aks-flex-node/config.json
```

For detailed setup instructions, prerequisites, requirements, and configuration options, see the **[Usage Guide](docs/usage.md)**.
Expand Down
34 changes: 34 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ var (
BuildTime = "unknown"
)

func NewApplyCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "apply",
Short: "Apply the AKS node configuration and join the cluster",
RunE: func(cmd *cobra.Command, args []string) error {
return runApply(cmd.Context())
},
}

return cmd
}

// NewAgentCommand creates a new agent command
func NewAgentCommand() *cobra.Command {
cmd := &cobra.Command{
Expand Down Expand Up @@ -67,6 +79,28 @@ func NewVersionCommand() *cobra.Command {
return cmd
}

// runApply applies the node configuration and joins the cluster.
func runApply(ctx context.Context) error {
logger := logger.GetLoggerFromContext(ctx)

cfg, err := config.LoadConfig(configPath)
if err != nil {
return fmt.Errorf("failed to load config from %s: %w", configPath, err)
}

exectuor := bootstrapper.NewMinimal(cfg, logger)
result, err := exectuor.Bootstrap(ctx)
if err != nil {
return fmt.Errorf("bootstrap failed: %w", err)
}

if err := handleExecutionResult(result, "bootstrap", logger); err != nil {
return fmt.Errorf("bootstrap execution failed: %w", err)
}

return nil
}

// runAgent executes the bootstrap process and then runs as daemon
func runAgent(ctx context.Context) error {
logger := logger.GetLoggerFromContext(ctx)
Expand Down
60 changes: 41 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,81 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v5 v5.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute v1.2.0
github.com/Azure/go-autorest/autorest/to v0.4.1
github.com/coreos/go-systemd/v22 v22.7.0
github.com/google/renameio/v2 v2.0.2
github.com/google/uuid v1.6.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/spf13/cobra v1.10.1
github.com/spf13/viper v1.21.0
k8s.io/apimachinery v0.35.0
k8s.io/client-go v0.35.0
sigs.k8s.io/cluster-api v1.12.2
)

require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.47.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/net v0.49.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/oauth2 v0.33.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/term v0.39.0 // indirect
golang.org/x/text v0.33.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.35.0 // indirect
k8s.io/api v0.35.0 // indirect
k8s.io/apiextensions-apiserver v0.34.3 // indirect
k8s.io/cluster-bootstrap v0.34.2 // indirect
k8s.io/component-base v0.34.3 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
sigs.k8s.io/controller-runtime v0.22.5 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
Expand Down
Loading
Loading