osac-operator

module
v0.0.42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0

README

OSAC operator

Reconciles custom resources created by the fulfillment service, a sibling component in this repository, or elsewhere.

Description

OSAC operator is part of the Open Sovereign AI Cloud (OSAC) project. It watches the following custom resources and reconciles them to their desired state:

  • ClusterOrder (cord) — deploys OpenShift clusters via Hosted Control Planes.
  • ComputeInstance (ci) — provisions virtual machines via KubeVirt.
  • Tenant — tracks the tenant lifecycle without requiring a tenant namespace on the workload cluster; leaves status.namespace unset rather than reporting a namespace that may not exist. VMs with a subnet use the subnet namespace; VMs without one fall back to the tenant name when locating a VM.
  • VirtualNetwork (vnet) — represents a cloud virtual network / VPC with an IPv4 CIDR block.
  • Subnet (subnet) — represents a subnet within a VirtualNetwork.
  • SecurityGroup (sg) — defines network security (firewall) rules with ingress/egress rules, protocols, port ranges, and CIDR blocks.
  • NetworkClass, NetworkAttachment, ExternalIPPool, ExternalIP, ExternalIPAttachment, NATGateway, FabricDomain — the other networking resources. Networking CRs report the Ready condition and their network manager jobs in status.jobs (see internal/networktask/doc.go).
  • Volume (vol) — provisions block storage on vendor arrays via the VendorProvisioner interface (vendor CSI controllers).

Configuration

When connected to Fulfillment, the operator compares global.networking.provisioningEnabled with the saved installation value before reconciliation. Set fulfillment.serverAddress to the private gRPC endpoint and provide the matching credentials and CA bundle. The operator can also run without Fulfillment for standalone tests.

Configuration is supplied via environment variables (e.g. from a Secret mounted into the manager deployment). The following are supported:

AAP provisioning

Controllers that perform infrastructure provisioning (ClusterOrder, ComputeInstance, and networking resources) integrate with Ansible Automation Platform over the REST API. The operator launches job/workflow templates and polls AAP for job status.

Tenant storage provisioning is optional when AAP credentials or templates are not configured; the Tenant reconciler tracks tenant lifecycle without checking for a workload-cluster tenant namespace. Feedback controllers sync state to the fulfillment service over gRPC only (no AAP integration).

  • OSAC_AAP_URL — AAP server URL (required).
  • OSAC_AAP_TOKEN — AAP authentication token (required).
  • OSAC_AAP_PROVISION_TEMPLATE — default AAP template name for provisioning (optional).
  • OSAC_AAP_DEPROVISION_TEMPLATE — default AAP template name for deprovisioning (optional).
  • OSAC_AAP_TEMPLATE_PREFIX — prefix for convention-based template name resolution (default: "osac"). Networking controllers launch {prefix}-{task with dashes} (e.g. osac-create-virtual-network).
  • OSAC_AAP_ORGANIZATION — AAP organization (name or ID) where networking job labels are created (default: osac).
  • OSAC_PROVISIONING_ENABLED — provider networking (default: true). When false, no networking job runs and networking resources become Ready with reason ProvisioningDisabled.
  • OSAC_AAP_STATUS_POLL_INTERVAL — job status polling interval (default: 30s). Duration string, e.g. 30s, 1m.
  • OSAC_AAP_INSECURE_SKIP_VERIFY — skip TLS verification for AAP (default: false).

Per-resource AAP template overrides (optional, override the shared defaults):

  • OSAC_CLUSTER_AAP_PROVISION_TEMPLATE / OSAC_CLUSTER_AAP_DEPROVISION_TEMPLATE — override for ClusterOrder.

Networking controllers launch one job template per network manager task: {prefix}-{task with dashes} (e.g. osac-create-subnet, osac-apply-network-attachment), all running the generic playbook playbook_osac_network_task.yml. See internal/networktask/doc.go.

Assisted Service discovery ignition TLS
  • OSAC_IGNITION_TRUST_INGRESS_CA — when true, load openshift-config-managed/default-ingress-cert (ca-bundle.crt) at startup and add its certificates to the system trust store for discovery ignition downloads. The Helm value ignition.trustIngressCA enables this and grants read-only access to that ConfigMap. Use it on OpenShift clusters whose Assisted Service HTTPS Route uses the cluster-generated ingress CA; leave it disabled elsewhere. Missing or invalid bundles prevent controller startup rather than disabling TLS verification. Restart the operator after an ingress CA rotation so it loads the new bundle.
Namespaces
  • OSAC_CLUSTER_ORDER_NAMESPACE — namespace for ClusterOrder resources (optional).
  • OSAC_COMPUTE_INSTANCE_NAMESPACE — namespace for ComputeInstance resources (optional).
  • OSAC_TENANT_NAMESPACE — namespace for Tenant resources (optional).
  • OSAC_NETWORKING_NAMESPACE — namespace for networking resources (VirtualNetwork, Subnet, SecurityGroup) (optional).
