smartxworks / cluster-api-provider-elf-static-ip

1 stars 2 forks source link

Add support for ElfCluster VIP allocation #2

Closed haijianyang closed 2 years ago

haijianyang commented 2 years ago

自动分配 VIP

测试

apiVersion: ipam.metal3.io/v1alpha1
kind: IPPool
metadata:
  name: ip-pool-default
  namespace: cape-system
  labels:
    ippool.cluster.x-k8s.io/is-default: "true"
spec:
  pools:
    - start: 10.255.160.10
      end: 10.255.160.20
      prefix: 16
      gateway: 10.255.0.1
  prefix: 16
  gateway: 10.255.0.1
  namePrefix: "ip-pool-default"
  dnsServers: []
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  labels:
    cluster.x-k8s.io/cluster-name: elfk8s8
  name: elfk8s8
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - 100.96.0.0/11
  controlPlaneRef:
    apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    kind: KubeadmControlPlane
    name: elfk8s8-control-plane
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: ElfCluster
    name: elfk8s8
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElfCluster
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"infrastructure.cluster.x-k8s.io/v1beta1","kind":"ElfCluster","metadata":{"annotations":{},"name":"elfk8s8","namespace":"default"},"spec":{"cluster":"dd1f408f-7715-48c1-a817-13c3568f1d93","controlPlaneEndpoint":{"host":"","port":6443},"tower":{"authMode":"LOCAL","password":"root","server":"tower.com","username":"system-service"}}}
  creationTimestamp: "2022-08-31T11:04:19Z"
  finalizers:
  - elfcluster.infrastructure.cluster.x-k8s.io
  - elfclusterstaticip.infrastructure.cluster.x-k8s.io
  generation: 2
  labels:
    cluster.x-k8s.io/cluster-name: elfk8s8
  name: elfk8s8
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Cluster
    name: elfk8s8
    uid: d500d2d8-5cbb-455c-9eb4-13a2d3bb918d
  resourceVersion: "105010"
  uid: 0d9edec9-b0f2-4541-a251-90a9d0a8ce59
spec:
  cluster: dd1f408f-7715-48c1-a817-13c3568f1d93
  controlPlaneEndpoint:
    host: 10.255.160.10
    port: 6443
  tower:
    authMode: LOCAL
    password: root
    server: tower.com
    username: system-service
status:
  ready: true