-
Notifications
You must be signed in to change notification settings - Fork 202
K8SPXC-1734 Fix haproxy env vars conflict #2290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
commit: 9639857 |
gkech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving some small comments
| if cr.Spec.HAProxy != nil { | ||
| container.Env = append(container.Env, buildHAProxyHealthCheckEnvVars(cr.Spec.HAProxy.HealthCheck)...) | ||
| // check if the haproxy config is defined in EnvVarsSecretName, if so - it should be prioritized | ||
| // despite the fact the same env could have beren already applied above in the .EnvFrom section from the secret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beren maybe should be -> env could have already been applied
| } | ||
|
|
||
| haproxy := &HAProxy{cr: cr} | ||
| ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx can be defined outside the test loop, at the beginning of the test, or use t.Context()
| } | ||
|
|
||
| haproxy := &HAProxy{cr: cr} | ||
| ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as another comment
| } | ||
|
|
||
| proxySQL := &Proxy{cr: cr} | ||
| ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as another comment
Fix haproxy env vars conflict
Problem:
Setting
cr.Spec.HAProxy.EnvVarsSecretNamedoes not take any effectCause:
With #2207 now we always define the
HA_SERVER_OPTIONSenv var in the.envsection of the sidecar container, however there is another mechanism of defining env variables that conflicts with it - defining viacr.Spec.HAProxy.EnvVarsSecretName. In that case the env vars defined in the secret go into the.envFromsection of the sidecar container, for which:Solution:
Check if the actual secret
cr.Spec.HAProxy.EnvVarsSecretNamecontains theHA_SERVER_OPTIONSenv var and use the value preferably over the value from thecr.Spec.HAProxy.HealthCheck(wether default or explicitly set)CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability