Skip to content

Commit

Permalink
CB-24484 Fix issues with YARN and Salt 3004+
Browse files Browse the repository at this point in the history
Salt 3004+ introduced additional systemctl checks for it service module, which is not compatible with the systemctl we have on YARN images. As a workaround, these were replaced with equivalent cmd.run commands for YARN images.
Similar issue with the suggested workaround: saltstack/salt#62311 (comment)
Also had to bump Salt version to 3006.5: saltstack/salt#65114 (comment)
  • Loading branch information
Bajzathd committed Jan 19, 2024
1 parent 78514e4 commit 7f6af1a
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 9 deletions.
6 changes: 4 additions & 2 deletions saltstack/base/salt/mount/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
'googlecompute': {
'required': False,
},
'default': {
'required': False,
},
},
grain='builder_type',
default='amazon-ebs'
grain='builder_type'
)%}

{% if platform.required and pillar['OS'] == 'centos7' %}
Expand Down
5 changes: 5 additions & 0 deletions saltstack/base/salt/nginx/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ install_nginx:
- source: salt://{{ slspath }}/etc/nginx/ssl.conf

enable_nginx:
{% if pillar['subtype'] != 'Docker' %}
service.enabled:
- name: nginx
{% else %}
cmd.run:
- name: systemctl enable nginx
{% endif %}
{% if pillar['OS'] == 'centos7' %}
- require:
- pkg: install_nginx
Expand Down
7 changes: 6 additions & 1 deletion saltstack/base/salt/performance/thp.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ disable_thp_service:
{% endif %}

ensure_disable_thp_enabled:
{% if pillar['subtype'] != 'Docker' %}
service.enabled:
- name: disable-thp
- name: disable-thp
{% else %}
cmd.run:
- name: systemctl enable disable-thp
{% endif %}
2 changes: 1 addition & 1 deletion saltstack/base/salt/prerequisites/dnsmasq.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
stop_and_disable_dnsmasq:
service.dead:
- enable: False
- name: dnsmasq
- name: dnsmasq
6 changes: 6 additions & 0 deletions saltstack/base/salt/prerequisites/firewall.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{% if pillar['OS'] == 'redhat7' or pillar['OS'] == 'redhat8' %}

disable_firewalld_service:
{% if pillar['subtype'] != 'Docker' %}
service.dead:
- name: firewalld
- enable: False
{% else %}
cmd.run:
- name: systemctl disable --now firewalld
- onlyif: systemctl is-enabled firewalld
{% endif %}

{% if pillar['subtype'] != 'Docker' %}

Expand Down
2 changes: 1 addition & 1 deletion saltstack/base/salt/prerequisites/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ include:
- {{ slspath }}.sysctl
- {{ slspath }}.disable_ipv6
- {{ slspath }}.selinux
- {{ slspath }}.dnsmasq
{% endif %}
- {{ slspath }}.motd
- {{ slspath }}.ssh
- {{ slspath }}.pip
- {{ slspath }}.cert-tool
- {{ slspath }}.dnsmasq
- {{ slspath }}.user
- {{ slspath }}.firewall
- {{ slspath }}.umask
Expand Down
5 changes: 5 additions & 0 deletions saltstack/base/salt/salt-bootstrap/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ create_saltbootstrap_service_files:
- source: salt://{{ slspath }}/etc/systemd/system/salt-bootstrap.service

salt-bootstrap:
{% if pillar['subtype'] != 'Docker' %}
service.running:
- enable: True
{% else %}
cmd.run:
- name: systemctl enable salt-bootstrap
{% endif %}
- require:
- install_saltbootstrap
- create_saltbootstrap_service_files
5 changes: 5 additions & 0 deletions saltstack/hortonworks/salt/kerberos/haveged.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ install_haveged_packages:
{% endif %}

service_haveged:
{% if pillar['subtype'] != 'Docker' %}
service.enabled:
- name: haveged
{% else %}
cmd.run:
- name: systemctl enable haveged
{% endif %}
- require:
- pkg: install_haveged_packages
5 changes: 5 additions & 0 deletions saltstack/hortonworks/salt/unbound/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ unbound_service:
{% endif %}

enable_unbound:
{% if pillar['subtype'] != 'Docker' %}
service.running:
- name: unbound
- enable: True
{% else %}
cmd.run:
- name: systemctl enable --now unbound
{% endif %}
4 changes: 2 additions & 2 deletions scripts/get-salt-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ if [[ $BASE_NAME == "cb" ]]; then
COMP_RESULT=$?
# Stack version >= 7.2.18
if [[ $COMP_RESULT -lt 2 ]]; then
SALT_VERSION=3006.4
SALT_VERSION=3006.5
fi
else # base image
SALT_VERSION=3006.4
SALT_VERSION=3006.5
fi
fi

Expand Down
7 changes: 5 additions & 2 deletions scripts/salt-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ EOF
}

function apply_rhel8_salt_patch {
if [ "${OS}" == "redhat8" ] ; then
if [ "${OS}" == "redhat8" ] && [ "${SALT_VERSION}" == "3001.8" ] ; then
# https://github.com/saltstack/salt/issues/60232
if [ -f "/opt/salt_3001.8/lib/python3.6/site-packages/salt/modules/network.py" ]; then
patch -t -u /opt/salt_3001.8/lib/python3.6/site-packages/salt/modules/network.py -i /tmp/rhel8_salt_fix.patch
fi
Expand Down Expand Up @@ -65,12 +66,14 @@ function add_single_role_for_cluster_salt {
}

function add_builder_type_grain {
echo "Adding ${PACKER_BUILDER_TYPE} to the grains"
if [ -n "${PACKER_BUILDER_TYPE}" ]; then
echo "Adding ${PACKER_BUILDER_TYPE} to the grains"
cat << EOF >> /tmp/saltstack/config/minion
grains:
builder_type:
- ${PACKER_BUILDER_TYPE}
EOF
fi
}

function add_prewarmed_roles {
Expand Down

0 comments on commit 7f6af1a

Please sign in to comment.