Skip to content

gnuthought/ansible-role-ocp4_machineset_config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocp4_machineset_config

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.

Note

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 Playbooks

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

Installation

ansible-galaxy install \
https://github.com/gnuthought/ansible-role-ocp4_machineset_config/archive/master.tar.gz#/ocp4_machineset_config

Configuration

Table 1. Top level configuration variables
Variable Default Description

ocp4_machineset_config_cloud_provider

(detect from default worker machinesets)

Cloud provider, currently only "aws" is supported.

ocp4_machineset_config_cluster_infra_id

(detect from default worker machinesets)

Infrastructure tag and label used to identify cluster.

ocp4_machineset_config_domain

"ocp4-machineset-config.gnuthought.com"

Domain used for custom group label.

ocp4_machineset_config_group_label

"{{ ocp4_machineset_config_domain }}/machineset-group"

Label applied to machinesets to identify machinesets managed by this role.

ocp4_machineset_config_groups

[]

Listed of machineset groups, described below.

ocp4_machineset_config_disable_default_worker_machinesets

false

Boolean to indicate if default worker machinesets should be scaled to zero.

openshift_cluster_autoscaler_spec

{"scaleDown:{"enabled": true}}

Value for spec section of ClusterAutoscaler definition, applied if any machineset enables autoscaling.

Table 2. AWS configuration variables
Variable Default Description

ocp4_machineset_config_aws_availability_zone_data

None

JSON output of aws ec2 describe-subnets --region=$REGION --subnet-ids …​

ocp4_machineset_config_aws_availability_zones

(detect from default worker machinesets)

Availability zones for worker machinesets

ocp4_machineset_config_aws_iam_instance_profile_id

(detect from default worker machinesets)

AWS IAM instance profile ID

ocp4_machineset_config_aws_instance_type

"m4.large"

Default AWS instance type.

ocp4_machineset_config_aws_root_volume_size

120

AWS root volume size default in GB

ocp4_machineset_config_aws_security_group_search_key

(detect from default worker machinesets)

Key used to find security group

ocp4_machineset_config_aws_security_group_search_value

(detect from default worker machinesets)

Value used to find security group

ocp4_machineset_config_aws_tags

Cluster infra id label

Tags applied to AWS ec2 instances

Table 3. ocp4_machineset_config_groups item values
Variable Default Description

name

(required)

Name for machineset config group

role

(optional)

Value used for default machine and node labels

total_replicas

0

Total number of machineset replicas for non-autoscaling machinesets

autoscale

False

Boolean to indicate if machineautoscaler should be configured for machinesets

total_replicas_min

0

Total minimum number of machineset replicas for non-autoscaling machinesets

total_replicas_max

100

Total maximum number of machineset replicas for non-autoscaling machinesets

aws_instance_type

ocp4_machineset_config_aws_instance_type

Default AWS instance type

aws_root_volume_size

ocp4_machineset_config_aws_root_volume_size

Default root EBS storage disk size

About

Ansible Role for OpenShift 4 MachineSet Management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published