Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
haijianyang committed Dec 14, 2023
1 parent 5e75d87 commit b227422
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ limitations under the License.

package v1beta1

import (
corev1 "k8s.io/api/core/v1"
)

// CloneMode is the type of clone operation used to clone a VM from a template.
type CloneMode string

Expand Down Expand Up @@ -137,6 +141,11 @@ type NetworkDeviceSpec struct {
// Required when DHCP4 is false.
// +optional
Routes []NetworkDeviceRouteSpec `json:"routes,omitempty"`

// AddressesFromPools is a list of IPAddressPools that should be assigned
// to IPAddressClaims.
// +optional
AddressesFromPools []corev1.TypedLocalObjectReference `json:"addressesFromPools,omitempty"`
}

func (d *NetworkDeviceSpec) HasNetworkType() bool {
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

26 changes: 26 additions & 0 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,32 @@ spec:
description: NetworkDeviceSpec defines the network configuration
for a virtual machine's network device.
properties:
addressesFromPools:
description: AddressesFromPools is a list of IPAddressPools
that should be assigned to IPAddressClaims.
items:
description: TypedLocalObjectReference contains enough
information to let you locate the typed referenced object
inside the same namespace.
properties:
apiGroup:
description: APIGroup is the group for the resource
being referenced. If APIGroup is not specified,
the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
type: array
ipAddrs:
description: IPAddrs is a list of one or more IPv4 and/or
IPv6 addresses to assign to this device. Required when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,35 @@ spec:
description: NetworkDeviceSpec defines the network configuration
for a virtual machine's network device.
properties:
addressesFromPools:
description: AddressesFromPools is a list of IPAddressPools
that should be assigned to IPAddressClaims.
items:
description: TypedLocalObjectReference contains
enough information to let you locate the typed
referenced object inside the same namespace.
properties:
apiGroup:
description: APIGroup is the group for the
resource being referenced. If APIGroup is
not specified, the specified Kind must be
in the core API group. For any other third-party
types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource
being referenced
type: string
name:
description: Name is the name of resource
being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
type: array
ipAddrs:
description: IPAddrs is a list of one or more IPv4
and/or IPv6 addresses to assign to this device.
Expand Down
68 changes: 68 additions & 0 deletions em.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElfMachine
metadata:
annotations:
cluster.x-k8s.io/cloned-from-groupkind: ElfMachineTemplate.infrastructure.cluster.x-k8s.io
cluster.x-k8s.io/cloned-from-name: haijian-test1-controlplane
creationTimestamp: "2023-12-13T06:59:41Z"
finalizers:
- elfmachine.infrastructure.cluster.x-k8s.io
- elfmachinestaticip.infrastructure.cluster.x-k8s.io
generation: 3
labels:
cluster.x-k8s.io/cluster-name: haijian-test1
cluster.x-k8s.io/control-plane: ""
cluster.x-k8s.io/control-plane-name: haijian-test1-controlplane
name: haijian-test1-controlplane-4vrh9
namespace: default
ownerReferences:
- apiVersion: cluster.x-k8s.io/v1beta1
blockOwnerDeletion: true
controller: true
kind: Machine
name: haijian-test1-controlplane-ph756
uid: 51a9eb4a-3ed0-49d7-b979-80bcacbeb750
resourceVersion: "8047355"
uid: db02a6f2-b12c-45d0-845b-39098bbb2021
spec:
cloneMode: FastClone
diskGiB: 0
ha: true
memoryMiB: 12288
network:
devices:
- ipAddrs:
- 10.255.160.10
netmask: 255.255.0.0
networkType: IPV4
routes:
- gateway: 10.255.0.1
vlan: dd1f408f-7715-48c1-a817-13c3568f1d93_4cd00407-63ca-440b-80b7-ceacfccb8d08
nameservers:
- 10.255.0.2
numCPUS: 8
osType: LINUX
providerID: elf://9027613c-aa65-4065-896f-cbf015990b0a
template: sks-managed-rocky-8.8-amd64-k8s-v1.25.15-v1dev2-aptczj-template
status:
addresses:
- address: 10.255.160.10
type: InternalIP
conditions:
- lastTransitionTime: "2023-12-13T07:02:35Z"
status: "True"
type: Ready
- lastTransitionTime: "2023-12-13T06:59:41Z"
status: "True"
type: TowerAvailable
- lastTransitionTime: "2023-12-13T07:02:35Z"
status: "True"
type: VMProvisioned
hostServerName: node20-218
hostServerRef: clb291e3200fg0958s6r9tf79
network:
- ipAddrs:
- 10.255.160.10
macAddr: 52:54:00:83:f9:3c
ready: true
vmRef: 9027613c-aa65-4065-896f-cbf015990b0a
9 changes: 9 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
status:
conditions:
- lastTransitionTime: "2023-12-112T12:00:00Z"
type: IPAddressClaimed
status: "True"
network:
- ipAddrs:
- 1.1.1.11
macAddr: 00:01:02:03:04:05

0 comments on commit b227422

Please sign in to comment.