Skip to content

Commit

Permalink
Basic development docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Oct 17, 2024
1 parent b7edaf9 commit 7484e73
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 93 deletions.
37 changes: 37 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# machine-api-provider-cloudscale

Provider for cloudscale.ch for the OpenShift machine-api.

## Testing on a local non-OCP cluster

```bash
# Apply required upstream CRDs
kubectl apply -k config/crds

make run

# Apply a generic machine object that will not join a cluster
kubectl apply -f config/samples/machine-cloudscale-generic.yml
```

## Testing on a Project Syn managed OCP cluster

```bash
# Deploy nodelink-controller if not already deployed
kubectl apply -f config/deploy/nodelink-controller.yml

# Generate the userData secret from the main.tf.json in the cluster catalog
./pkg/machine/userdata/userdata-secret-from-maintfjson.sh manifests/openshift4-terraform/main.tf.json | k apply -f-

make run

# Apply a known working machine object
# This will join the cluster and become a worker node
# You want to update:
# - metadata.labels["machine.openshift.io/cluster-api-cluster"]
# - spec.providerSpec.value.zone
# - spec.providerSpec.value.baseDomain
# - spec.providerSpec.value.image
# - spec.providerSpec.value.interfaces[0].networkUUID
kubectl apply -f config/samples/machine-cloudscale-known-working.yml
```
4 changes: 4 additions & 0 deletions config/crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- machine.openshift.io.crd.yaml
- machinehealthcheck.openshift.io.crd.yaml
- machineset.openshift.io.crd.yaml
38 changes: 38 additions & 0 deletions config/deploy/nodelink-controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodelink-controller
namespace: openshift-machine-api
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: nodelink-controller
template:
metadata:
labels:
app: nodelink-controller
spec:
containers:
- args:
- --logtostderr=true
- --v=3
- --leader-elect=true
- --leader-elect-lease-duration=120s
- --namespace=openshift-machine-api
command:
- /nodelink-controller
image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:ad0bb293968c38d282e3d348872007ce780bc1be1407bce62528cae0f4814161
imagePullPolicy: IfNotPresent
name: nodelink-controller
resources:
requests:
cpu: 10m
memory: 20Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
restartPolicy: Always
serviceAccountName: machine-api-controllers
status: {}
90 changes: 0 additions & 90 deletions config/examples/machine-vsphere.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Minimal generic config that will not join any node but just creating a machine
apiVersion: machine.openshift.io/v1beta1
kind: Machine
metadata:
Expand All @@ -14,13 +15,12 @@ spec:
providerSpec:
value:
zone: lpg1
baseDomain: cluster-1.appuio.cloud
baseDomain: cluster-1.appuio.io
flavor: flex-4-1
image: debian-12
rootVolumeSizeGB: 50
antiAffinityKey: app
sshKeys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII/HGW/GXvDRliE36QJJgYigs7+UfJFf/fkLotIDOl8z [email protected]
sshKeys: []
interfaces:
- type: Public
status: {}
40 changes: 40 additions & 0 deletions config/samples/machine-cloudscale-known-working.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Known working config creating a node that will join a OCP cluster.
# Create the userDataSecret with
# $ ./pkg/machine/userdata/userdata-secret-from-maintfjson.sh c-appuio-lab-cloudscale-rma-0/manifests/openshift4-terraform/main.tf.json
#
# Created from this config:
# $ k get machine,node app-7ws9q
# NAME PHASE TYPE REGION ZONE AGE
# machine.machine.openshift.io/app-7ws9q Running flex-16-4 rma rma1 3m38s
#
# NAME STATUS ROLES AGE VERSION
# node/app-7ws9q Ready app,worker 59s v1.28.13+2ca1a23
apiVersion: machine.openshift.io/v1beta1
kind: Machine
metadata:
annotations: {}
generateName: app-
labels:
machine.openshift.io/cluster-api-cluster: c-appuio-lab-cloudscale-rma-0
spec:
lifecycleHooks: {}
metadata:
labels:
node-role.kubernetes.io/app: ""
node-role.kubernetes.io/worker: ""
providerSpec:
value:
zone: rma1
baseDomain: lab-cloudscale-rma-0.appuio.cloud
flavor: flex-16-4
image: custom:rhcos-4.15
rootVolumeSizeGB: 100
antiAffinityKey: app
interfaces:
- type: Private
networkUUID: fd2b132d-f5d0-4024-b99f-68e5321ab4d1
userDataSecret:
name: cloudscale-user-data
tokenSecret:
name: cloudscale-rw-token
status: {}

0 comments on commit 7484e73

Please sign in to comment.