Skip to content

Commit

Permalink
added redhat_ocp_virt platform to sap_hypervisor_node_preconfigure
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Koenig committed Sep 26, 2023
1 parent f0cc8c0 commit 3d4ae5b
Show file tree
Hide file tree
Showing 39 changed files with 1,374 additions and 84 deletions.
11 changes: 11 additions & 0 deletions playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- hosts: all
gather_facts: true
serial: 1
vars:
sap_hypervisor_node_platform: redhat_ocp_virt

tasks:
- name: Include Role
ansible.builtin.include_role:
name: sap_hypervisor_node_preconfigure
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
sap_hypervisor_node_preconfigure_cluster_config:

# URL under which the OCP cluster is reachable
cluster_url: ocpcluster.domain.org

# namespace under which the VMs are created, note this has to be
# openshift-sriov-network-operator in case of using SRIOV network
# devices
vm_namespace: sap

# Optional, configuration for trident driver for Netapp NFS filer
trident:
management: management.domain.org
data: datalif.netapp.domain.org
svm: sap_svm
backend: nas_backend
aggregate: aggregate_Name
username: admin
password: xxxxx
storage_driver: ontap-nas
storage_prefix: ocpv_sap_

# detailed configuration for every worker that should be configured
#
workers:
- kubernetes_reserved_cpus: "0,1" # CPU cores reserved for
# kubernetes

- name: worker-0 # name must match the node name
networks: # Example network config
- name: sapbridge # using a bridge
description: SAP bridge
state: up
type: linux-bridge
ipv4:
enabled: false
auto-gateway: false
auto-dns: false
bridge:
options:
stp:
enabled: false
port:
- name: ens1f0 # network IF name
- name: storage # an SRIOV device
interface: ens2f0 # network IF name
type: sriov

- bridge: # another bridge
options:
stp:
enabled: false
port:
- name: ens2f0 # network IF name
description: storage
mtu: 9000
ipv4:
address:
- ip: 192.168.1.51 # IP config
prefix-length: 24
auto-dns: false
auto-gateway: false
enabled: true
name: storagebridge
state: up
type: linux-bridge
- name: multi # another SRIOV device
interface: ens2f1 # network IF name
type: sriov

- name: worker-1 # second worker configuration
networks: # Example network config
- name: sapbridge # using a bridge
description: SAP bridge
state: up
type: linux-bridge
ipv4:
enabled: false
auto-gateway: false
auto-dns: false
bridge:
options:
stp:
enabled: false
port:
- name: ens1f0 # network IF name
- name: storage # an SRIOV device
interface: ens2f0 # network IF name
type: sriov
209 changes: 203 additions & 6 deletions roles/sap_hypervisor_node_preconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,191 @@
sap_hypervisor_node_preconfigure
=======================

This role will set and check the required settings and parameters for a hypervisor running VMs for SAP HANA.
This role will configure the following hypervisors in order to run SAP workloads:
* Redhat Openshift Virtualization (OCPV)
* Redhat Enterprise Virtualization (RHV)

Platform: Redhat Openshift Virtualization
=========================================

This role will configure a plain vanilla Openshift cluster so it can be used for SAP workloads.

Requirements
------------
A freshly installed Openshift cluster.
The worker nodes should have > 96GB of memory.
Storage is required, e.g. via NFS, Openshift Data Foundation or local storage.
This role can setup access to a Netapp Filer via Trident storage connector.
Point the `KUBECONFIG` environment variable to you `kubeconfig`.


Install the packages stated in `requirements.txt` on the host where the role runs.
The required packages are:
```
httpd-tools
ansible-collection-kubernetes-core
```


Make the role available in case you didn't install it already in an ansible roles directory, e.g.

```
mkdir -p ~/.ansible/roles/
ln -sf ~/community.sap_install/roles/sap_hypervisor_node_preconfigure ~/.ansible/roles/
```

Role Variables
--------------
General variables are defined in sap_hypervisor_node_preconfigure/vars/platform_defaults_redhat_ocp_virt.yml
```
# Install the trident NFS storage provider
sap_hypervisor_node_preconfigure_install_trident: False
# URL of the trident installer package to use
sap_hypervisor_node_preconfigure_install_trident_url: https://github.com/NetApp/trident/releases/download/v23.01.0/trident-installer-23.01.0.tar.gz
# should SRIOV be enabled for unsupported NICs
sap_hypervisor_node_preconfigure_sriov_enable_unsupported_nics: True
# Amount of memory [GB] to be reserved for the hypervisor on hosts >= 512GB
sap_hypervisor_node_preconfigure_hypervisor_reserved_ram_host_ge_512: 64 #GB
# Amount of memory [GB] to be reserved for the hypervisor on hosts < 512GB
sap_hypervisor_node_preconfigure_hypervisor_reserved_ram_host_lt_512: 32 #GB
# Should the check for the minimal amount of be ignored? Minimal amount is 96 GB
# If ignored, the amount of $hostmemory - $reserved is allocated with a lower bound of 0 in case $reserved > $hostmemory
sap_hypervisor_node_preconfigure_ignore_minimal_memory_check: False
```

