Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions hooks/playbooks/reduce_cluster_logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Reduce cluster logging to minimum
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
tasks:
- name: Get all MachineConfigPools
kubernetes.core.k8s_info:
api_version: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
register: _mcp_list

- name: Apply KubeletConfig per MachineConfigPool
vars:
_pool_labels: >-
{{ {'pools.operator.machineconfiguration.openshift.io/' + item: ''} }}
kubernetes.core.k8s:
state: present
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
name: "reduce-container-logs-{{ item }}"
spec:
machineConfigPoolSelector:
matchLabels: "{{ _pool_labels }}"
kubeletConfig:
containerLogMaxSize: "1Mi"
containerLogMaxFiles: 2
loop: >-
{{ _mcp_list.resources | map(attribute='metadata.name') | list }}

- name: Apply ContainerRuntimeConfig per MachineConfigPool
vars:
_pool_labels: >-
{{ {'pools.operator.machineconfiguration.openshift.io/' + item: ''} }}
kubernetes.core.k8s:
state: present
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: ContainerRuntimeConfig
metadata:
name: "reduce-crio-logs-{{ item }}"
spec:
machineConfigPoolSelector:
matchLabels: "{{ _pool_labels }}"
containerRuntimeConfig:
logLevel: "error"
logSizeMax: "1Mi"
loop: >-
{{ _mcp_list.resources | map(attribute='metadata.name') | list }}

- name: Wait for MachineConfigPool rollouts to complete
when: cifmw_reduce_cluster_logging_wait | default(true) | bool
ansible.builtin.command:
cmd: >-
oc wait mcp --all
--for=condition=Updated
--timeout=3600s
changed_when: false
4 changes: 2 additions & 2 deletions roles/reproducer/tasks/ocp_layout_assertions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
- _cifmw_libvirt_manager_layout.vms.ocp_worker is defined
vars:
_element: "{{ _cifmw_libvirt_manager_layout.vms.ocp_worker | default({}) }}"
_memory: 16
_memory: 8
_cpus: 10
_disk: 50
ansible.builtin.assert:
Expand All @@ -78,7 +78,7 @@
- _element.disksize | int > _disk
quiet: true
msg: >-
Ensure you provide enough memory (>=16), cpus (>=10) and
Ensure you provide enough memory (>=8), cpus (>=10) and
disksize (>50) to ocp_worker nodes, and uefi is set to true
in cifmw_libvirt_manager.vms.ocp_worker

Expand Down
Loading