Commit Graph

14 Commits

Author SHA1 Message Date
Chris Wedgwood 14febda1e3 [haproxy] anchor; make sure configuration is flushed before rename
The pattern:

  create, write, close, rename

is *not* robust in many circumstances.  The data blocks from the write
are not always flushed/persisted before the rename (metadata) changes
meaning you can end up where the replacement file is corrupted
(usually has 0 bytes at the end).

Change-Id: Icdd2bb6f20330e5e94b3081f0d0b8a74417f60d4
2020-06-23 13:26:37 -05:00
Matt McEuen 77bfeb11ea haproxy: remove echo from anchor script
This removes an echo from the haproxy anchor, and renders
the related IDENTIFIER variable value directly inline instead.
The echo approach fails under some condition related to host
reboots, resulting in faulty input data for the script and
bad output haproxy configs, with e.g. "frontend -fe".

Change-Id: Id4e258b04290a8ce96b8b518a9c541ecedeee39e
2020-02-17 17:37:05 -06:00
Matt McEuen 1d0a4619b4 Add -u to anchor scripts
This adds "set -u" (in addition to the existing -x) to the anchor
scripts. This should fix an issue seen occasionally in the haproxy
chart which is only explainable by the IDENTIFIER variable failing
to get set correctly.

All variables used in the anchor scripts ought to be defined, and
there's no need to rely on blank strings as defaults.

"set -e" was considered for this, but may have unintended side-effects:
-u should be safe and avoid the issue we've seen.

Change-Id: Idbc2f9f77d4754874999d5d83d322a17076c7392
2020-02-03 14:00:12 -06:00
Phil Sphicas 02fc5342b2 (haproxy) Fix anchor.sh template
Fix syntax error in anchor.sh template.

/tmp/bin/anchor.sh: line 34: [: missing `]'
/tmp/bin/anchor.sh: line 54: [: missing `]'

Change-Id: I431fea6e9e805099de605b34b50a7cf5fae73be2
2019-11-04 11:42:01 -08:00
Scott Hussey 97f7ed6db7 (haproxy) String validation for haproxy config
- Add validation in the anchor that backend IP addresses
  and ports sourced from Kubernetes are valid looking strings.

Change-Id: I7539b633dc49efd7262a22c6f9ff040880d9724f
2019-09-22 04:12:22 -05:00
Scott Hussey 479d3cc402 (haproxy) Additional config safeguards
- Some reported cases that the haproxy config was corrupted during
  node reboots. Attempt to add additional safeguards of coordination
  between the anchor and the service pod.

- Support nulling out a default entry in the service list

- Add additional log statements in the anchor

Change-Id: Ie673c50e1037d5dff2b9f67b14032e188183a5d9
2019-09-13 08:31:43 -05:00
BARTRA, RICK 19169bb458 Run haproxy pod with the nobody user (65534)
To be able to run with the nobody user, an init container
is used in the haproxy-anchor pod to change the ownership and
permissions of '/host/etc/promenade/haproxy'. Security conext
was included in 'etc/kubernetes/manifests/haproxy.yaml' and
'promenade/schemas/Genesis.yaml' schema was updated to included
run_as_user property for haproxy pod.

Change-Id: Id248face0be43c417284ceb781997634a9c4dd5e
2019-09-11 16:18:30 -05:00
Hussey, Scott (sh8121) 41e21e1a6e (haproxy) Add rationality check to config
- When the anchor provides a new haproxy config file
  to the running haproxy, add a reasonable check that
  the new config is valid:
    - Is it a valid config file per haproxy
    - Does it contain the expected number of frontends

- Update helm version for linting to 2.14.1

Change-Id: I7a49deb372831c44f05c7baa870735c515519cb2
2019-06-10 11:01:13 -05:00
Mark Burnett eb00a0ddef Fix incorrect templating in haproxy anchor script
Change-Id: Ia21f90f0e59fc85cdaf7366a22973a089927c6c5
2018-11-19 14:36:30 -06:00
Zuul ee881f8970 Merge "Secure host file permissions" 2018-10-25 18:43:27 +00:00
Michael Beaver 8b45a36419 Secure host file permissions
* added in missing recursive flag to the chmod command used to remove
extraneous permissions from CURATED_DIRS
* added commands to change permissions for manifests and configurations
that are copied to the host

Change-Id: I174db09061c3162db11dd976a55132f5fad7a80d
2018-10-19 13:50:18 -05:00
Andrey Volkov b26c2cfeff Make haproxy-anchor cleanup optional
Continuation of Ia1449d188c15b71dd756e96b1ea2d4a672011a17.

This patch creates the additional var "conf.anchor.enable_cleanup"
that is true by default. False value will effectively
disable cleanup procedure.

Change-Id: I7f74454190dcd1d563d6cb3c9fef8504a3e0806a
2018-10-05 07:33:47 -07:00
Andrey Volkov 44a0c200f2 Make haproxy-anchor cleanup more cautious
There was a bug related to missing haproxy config files:
/etc/promenade/haproxy/haproxy.cfg
/etc/kubernetes/manifests/haproxy.yaml

Those files are initially generated with static pods and
after that it periodically updated by haproxy-anchor.
Most plausible reason why it could be missed is haproxy-anchor cleaned
it up while terminating. To solve the issue there were restored manually.

This patch tries to make such a situation clearer by two things:
1) it leaves a message in a cleanup file that haproxy-anchor was
terminated and the cleaup happened.
2) instead of removing files it moves them to backup dir from that
they could be restored easily.

Change-Id: Ia1449d188c15b71dd756e96b1ea2d4a672011a17
2018-09-24 09:15:36 -07:00
Mark Burnett ff3787c2ad Use HAProxy for apiserver discovery
This removes the reliance on coredns for APIserver discovery, allowing
a simpler configuration that is compatible with corednx 1.0.x

Change-Id: Ia3b7b5627c16ec47af6b0d6d5e8dee2674e9b1ee
2018-02-08 14:30:35 -06:00