Remote cluster
  • OSAC_REMOTE_CLUSTER_KUBECONFIG — path to kubeconfig for the remote cluster used by Tenant, ComputeInstance, Storage, and Networking controllers (optional). Not supported when the ClusterOrder or BareMetalInstance controller is enabled.
Job history
  • OSAC_MAX_JOB_HISTORY — maximum number of job history entries to retain per resource (default: 10).
Fulfillment service (gRPC)
  • OSAC_FULFILLMENT_SERVER_ADDRESS — fulfillment service gRPC address (e.g. fulfillment-internal-api:8001). When unset, the Fulfillment client and installation setting check are disabled.
  • OSAC_FULFILLMENT_ISSUER_URL — Keycloak realm issuer URL used for OIDC discovery and client-credentials token requests.
  • OSAC_FULFILLMENT_CLIENT_ID and OSAC_FULFILLMENT_CLIENT_SECRET — Keycloak service-account credentials. When the fulfillment client is enabled, Helm reads these from the fulfillment-controller-credentials Secret by default (keys client-id and client-secret). The osac-infra chart provisions this Secret for bundled Keycloak. External Keycloak deployments must provide the same Secret contract for the configured osac-controller client.
  • OSAC_FULFILLMENT_ENDPOINT — externally reachable fulfillment service gRPC address passed to tenant-cluster CSI provisioning (e.g. fulfillment-api.example.com:443).

When the operator is enabled, the umbrella chart renders osac-fulfillment-config in the release namespace. It contains the Keycloak issuer URL and, when configured, the externally reachable Fulfillment endpoint. It also contains names and keys, but not credential values, for the fulfillment-controller-credentials Secret used by installer AAP auth helpers. The operator reads that same Secret for its OAuth client-credentials calls to Fulfillment, and passes the non-secret endpoint and issuer to AAP provisioning jobs that configure tenant-cluster CSI. The global.fulfillmentTrust.enabled setting controls trust reconciliation separately. The OSAC chart does not deploy the CSI meta-driver or create a hub CSI credentials Secret; tenant CSI credentials are managed separately.

LVMS development/CI volumes

The LVMS CSI path supports single-node development/CI environments and accepts ReadWriteOnce and ReadWriteOncePod. Multi-node access modes are rejected.

The provisioner uses LVMS/TopoLVM's configured default device class by omitting LogicalVolume.spec.deviceClass. OSAC's infrastructure chart configures vg1 with default: true. Preinstalled LVMS must have one device class marked default: true in its LVMCluster; its name need not be vg1. This setting is distinct from the Kubernetes default StorageClass annotation.

All OSAC local-tier CSI volumes use that default pool. Keep the default class unchanged while these volumes exist. Device-class selection is not exposed in the OSAC Volume API or tenant CSI StorageClass parameters. The legacy direct TopoLVM path retains its explicit device-class configuration.

LogicalVolume resource names are generated by Kubernetes and recorded with their UIDs in the Volume's vendor context. Normal retries resume that resource; a retry without recorded context creates a new name rather than adopting an existing CR or waiting for a terminating one. A crash before context is saved can leave an untracked LogicalVolume; the volume-UID label and owner/tenant annotations preserve its identity for cleanup.

Controller enable flags

Each controller can be enabled or disabled. If none of these are set, all controllers are enabled. If any flag is set, only the flagged controllers are enabled.

  • OSAC_ENABLE_CLUSTER_CONTROLLER — enable ClusterOrder controller (truthy/falsy).
  • OSAC_ENABLE_COMPUTE_INSTANCE_CONTROLLER — enable ComputeInstance controller (truthy/falsy).
  • OSAC_ENABLE_TENANT_CONTROLLER — enable Tenant controller (truthy/falsy).
  • OSAC_ENABLE_STORAGE_CONTROLLER — enable Storage controller (truthy/falsy).
  • OSAC_ENABLE_VOLUME_CONTROLLER — enable Volume controller (truthy/falsy).
  • OSAC_ENABLE_NETWORKING_CONTROLLER — enable networking controllers (VirtualNetwork, Subnet, SecurityGroup) (truthy/falsy).
  • OSAC_ENABLE_BAREMETAL_INSTANCE_CONTROLLER — enable BareMetalInstance controller (truthy/falsy).
Fulfillment trust reconciliation