The following variables are describing the nodes and networks to be used. It can make sense to have them in a seperate file, e.g. see `playbooks/vars/sample-variables-sap-hypervisor-node-preconfigure-rh_ocp_virt.yml` for an example.
```
sap_hypervisor_node_preconfigure_cluster_config:
# URL under which the OCP cluster is reachable
cluster_url: ocpcluster.domain.org
# namespace under which the VMs are created, note this has to be
# openshift-sriov-network-operator in case of using SRIOV network
# devices
vm_namespace: sap
# Optional, configuration for trident driver for Netapp NFS filer
trident:
management: management.domain.org
data: datalif.netapp.domain.org
svm: sap_svm
backend: nas_backend
aggregate: aggregate_Name
username: admin
password: xxxxx
storage_driver: ontap-nas
storage_prefix: ocpv_sap_
# detailed configuration for every worker that should be configured
workers:
kubernetes_reserved_cpus: "0,1" # CPU cores reserved for
# kubernetes
- name: worker-0 # name must match the node name
networks: # Example network config
- name: sapbridge # using a bridge
description: SAP bridge
state: up
type: linux-bridge
ipv4:
enabled: false
auto-gateway: false
auto-dns: false
bridge:
options:
stp:
enabled: false
port:
- name: ens1f0 # network IF name
- name: storage # an SRIOV device
interface: ens2f0 # network IF name
type: sriov
- bridge: # another bridge
options:
stp:
enabled: false
port:
- name: ens2f0 # network IF name
description: storage
mtu: 9000
ipv4:
address:
- ip: 192.168.1.51 # IP config
prefix-length: 24
auto-dns: false
auto-gateway: false
enabled: true
name: storagebridge
state: up
type: linux-bridge
- name: multi # another SRIOV device
interface: ens2f1 # network IF name
type: sriov
- name: worker-1 # second worker configuration
networks: # Example network config
- name: sapbridge # using a bridge
description: SAP bridge
state: up
type: linux-bridge
ipv4:
enabled: false
auto-gateway: false
auto-dns: false
bridge:
options:
stp:
enabled: false
port:
- name: ens1f0 # network IF name
- name: storage # an SRIOV device
interface: ens2f0 # network IF name
type: sriov
```

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

See `playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml` for this example:

```
---
- hosts: all
gather_facts: true
serial: 1
vars:
sap_hypervisor_node_platform: redhat_ocp_virt
tasks:
- name: Include Role
ansible.builtin.include_role:
name: sap_hypervisor_node_preconfigure
```

Example Usage
-------------
Make sure to set the `KUBECONFIG` environment variable, e.g.
```
export KUBECONFIG=~/.kubeconfig
```
To invoke the example playbook with the example configuration using your localhost as ansible host use the following command line:
```
ansible-playbook --connection=local -i localhost, playbooks/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml -e @s/sample-sap-hypervisor-redhat_ocp_virt-preconfigure.yml
```


Platform: RHEL KVM
===================
set and check the required settings and parameters for a hypervisor running VMs for SAP HANA.

Requirements
------------
Expand Down Expand Up @@ -48,18 +232,31 @@ Example Playbook

Simple example that just sets the parameters.
```
---
- hosts: all
roles:
- sap_hypervisor_node_preconfigure
gather_facts: true
serial: 1
vars:
sap_hypervisor_node_platform: redhat_rhel_kvm
tasks:
- name: Include Role
ansible.builtin.include_role:
name: sap_hypervisor_node_preconfigure
```

Run in assert mode to verify that parameters have been set.
```
---
- hosts: all
roles:
- sap_hypervisor_node_preconfigure
gather_facts: true
serial: 1
vars:
- sap_hypervisor_node_preconfigure_assert: yes
sap_hypervisor_node_platform: redhat_rhel_kvm
sap_hypervisor_node_preconfigure_assert: yes
tasks:
- name: Include Role
ansible.builtin.include_role:
name: sap_hypervisor_node_preconfigure
```
License
-------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: openshift-cnv
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: kubevirt-hyperconverged-group
namespace: openshift-cnv
spec:
targetNamespaces:
- openshift-cnv
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: hco-operatorhub
namespace: openshift-cnv
spec:
source: redhat-operators
sourceNamespace: openshift-marketplace
name: kubevirt-hyperconverged
# startingCSV: kubevirt-hyperconverged-operator.v4.10.0
# channel: "stable"
---
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
namespace: openshift-cnv
spec:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# in order to allow unsupported SRIOV nics such as Mellanox
oc patch sriovoperatorconfig default --type=merge -n openshift-sriov-network-operator --patch '{ "spec": { "enableOperatorWebhook": false } }'


Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: openshift-sriov-network-operator
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: sriov-network-operators
namespace: openshift-sriov-network-operator
spec:
targetNamespaces:
- openshift-sriov-network-operator
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: sriov-network-operator-subscription
namespace: openshift-sriov-network-operator
spec:
source: redhat-operators
sourceNamespace: openshift-marketplace
name: sriov-network-operator
# startingCSV: sriov-network-operator
channel: "stable"
Loading

0 comments on commit 3d4ae5b

Please sign in to comment.