Skip to content

Latest commit

 

History

History
223 lines (199 loc) · 7.21 KB

DEV.md

File metadata and controls

223 lines (199 loc) · 7.21 KB

Living document which describes how to build the installer and machine API to support static IPs for a given point in time.

Checklist:

R=PR in review D=PR in draft

Building the installer

Within the context of static IPs, the installer is responsible for:

  1. Clone the installer repo
  2. Apply the installer patches that comprise the current changeset:
curl https://patch-diff.githubusercontent.com/raw/openshift/installer/pull/6982.patch | git apply
curl https://patch-diff.githubusercontent.com/raw/openshift/installer/pull/7023.patch | git apply
curl https://patch-diff.githubusercontent.com/raw/openshift/installer/pull/6512.patch | git apply
  1. Update go.mod to use API extensions in api#1338
replace github.com/openshift/api => github.com/openshift-splat-team/api v0.0.0-20230320203849-e0ab19eba3b2
  1. Revendor
go mod tidy
go mod vendor
  1. Build the installer
./hack/build.sh

Building the machine API operator

  1. Clone the machine API repo
  2. Apply the following patches:
curl https://patch-diff.githubusercontent.com/raw/openshift/machine-api-operator/pull/1079.patch | git apply
  1. Update go.mod to use API extensions in api#1338
replace github.com/openshift/api => github.com/openshift-splat-team/api v0.0.0-20230425185222-828ab2f6180c
  1. Revendor
go mod tidy
go mod vendor
  1. Build the machine-api-operator and push to a registry accessible by the cluster.
REGISTRY="<your image registry>"
podman build . --tag ${REGISTRY}/init/openshift:machine-api-operator-test
podman push --authfile ~/auth.json ${REGISTRY}/init/openshift:machine-api-operator-test
  1. Build an updated release image containing the test machine-api-operator image
RELEASE_IMAGE="<current cluster release image>"
REGISTRY="<your image registry>"
oc adm release new --from-release ${RELEASE_IMAGE} machine-api-operator=${REGISTRY}/init/openshift:machine-api-operator-test --to-image ${REGISTRY}/init/openshift:static-ip-release -a ~/pull-secret.txt
  1. (Optional) Upgrade the cluster
REGISTRY="<your image registry>"
oc adm upgrade --to-image=${REGISTRY}/init/openshift:static-ip-release --force=true --allow-explicit-upgrade=true --allow-upgrade-with-warnings

End to End Testing

Functions implemented in draft or higher maturity PRs:

  • [*] Bootstrap and control plane nodes receive static IPs
  • [*] Draft of openshift/api changes
  • Control plane machine manifests reflect static IPs
  • [*] Compute machine manifests reflect static IPs
  • [*] Implementation of preProvision lifecycle hook

Prerequisites:

  • [*] Build the installer
  • [*] Build the machine API operator
  • [*] Build a release image with the updated machine API operator
  • [*] Create install-config.yaml with node IP addresses
  1. Create manifests
  2. Create compute machine manifests with a static IP
  3. Create cluster with the built release image:
export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=${REGISTRY}/init/openshift:static-ip-release
openshift-install create cluster

Samples

platform spec with static IP addresses

platform:
  vsphere:
    datacenter: vanderlab
    apiVIP: 192.168.100.200
    ingressVIP: 192.168.100.201
    network: "lab-pg"
    defaultDatastore: workloadDatastore
    password: "blahblah"
    cluster: cluster1
    username: administrator@vsphere.local
    vCenter: your.vcenter.net
    hosts:
    - role: bootstrap
      networkDevice:
        ipAddrs:
        - 192.168.100.240/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: control-plane
      networkDevice:
        ipAddrs:
        - 192.168.100.241/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: control-plane
      networkDevice:
        ipAddrs:
        - 192.168.100.242/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: control-plane
      networkDevice:
        ipAddrs:
        - 192.168.100.243/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: compute
      networkDevice:
        ipAddrs:
        - 192.168.100.244/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: compute
      networkDevice:
        ipAddrs:
        - 192.168.100.245/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215
    - role: compute
      networkDevice:
        ipAddrs:
        - 192.168.100.246/24
        gateway4: 192.168.100.1
        nameservers:
        - 192.168.1.215

compute machine with static IP

apiVersion: machine.openshift.io/v1beta1
kind: Machine
metadata:
  name: rvanderp5-dev-28z5n-worker-0-cp8gl-2
  labels:
    machine.openshift.io/cluster-api-cluster: rvanderp5-dev-28z5n
    machine.openshift.io/cluster-api-machine-role: worker
    machine.openshift.io/cluster-api-machine-type: worker    
    machine.openshift.io/region: region1
    machine.openshift.io/zone: ''
spec:
  lifecycleHooks: {}
  metadata: {}
  providerSpec:
    value:
      numCoresPerSocket: 2
      diskGiB: 60
      snapshot: ''
      userDataSecret:
        name: worker-user-data
      memoryMiB: 16384
      credentialsSecret:
        name: vsphere-cloud-credentials
      network:
        devices:
          - networkName: lab-pg
            ipAddrs:
            - 192.168.100.250/24
            gateway4: 192.168.100.1
            nameservers:
            - 192.168.1.215            
      metadata:
        creationTimestamp: null
      numCPUs: 4
      kind: VSphereMachineProviderSpec
      workspace:
        datacenter: vanderlab
        datastore: /vanderlab/datastore/workloadDatastore
        folder: /vanderlab/vm/rvanderp5-dev-5dhsb
        resourcePool: /vanderlab/host/workload-cluster-1//Resources
        server: vcenter.vanderlab.net
      template: rvanderp5-dev-28z5n-rhcos-vanderlab-zone-a
      apiVersion: machine.openshift.io/v1beta1