OSAC_ENABLE_FULFILLMENT_TRUST_RECONCILER registers the additional ClusterOrder trust reconciler only when the ClusterOrder controller is enabled. When global.fulfillmentTrust.enabled is true, it processes tenant-scoped ClusterOrders in the configured ClusterOrder namespace; there is no per-order opt-in annotation. Development and CI profiles can disable reconciliation with global.fulfillmentTrust.enabled. global.fulfillmentTrust.tenantNamespace sets the tenant CSI namespace (OSAC_FULFILLMENT_TRUST_TENANT_NAMESPACE). An individual order must also have the osac.openshift.io/tenant annotation. The reconciler reads bundle.pem from the management namespace's ca-bundle ConfigMap and reports FulfillmentTrustReady independently of the ordinary ClusterOrder controller. Fulfillment-service and installer-hook TLS verification remains enabled even when this trust feature flag is false.

For each eligible order, the reconciler follows its ClusterReference to the HostedControlPlane kubeconfig Secret. The kubeconfig is used only in the operator process to request short-lived tokens for the preinstalled observer, publisher, and trust-sync service accounts. The admin kubeconfig and returned tokens are never written to a management Secret, status field, or AAP job. The observer verifies the exact CA ConfigMap and CSI rollout; the publisher updates the admission service's bounded expected-bundle record; and the sync identity applies only the approved ConfigMap and CSI pod-template hash. The tenant admission webhook validates both writes. Tokens are renewed before expiry, the expected record is refreshed on retries, obsolete bundle records are revoked after rollout, and records expire automatically if cleanup cannot reach a deleting cluster.

The tenant workload bootstrap must install the CSI trust admission chart with the ClusterOrder UID and tenant annotations before trust can become ready. If the trust identities, admission service, or a trust-enabled CSI controller are not available, the reconciler reports a false condition and retries. It never hands an admin kubeconfig to AAP. The separately published AAP trust-sync template remains an optional manual repair mechanism and is not used by the automatic reconciler.

See config/samples/osac-config-secret.yaml for a complete configuration example.

Console Proxy

The console proxy (cmd/console-proxy/) is an HTTPS/WebSocket server that gives clients access to KubeVirt VM subresources (serial console, VNC) through the OSAC API. It registers itself as a Kubernetes aggregated API server under console.osac.openshift.io/v1alpha1 and exposes ComputeInstance subresources:

GET /apis/console.osac.openshift.io/v1alpha1/namespaces/{ns}/computeinstances/{name}/console
GET /apis/console.osac.openshift.io/v1alpha1/namespaces/{ns}/computeinstances/{name}/vnc
Request flow
Client (CLI / UI)
  |  gRPC bidirectional stream
  v
Fulfillment Service  (Console gRPC server, session manager)
  |  WebSocket (binary)
  v
Console Proxy  (aggregated API on the hub cluster)
  |  WebSocket (binary)
  v
KubeVirt  (VirtualMachineInstance console/VNC subresource)

On each request the proxy:

  1. Looks up the OSAC ComputeInstance CR to find the backing KubeVirt VM name and namespace.
  2. Resolves the kubeconfig for the cluster where the VM runs (see modes below).
  3. Dials the upstream KubeVirt WebSocket at subresources.kubevirt.io/v1/namespaces/{vmNS}/virtualmachineinstances/{vmName}/{subresource}.
  4. Accepts the client WebSocket upgrade and proxies binary data bidirectionally with io.Copy.
VM cluster modes

The --vm-cluster-mode flag (env: OSAC_CONSOLE_PROXY_VM_CLUSTER_MODE) controls how the proxy obtains the kubeconfig for the cluster that runs KubeVirt VMs:

Mode Behavior
remote Reads a kubeconfig from a Secret labeled osac.openshift.io/remote-cluster-kubeconfig in the ComputeInstance's namespace. Use when VMs run on a dedicated cluster.
local Uses the proxy's own in-cluster credentials. Use when VMs run on the same cluster as the proxy.
auto (default) Tries remote first; falls back to local only when no matching Secret exists. Real config errors (parse failures, missing keys) are not masked.
Authentication and authorization

The proxy uses the standard Kubernetes aggregated-API auth delegation model:

  • Authentication -- request-header authentication. The kube-apiserver front-proxy sets identity headers; the proxy validates them against the CA from the kube-system/extension-apiserver-authentication ConfigMap. CA and header configuration are watched dynamically and update without restart.
  • Authorization -- each request triggers a SubjectAccessReview against the kube-apiserver. Allow decisions are cached for 5 minutes, deny decisions for 30 seconds.
Configuration
Variable Default Description
OSAC_CONSOLE_PROXY_PORT 8443 HTTPS API server port
OSAC_CONSOLE_PROXY_HEALTH_BIND_ADDRESS :8081 Health probe server address
OSAC_CONSOLE_PROXY_TLS_CERT_FILE — Path to TLS certificate
OSAC_CONSOLE_PROXY_TLS_KEY_FILE — Path to TLS private key
OSAC_CONSOLE_PROXY_VM_CLUSTER_MODE auto VM cluster resolution mode (remote, local, auto)
Deployment

