OpenShift 4 MachineSet management to implement custom machinesets such as to create dedicated compute and infra nodes.
This Ansible role will query the cluster for the default worker machinesets provisioned by the installer and then manage custom machinesets based on the discovered worker configuration information.
As OpenShift 4 is a fast moving target this Ansible role may become obsolete at any time. In particular we hope that the standard OpenShift installer or a standard OpenShift 4 operator will manage custom machinesets such as to render this Ansible role redundant.
Example creating machinesets based on default worker machinesets:
- hosts: localhost
connection: local
gather_facts: no
roles:
- role: ocp4_machineset_config
vars:
ocp4_machineset_config_disable_default_worker_machinesets: true
ocp4_machineset_config_groups:
- name: compute
autoscale: true
role: compute
total_replicas_min: 3
total_replicas_max: 30
aws_instance_type: m4.large
aws_root_volume_size: 80
- name: infra
role: infra
total_replicas: 2
aws_instance_type: m4.large
Example creating machinesets from scratch:
---
- hosts: localhost
connection: local
gather_facts: no
roles:
- role: ocp4_machineset_config
vars:
ocp4_machineset_config_cloud_provider: aws
ocp4_machineset_config_cluster_infra_id: "{{ lookup('env', 'INFRA_ID') }}"
ocp4_machineset_config_aws_iam_instance_profile_id: "{{ lookup('env', 'WorkerInstanceProfile') }}"
ocp4_machineset_config_aws_security_group_search_key: group-id
ocp4_machineset_config_aws_security_group_search_value: "{{ lookup('env', 'WorkerSecurityGroupId') }}"
ocp4_machineset_config_aws_availability_zone_data: >-
{{ lookup('pipe', 'aws ec2 describe-subnets --region=$REGION --subnet-ids ${PrivateSubnetIds//,/ }') }}
ocp4_machineset_config_groups:
- name: compute
aws_instance_type: m4.large
aws_root_volume_size: 80
autoscale: true
role: compute
total_replicas_min: 1
total_replicas_max: 30
- name: infra
aws_instance_type: m4.large
role: infra
total_replicas: 1
ansible-galaxy install \
https://github.com/gnuthought/ansible-role-ocp4_machineset_config/archive/master.tar.gz#/ocp4_machineset_config
Variable | Default | Description |
---|---|---|
|
(detect from default worker machinesets) |
Cloud provider, currently only "aws" is supported. |
|
(detect from default worker machinesets) |
Infrastructure tag and label used to identify cluster. |
|
|
Domain used for custom group label. |
|
|
Label applied to machinesets to identify machinesets managed by this role. |
|
|
Listed of machineset groups, described below. |
|
|
Boolean to indicate if default worker machinesets should be scaled to zero. |
|
|
Value for spec section of ClusterAutoscaler definition, applied if any machineset enables autoscaling. |
Variable | Default | Description |
---|---|---|
|
None |
JSON output of |
|
(detect from default worker machinesets) |
Availability zones for worker machinesets |
|
(detect from default worker machinesets) |
AWS IAM instance profile ID |
|
|
Default AWS instance type. |
|
|
AWS root volume size default in GB |
|
(detect from default worker machinesets) |
Key used to find security group |
|
(detect from default worker machinesets) |
Value used to find security group |
|
Cluster infra id label |
Tags applied to AWS ec2 instances |
ocp4_machineset_config_groups
item values
Variable | Default | Description |
---|---|---|
|
(required) |
Name for machineset config group |
|
(optional) |
Value used for default machine and node labels |
|
|
Total number of machineset replicas for non-autoscaling machinesets |
|
|
Boolean to indicate if machineautoscaler should be configured for machinesets |
|
|
Total minimum number of machineset replicas for non-autoscaling machinesets |
|
|
Total maximum number of machineset replicas for non-autoscaling machinesets |
|
|
Default AWS instance type |
|
|
Default root EBS storage disk size |