cloudfoundry / haproxy-boshrelease

A BOSH release for haproxy (based on cf-release's haproxy job)
Apache License 2.0
37 stars 81 forks source link

keepalived add job config for global_defs #543

Open akop opened 11 months ago

akop commented 11 months ago

We had the requirement to tweak keepalived global_defs but there is no option to change it with the job config. Would be great to have such an option.

For now we've created an ops file as quick fix.

Perhaps this is helping someone:

- type: replace
  path: /instance_groups/name=haproxy/jobs/-
  value:
    name: pre-start-script
    properties:
      script: |-
                #!/bin/bash
                KEEPALIVED_CONF_TEMPLATE='/var/vcap/jobs/keepalived/config/keepalived.config.template'
                SEARCH_STRING='lvs_id haproxy'
                REPLACE_STRING='lvs_id haproxy
                        max_auto_priority -1
                        vrrp_garp_master_repeat 5
                        vrrp_garp_interval 1
                        vrrp_garp_lower_prio_repeat 1
                        vrrp_garp_master_refresh 300
                        vrrp_garp_master_refresh_repeat 1
                        vrrp_higher_prio_send_advert true'

                cp $KEEPALIVED_CONF_TEMPLATE $KEEPALIVED_CONF_TEMPLATE.pre-pre-start-script
                sed -i "s|${SEARCH_STRING}|${REPLACE_STRING//$'\n'/\\n}|" $KEEPALIVED_CONF_TEMPLATE
    release: os-conf

- type: replace
  path: /releases/name=os-conf?
  value:
    name: os-conf
    version: latest # take just the one which is defined in runtime-config
maxmoehl commented 11 months ago

We are open for contributions! If you'd like to expose new properties via the job config feel free to submit a PR and we can discuss the details. If you prefer, you can first outline your proposed changes in this issue to discuss them beforehand.