The console proxy binary is built alongside the operator manager in the same container image (Containerfile). It is deployed as a separate Deployment in the osac namespace with its own ServiceAccount, Service, and TLS Certificate (via cert-manager). An APIService resource registers it with the kube-apiserver. Deployment manifests live in config/console-proxy/ and are consumed via osac-installer.

Source layout
cmd/console-proxy/main.go          # Entry point, CLI flags
internal/consoleproxy/
  server.go                        # HTTPS + health probe servers, routing
  auth.go                          # Delegated authn/authz
  subresource.go                   # WebSocket proxy handlers (console, VNC)
  config_resolver.go               # VM cluster kubeconfig resolution
  discovery.go                     # Kubernetes API discovery endpoints
  status.go                        # Error-to-Kubernetes-Status mapping
config/console-proxy/              # Kustomize deployment manifests
test/e2e/console_proxy_test.go     # E2E tests

Getting Started

Prerequisites
  • go version v1.22.0+
  • docker version 17.03+.
  • kubectl version v1.11.3+.
  • Access to a Kubernetes v1.11.3+ cluster.
To Deploy on the cluster

Build and push your image to the location specified by IMG:

make image-build image-push IMG=<some-registry>/osac-operator:tag

NOTE: This image ought to be published in the personal registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don't work.

Install the CRDs into the cluster:

make install

Deploy the Manager to the cluster with the image specified by IMG:

make deploy IMG=<some-registry>/osac-operator:tag

NOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.

Create instances of your solution

OSAC custom resources (ClusterOrder, ComputeInstance, Tenant, networking, …) are provisioned and managed by the fulfillment service, not applied by hand — drive them through its API.

To Uninstall

Delete the instances (CRs) from the cluster:

Delete resources through the fulfillment service that created them.

Delete the APIs(CRDs) from the cluster:

make uninstall

UnDeploy the controller from the cluster:

make undeploy

Project Distribution

Following are the steps to build the installer and distribute this project to users.

  1. Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/osac-operator:tag

NOTE: The makefile target mentioned above generates an 'install.yaml' file in the dist directory. This file contains all the resources built with Kustomize, which are necessary to install this project without its dependencies.

  1. Using the installer

Users can just run kubectl apply -f to install the project, i.e.:

kubectl apply -f https://raw.githubusercontent.com/<org>/osac-operator/<tag or branch>/dist/install.yaml

Contributing

// TODO(user): Add detailed information on how you would like others to contribute to this project

NOTE: Run make help for more information on all potential make targets

More information can be found via the Kubebuilder Documentation

License

Copyright 2025.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
api module
cmd
Main entrypoint for the operator
Main entrypoint for the operator
console-proxy command
trust-admission command
Package helpers contains small utility methods that don't belong anywhere else.
Package helpers contains small utility methods that don't belong anywhere else.
internal
consoleproxy
Package consoleproxy implements a WebSocket proxy server that exposes KubeVirt VM subresource access (console, VNC) through OSAC ComputeInstance resources.
Package consoleproxy implements a WebSocket proxy server that exposes KubeVirt VM subresource access (console, VNC) through OSAC ComputeInstance resources.
controller
Package controller implements the controller logic
Package controller implements the controller logic
controller/baremetalworker
Package baremetalworker reconciles ClusterOrder bare-metal NodeSets through fulfillment BareMetalInstances and Assisted Service Agents.
Package baremetalworker reconciles ClusterOrder bare-metal NodeSets through fulfillment BareMetalInstances and Assisted Service Agents.
controller/feedback
Package feedback provides shared reconciliation infrastructure for feedback controllers.
Package feedback provides shared reconciliation infrastructure for feedback controllers.
networktask
Package networktask runs network manager tasks as AAP jobs and tracks them in a CR's status.jobs (network manager integration contract §4.3-§4.9).
Package networktask runs network manager tasks as AAP jobs and tracks them in a CR's status.jobs (network manager integration contract §4.3-§4.9).
trustadmission
Package trustadmission validates tenant fulfillment trust mutations.
Package trustadmission validates tenant fulfillment trust mutations.
pkg
aap
Package aap provides a client for interacting with the Ansible Automation Platform (AAP) REST API.
Package aap provides a client for interacting with the Ansible Automation Platform (AAP) REST API.
networkmanager
Package networkmanager parses and resolves network manager registrations (network manager integration contract §4.2).
Package networkmanager parses and resolves network manager registrations (network manager integration contract §4.2).
provisioning
Package provisioning provides an abstraction layer for infrastructure provisioning through multiple backends.
Package provisioning provides an abstraction layer for infrastructure provisioning through multiple backends.
test
testhelpers
Package testhelpers provides shared helpers for deployed networking tests.
Package testhelpers provides shared helpers for deployed networking tests.
utils
Package utils provides some misc.
Package utils provides some misc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL