×

Managing machines with the Cluster API is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

You can change the configuration of your OpenStack Cluster API machines by updating values in the Cluster API custom resource manifests.

Sample YAML for configuring OpenStack clusters

The following example YAML files show configurations for a OpenStack cluster.

Sample YAML for a Cluster API infrastructure cluster resource on OpenStack

The infrastructure cluster resource is provider-specific and defines properties that are shared by all the compute machine sets in the cluster, such as the region and subnets. The compute machine set references this resource when creating machines.

Only the parameters in the following example are validated to be compatible with OKD. Other parameters, such as those documented in the upstream Cluster API Provider OpenStack book, might cause undesired behavior.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackCluster (1)
metadata:
  name: <cluster_name> (2)
  namespace: openshift-cluster-api
  labels:
    cluster.x-k8s.io/cluster-name: <cluster_name>
spec:
  controlPlaneEndpoint: <control_plane_endpoint_address> (3)
  disableAPIServerFloatingIP: true
  tags:
    - openshiftClusterID=<cluster_name>
  network:
    id: <api_service_network_id> (4)
  externalNetwork:
    id: <floating_network_id> (5)
  identityRef:
    cloudName: openstack
    name: openstack-cloud-credentials
1 Specify the infrastructure kind for the cluster. This value must match the value for your platform.
2 Specify the cluster ID as the name of the cluster.
3 Specify the IP address of the control plane endpoint and the port used to access it.
4 Specify the UUID of the default network to use for machines that do not specify ports.

This feature might be removed in a future release. To prevent issues due to the removal of this feature, specify at least one port in the machine specification instead of relying solely on this feature.

5 Specify the UUID of an external network. You can specify the network used to assign external floating IP addresses or the network used for egress for this field.

The infrastructure cluster resource requires this field but does not currently use this value. This requirement is planned to be removed in a future release.

Sample YAML for a Cluster API machine template resource on OpenStack

The machine template resource is provider-specific and defines the basic properties of the machines that a compute machine set creates. The compute machine set references this template when creating machines.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate (1)
metadata:
  name: <template_name> (2)
  namespace: openshift-cluster-api
spec:
  template:
    spec: (3)
      flavor: <openstack_node_machine_flavor> (4)
      image:
        filter:
          name: <openstack_image> (5)
1 Specify the machine template kind. This value must match the value for your platform.
2 Specify a name for the machine template.
3 Specify the details for your environment. The values here are examples.
4 Specify the OpenStack flavor to use. For more information, see Creating flavors for launching instances.
5 Specify the image to use.

Sample YAML for a Cluster API compute machine set resource on OpenStack

The compute machine set resource defines additional properties of the machines that it creates. The compute machine set also references the infrastructure resource and machine template when creating machines.

apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
  name: <machine_set_name> (1)
  namespace: openshift-cluster-api
spec:
  clusterName: <cluster_name> (2)
  replicas: 1
  selector:
    matchLabels:
      test: example
      cluster.x-k8s.io/cluster-name: <cluster_name>
      cluster.x-k8s.io/set-name: <machine_set_name>
  template:
    metadata:
      labels:
        test: example
        cluster.x-k8s.io/cluster-name: <cluster_name>
        cluster.x-k8s.io/set-name: <machine_set_name>
        node-role.kubernetes.io/<role>: ""
    spec:
      bootstrap:
         dataSecretName: worker-user-data (3)
      clusterName: <cluster_name>
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: OpenStackMachineTemplate (4)
        name: <template_name> (5)
      failureDomain: <nova_availability_zone> (6)
1 Specify a name for the compute machine set.
2 Specify the cluster ID as the name of the cluster.
3 For the Cluster API Technology Preview, the Operator can use the worker user data secret from the openshift-machine-api namespace.
4 Specify the machine template kind. This value must match the value for your platform.
5 Specify the machine template name.
6 Optional: Specify the name of the Nova availability zone for the machine set to create machines in. If you do not specify a value, machines are not restricted to a specific availability zone.