From 72349ab99e6451a72958691116e9ea0a90df541b Mon Sep 17 00:00:00 2001 From: haijianyang Date: Thu, 14 Dec 2023 03:36:27 -0500 Subject: [PATCH] test --- api/v1beta1/types.go | 9 +++ api/v1beta1/zz_generated.deepcopy.go | 8 +++ ...tructure.cluster.x-k8s.io_elfmachines.yaml | 26 +++++++ ....cluster.x-k8s.io_elfmachinetemplates.yaml | 29 ++++++++ docs/releasing.md | 2 +- em.yaml | 68 +++++++++++++++++++ metadata.yaml | 3 + test.txt | 9 +++ test/e2e/data/cape/metadata.yaml | 3 + 9 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 em.yaml create mode 100644 test.txt diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 8f98f83f..e18cf5ab 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -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 @@ -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 { diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index d1f535c0..d741329a 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ limitations under the License. package v1beta1 import ( + "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" @@ -417,6 +418,13 @@ func (in *NetworkDeviceSpec) DeepCopyInto(out *NetworkDeviceSpec) { *out = make([]NetworkDeviceRouteSpec, len(*in)) copy(*out, *in) } + if in.AddressesFromPools != nil { + in, out := &in.AddressesFromPools, &out.AddressesFromPools + *out = make([]v1.TypedLocalObjectReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkDeviceSpec. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachines.yaml index 007b3c3d..e00060db 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachines.yaml @@ -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 diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachinetemplates.yaml index 4be744ae..2c4072be 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_elfmachinetemplates.yaml @@ -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. diff --git a/docs/releasing.md b/docs/releasing.md index e556a81f..e02bc559 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,7 +1,7 @@ # 发布流程 1. 如果发布的是新的 minor 版本,创建一个新的发布分支并推送到 GitHub,否则切换到该分支,例如 `release-0.6` -2. 设置版本环境变量 `VERSION=v0.x.x`,版本以 v 为前缀,例如 v0.0.6 +2. 设置版本环境变量 `VERSION=v1.4.0-beta.0`,版本以 v 为前缀,例如 v0.0.6 3. 打标签 `git tag -m $VERSION $VERSION` 4. 推送标签到 GitHub `git push upstream $VERSION` 5. 标签推送到 GitHub 后会自动触发 [Github Action](https://github.com/smartxworks/cluster-api-provider-elf) 创建一个[待发布版本](https://github.com/smartxworks/cluster-api-provider-elf/releases) diff --git a/em.yaml b/em.yaml new file mode 100644 index 00000000..fd0fe7be --- /dev/null +++ b/em.yaml @@ -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 diff --git a/metadata.yaml b/metadata.yaml index 55eda299..fd8c99aa 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -6,6 +6,9 @@ apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 kind: Metadata releaseSeries: + - major: 1 + minor: 4 + contract: v1beta1 - major: 1 minor: 3 contract: v1beta1 diff --git a/test.txt b/test.txt new file mode 100644 index 00000000..44d42913 --- /dev/null +++ b/test.txt @@ -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 diff --git a/test/e2e/data/cape/metadata.yaml b/test/e2e/data/cape/metadata.yaml index 55eda299..fd8c99aa 100644 --- a/test/e2e/data/cape/metadata.yaml +++ b/test/e2e/data/cape/metadata.yaml @@ -6,6 +6,9 @@ apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 kind: Metadata releaseSeries: + - major: 1 + minor: 4 + contract: v1beta1 - major: 1 minor: 3 contract: v1beta1