Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Build the manager binary
# Run this with docker build --build-arg builder_image=<golang:x.y.z>
ARG builder_image=docker.io/golang:1.23
ARG builder_image=docker.io/golang:1.24
FROM ${builder_image} as builder
WORKDIR /workspace

Expand Down
27 changes: 27 additions & 0 deletions api/v1alpha1/kubevirtmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const (
// MachineFinalizer allows ReconcileKubevirtMachine to clean up resources associated with machine before
// removing it from the apiserver.
MachineFinalizer = "kubevirtmachine.infrastructure.cluster.x-k8s.io"

// AllocatedIPsAnnotationPrefix is the prefix for annotations storing allocated IPs per network
// The full annotation key will be: AllocatedIPsAnnotationPrefix + networkName
AllocatedIPsAnnotationPrefix = "infrastructure.cluster.x-k8s.io/allocated-ips-"
)

// VirtualMachineTemplateSpec defines the desired state of the kubevirt VM.
Expand Down Expand Up @@ -55,6 +59,8 @@ type KubevirtMachineSpec struct {
// When nil, this defaults to the value present in the KubevirtCluster object's spec associated with this machine.
// +optional
InfraClusterSecretRef *corev1.ObjectReference `json:"infraClusterSecretRef,omitempty"`

NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"`
}

// VirtualMachineBootstrapCheckSpec defines how the controller will remotely check CAPI Sentinel file content.
Expand All @@ -68,6 +74,27 @@ type VirtualMachineBootstrapCheckSpec struct {
CheckStrategy string `json:"checkStrategy,omitempty"`
}

type IPPoolEntry struct {
// +required
InterfaceName string `json:"interfaceName"`
// Subnets specify IP ranges from which addresses will be allocated for this interface.
// Supports CIDR notation, hyphenated ranges, and single IPs.
// +required
Subnets []string `json:"subnets"`
}

type NetworkConfig struct {
// CloudInitNetworkData contains user-provided cloud-init network data in YAML format.
// The system will find the interface specified in IPPool entries and inject
// allocated IP addresses into this network configuration.
// +optional
CloudInitNetworkData string `json:"cloudInitNetworkData,omitempty"`
// IPPool is a map where the key is the network name and the value contains
// the interface name and subnets for that network.
// +required
IPPool map[string]IPPoolEntry `json:"ipPool"`
}

// KubevirtMachineStatus defines the observed state of KubevirtMachine.
type KubevirtMachineStatus struct {
// Ready denotes that the machine is ready
Expand Down
47 changes: 47 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -195,32 +195,27 @@ spec:
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
A human readable message indicating details about the transition.
This field may be empty.
maxLength: 10240
minLength: 1
type: string
reason:
description: |-
reason is the reason for the condition's last transition in CamelCase.
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may be empty.
maxLength: 256
minLength: 1
type: string
severity:
description: |-
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
maxLength: 32
type: string
status:
description: status of the condition, one of True, False, Unknown.
Expand All @@ -230,8 +225,6 @@ spec:
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
maxLength: 256
minLength: 1
type: string
required:
- lastTransitionTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
additionalProperties:
type: string
description: |-
labels is a map of string keys and values that can be used to organize and categorize
Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
More info: http://kubernetes.io/docs/user-guide/labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
networkConfig:
properties:
cloudInitNetworkData:
description: |-
CloudInitNetworkData contains user-provided cloud-init network data in YAML format.
The system will find the interface specified in IPPool entries and inject
allocated IP addresses into this network configuration.
type: string
ipPool:
additionalProperties:
properties:
interfaceName:
type: string
subnets:
description: |-
Subnets specify IP ranges from which addresses will be allocated for this interface.
Supports CIDR notation, hyphenated ranges, and single IPs.
items:
type: string
type: array
required:
- interfaceName
- subnets
type: object
description: |-
IPPool is a map where the key is the network name and the value contains
the interface name and subnets for that network.
type: object
required:
- ipPool
type: object
providerID:
description: ProviderID TBD what to use for Kubevirt
type: string
Expand Down Expand Up @@ -4348,19 +4379,11 @@ spec:
address.
properties:
address:
description: address is the machine address.
maxLength: 256
minLength: 1
description: The machine address.
type: string
type:
description: type is the machine address type, one of Hostname,
ExternalIP, InternalIP, ExternalDNS or InternalDNS.
enum:
- Hostname
- ExternalIP
- InternalIP
- ExternalDNS
- InternalDNS
description: Machine address type, one of Hostname, ExternalIP,
InternalIP, ExternalDNS or InternalDNS.
type: string
required:
- address
Expand All @@ -4375,32 +4398,27 @@ spec:
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
A human readable message indicating details about the transition.
This field may be empty.
maxLength: 10240
minLength: 1
type: string
reason:
description: |-
reason is the reason for the condition's last transition in CamelCase.
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may be empty.
maxLength: 256
minLength: 1
type: string
severity:
description: |-
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
maxLength: 32
type: string
status:
description: status of the condition, one of True, False, Unknown.
Expand All @@ -4410,8 +4428,6 @@ spec:
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
maxLength: 256
minLength: 1
type: string
required:
- lastTransitionTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,37 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
networkConfig:
properties:
cloudInitNetworkData:
description: |-
CloudInitNetworkData contains user-provided cloud-init network data in YAML format.
The system will find the interface specified in IPPool entries and inject
allocated IP addresses into this network configuration.
type: string
ipPool:
additionalProperties:
properties:
interfaceName:
type: string
subnets:
description: |-
Subnets specify IP ranges from which addresses will be allocated for this interface.
Supports CIDR notation, hyphenated ranges, and single IPs.
items:
type: string
type: array
required:
- interfaceName
- subnets
type: object
description: |-
IPPool is a map where the key is the network name and the value contains
the interface name and subnets for that network.
type: object
required:
- ipPool
type: object
providerID:
description: ProviderID TBD what to use for Kubevirt
type: string
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: controller
- image: 127.0.0.1:32771/capk-manager-amd64:dev
name: manager
Loading