Leverage os-conf and the pre-start-script job to make changes to the OS during VM creation.
bosh upload-release --sha1 daf34e35f1ac678ba05db3496c4226064b99b3e4 \"https://bosh.io/d/github.com/cloudfoundry/os-conf-release?v=22.2.1"bosh releases | grep os-confos-conf 22.2.1 a2154d6The pre-start script runs in parallel to os-conf and operates on the the same file /etc/idmapd.conf for kubernetes dependancies, which can cause a race condition. Adding a sleep loop to check that the file is in the correct state before appending is necessary. Make sure to include or exclude deployments and/or instance_groups based on your business requirements:
cat <<EOFA > runtime.yamlreleases: - name: "os-conf" version: "22.2.1" addons:- name: os-configuration exclude: deployments: [pivotal-container-service-<guid>] include: instance_groups: [worker] jobs: - name: pre-start-script release: os-conf properties: script: |- #!/bin/bash while ! grep -q "Mapping" /etc/idmapd.conf; do sleep 1; done; echo "Domain = my.domain.com" >> /etc/idmapd.confEOFA
bosh update-runtime-config runtime.yaml
bosh runtime-config
---addons:- exclude: deployments: - pivotal-container-service-<guid> include: instance_groups: - worker jobs: - name: pre-start-script properties: script: |- #!/bin/bash while ! grep -q "Mapping" /etc/idmapd.conf; do sleep 1; done; echo "Domain = my.domain.com" >> /etc/idmapd.conf release: os-conf name: os-configurationreleases:- name: os-conf version: 22.2.1
A cluster upgrade in required for the changes to take.
tkgi upgrade-cluster <cluster>