Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.25 AS builder
FROM golang:1.26 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
39 changes: 37 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
Expand All @@ -40,13 +41,21 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

v1alpha1 "github.com/osac-project/bare-metal-operator/api/v1alpha1"
v1alpha1 "github.com/osac-project/bare-metal-fulfillment-operator/api/v1alpha1"
"github.com/osac-project/host-management-openstack/internal/controller"
"github.com/osac-project/host-management-openstack/internal/ironic"
"github.com/osac-project/osac-operator/pkg/aap"
"github.com/osac-project/osac-operator/pkg/provisioning"
// +kubebuilder:scaffold:imports
)

const envHostLeaseNamespace = "HOSTLEASE_NAMESPACE"
const (
envHostLeaseNamespace = "HOSTLEASE_NAMESPACE"
envAAPURL = "OSAC_AAP_URL"
envAAPToken = "OSAC_AAP_TOKEN"
envAAPInsecureSkip = "OSAC_AAP_INSECURE_SKIP_VERIFY"
envAAPTemplatePrefix = "OSAC_AAP_TEMPLATE_PREFIX"
)

var (
scheme = runtime.NewScheme()
Expand Down Expand Up @@ -230,11 +239,37 @@ func main() {
}
setupLog.Info("Connect to ironic", "endpoint", ironicClient.GetEndpoint())

// AAP provisioning provider for image provisioning workflows
var provisioningProvider provisioning.ProvisioningProvider
if aapURL := os.Getenv(envAAPURL); aapURL != "" {
aapToken := os.Getenv(envAAPToken)
insecureSkipVerify, _ := strconv.ParseBool(os.Getenv(envAAPInsecureSkip))
templatePrefix := os.Getenv(envAAPTemplatePrefix)
if templatePrefix == "" {
templatePrefix = "osac"
}
aapClient := aap.NewClient(aapURL, aapToken, insecureSkipVerify)
var err error
provisioningProvider, err = provisioning.NewProvider(provisioning.ProviderConfig{
ProviderType: provisioning.ProviderTypeAAP,
AAPClient: aapClient,
TemplatePrefix: templatePrefix,
})
if err != nil {
setupLog.Error(err, "failed to create provisioning provider")
os.Exit(1)
}
setupLog.Info("AAP provisioning provider configured", "url", aapURL, "templatePrefix", templatePrefix)
} else {
setupLog.Info("AAP not configured, provisioning workflows disabled", "envVar", envAAPURL)
}

// Create HostLease reconciler with defaults
hostLeaseReconciler := controller.NewHostLeaseReconciler(
mgr.GetClient(),
mgr.GetScheme(),
ironicClient,
provisioningProvider,
0, // Use DefaultRecheckInterval
)
if err := hostLeaseReconciler.SetupWithManager(mgr); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
. "github.com/onsi/ginkgo/v2" //nolint:revive,staticcheck
. "github.com/onsi/gomega" //nolint:revive,staticcheck

osacv1alpha1 "github.com/osac-project/bare-metal-operator/api/v1alpha1"
osacv1alpha1 "github.com/osac-project/bare-metal-fulfillment-operator/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
Expand Down
5 changes: 3 additions & 2 deletions config/samples/v1alpha1_hostlease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ spec:
externalHostID: efa3d310-164d-44a4-a399-46cbcdaa587a
externalHostName: MOC-R4PAC08U21-S1
hostType: fc830
# hostClass: openstack
hostClass: openstack
networkClass: openstack
networkInterfaces:
- macAddress: aa:bb:cc:dd:ee:f1
network: private-vlan-network
# poweredOn: on
templateID: default_template
templateID: bm_host_agent_provisioning
templateParameters: '{"provisioningState":"active","imageSpec":{"url":"xxx"},"provisioningNetwork":"idle-agents-network"}'
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
module github.com/osac-project/host-management-openstack

go 1.25.0
go 1.26.0

require (
github.com/go-logr/logr v1.4.3
github.com/gophercloud/gophercloud/v2 v2.12.0
github.com/gophercloud/utils/v2 v2.0.0-20260409164906-cd2167a8681a
github.com/onsi/ginkgo/v2 v2.28.1
github.com/onsi/gomega v1.39.1
github.com/osac-project/osac-operator v0.1.1-0.20260511193951-8bf9632098a0
github.com/osac-project/osac-operator/api v0.0.2-0.20260511193951-8bf9632098a0
k8s.io/apimachinery v0.35.4
k8s.io/client-go v0.35.4
sigs.k8s.io/controller-runtime v0.23.3
Expand All @@ -16,7 +18,6 @@ require (
require (
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/gofrs/uuid/v5 v5.4.0 // indirect
github.com/osac-project/osac-operator v0.0.0-20260413152945-199a0469a4c2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
Expand Down Expand Up @@ -57,7 +58,7 @@ require (
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/osac-project/bare-metal-operator v0.0.0-20260423171233-28ec2bd86640
github.com/osac-project/bare-metal-fulfillment-operator v0.0.0-20260518182443-35f2a9590dcc
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
Expand All @@ -80,7 +81,7 @@ require (
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect
golang.org/x/net v0.49.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/term v0.39.0 // indirect
golang.org/x/text v0.33.0 // indirect
Expand All @@ -96,8 +97,8 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.35.4
k8s.io/apiextensions-apiserver v0.35.0 // indirect
k8s.io/apiserver v0.35.0 // indirect
k8s.io/component-base v0.35.0 // indirect
k8s.io/apiserver v0.35.4 // indirect
k8s.io/component-base v0.35.4 // 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
Expand Down
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI
github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE=
github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28=
github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg=
github.com/osac-project/bare-metal-operator v0.0.0-20260423171233-28ec2bd86640 h1:dYT1/qh3zVJGryZO+ySdLCQNmCkXCzl527Bd0m4bs8g=
github.com/osac-project/bare-metal-operator v0.0.0-20260423171233-28ec2bd86640/go.mod h1:QifCZ5ITT0CLDQ1ZaG0ac9w+9KAmtfnafesvxZ635bM=
github.com/osac-project/osac-operator v0.0.0-20260413152945-199a0469a4c2 h1:DI1B9fMQgjUlkHVL7OuO1fQ24MmYQIrktKslqp0K9nE=
github.com/osac-project/osac-operator v0.0.0-20260413152945-199a0469a4c2/go.mod h1:k/5CPGjhIS9n/BRBQHtxABzeA69yjtBWtLHmnloYeqE=
github.com/osac-project/bare-metal-fulfillment-operator v0.0.0-20260518182443-35f2a9590dcc h1:Ayw/y3WiCxQh8I8nKuyacNxrBeq1GCw60bNLfFD16rQ=
github.com/osac-project/bare-metal-fulfillment-operator v0.0.0-20260518182443-35f2a9590dcc/go.mod h1:N+t/4UPZajrHeDSjKAy+PwyydVaiONx4Uv0DRhk6o0I=
github.com/osac-project/osac-operator v0.1.1-0.20260511193951-8bf9632098a0 h1:w2POmUbIU+ecHGUky0SifYFWV5W05VijjixjnpWN2xw=
github.com/osac-project/osac-operator v0.1.1-0.20260511193951-8bf9632098a0/go.mod h1:c207O7XvQtIY6hFIqUAv3yB2JQt1ZRrsWA+wEla87aQ=
github.com/osac-project/osac-operator/api v0.0.2-0.20260511193951-8bf9632098a0 h1:ddxVNqBMGOk/xx19OgAuLZpKpId7A14pElhQ6eslAl8=
github.com/osac-project/osac-operator/api v0.0.2-0.20260511193951-8bf9632098a0/go.mod h1:JBz/wSWPT4NhksjXZs2QUjulga+KTUdW5UJX0kB22aA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -197,8 +199,8 @@ golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=
Expand Down Expand Up @@ -237,12 +239,12 @@ k8s.io/apiextensions-apiserver v0.35.0 h1:3xHk2rTOdWXXJM+RDQZJvdx0yEOgC0FgQ1PlJa
k8s.io/apiextensions-apiserver v0.35.0/go.mod h1:E1Ahk9SADaLQ4qtzYFkwUqusXTcaV2uw3l14aqpL2LU=
k8s.io/apimachinery v0.35.4 h1:xtdom9RG7e+yDp71uoXoJDWEE2eOiHgeO4GdBzwWpds=
k8s.io/apimachinery v0.35.4/go.mod h1:NNi1taPOpep0jOj+oRha3mBJPqvi0hGdaV8TCqGQ+cc=
k8s.io/apiserver v0.35.0 h1:CUGo5o+7hW9GcAEF3x3usT3fX4f9r8xmgQeCBDaOgX4=
k8s.io/apiserver v0.35.0/go.mod h1:QUy1U4+PrzbJaM3XGu2tQ7U9A4udRRo5cyxkFX0GEds=
k8s.io/apiserver v0.35.4 h1:vtuFqNFmF9bPRdHDL2lpK6qCTPWDreZJL4LRPwVM6ho=
k8s.io/apiserver v0.35.4/go.mod h1:JnBcb+J8kFXKpZkgcbcUnPBBHi4qgBii1I7dLxFY/oo=
k8s.io/client-go v0.35.4 h1:DN6fyaGuzK64UvnKO5fOA6ymSjvfGAnCAHAR0C66kD8=
k8s.io/client-go v0.35.4/go.mod h1:2Pg9WpsS4NeOpoYTfHHfMxBG8zFMSAUi4O/qoiJC3nY=
k8s.io/component-base v0.35.0 h1:+yBrOhzri2S1BVqyVSvcM3PtPyx5GUxCK2tinZz1G94=
k8s.io/component-base v0.35.0/go.mod h1:85SCX4UCa6SCFt6p3IKAPej7jSnF3L8EbfSyMZayJR0=
k8s.io/component-base v0.35.4 h1:6n1tNJ87johN0Hif0Fs8K2GMthsaUwMqCebUDLYyv7U=
k8s.io/component-base v0.35.4/go.mod h1:qaDJgz5c1KYKla9occFmlJEfPpkuA55s90G509R+PeY=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=
Expand Down
Loading
Loading