-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Errors adding environment variables and mounting secret volumes to services #793
Comments
I thought it is covered by tests, isn't it? Too busy recently. Not sure if I can find some free time to check details. @andrewbelu could you try adding a test case to fail this case? |
Thank you @andrewbelu . We may reproduce it with the tests.
Let's see if there is a way to fix it. Do you already have some proposals? |
A simple test of strategicMergePatch does work as expected. See https://github.com/yujunz/temporal-operator/tree/issues-793 |
The workaround is to set But still not clear about the root case. We may need to dig the code of strategic merge. |
Print some debug info.
Need further look into the options
|
@alexandrevilain , I think the root cause is the one mentioned by @andrewbelu above. While there can be a more graceful fix by patching What do you think we add a similar workaround in examples? |
I don't believe the workaround works. If you swap the null on the secret and the configMap like so:
It gives:
Before the resource is even created by Kubernetes, so probably at some validation step after the StrategicPatchMerge step. |
I did test this case and it looks ok in unit test.
@andrewbelu Are you encountering it in e2e tests? Could you try reproducing it with unit tests so we can narrow down the possible root case? |
Yes, this is actually trying to apply the resource to a running cluster. I believe the unit test only tests that the StrategicPatchMerge works as expected. It doesn't actually validate the Kubernetes resource by adding it to a Kubernetes cluster. This would seem to be more like an E2E or integration test required (I don't think the scope of a unit test would cover this). I can take a look at adding the E2E test over the weekend. |
does anyone happen to know if this issue persists in latest release? #760 |
Hi @TheHiddenLayer nothing has been merged to fix this for now. |
Added a pull request to add functionality for JSON patching, which should provide override functionality in YAML arrays. |
The override examples don't seem to be working for me.
With the latest operator code, applying an environment variable override (to add an environment variable as per https://temporal-operator.pages.dev/features/overrides/#example-add-an-environment-variable-to-the-worker-pod
causes the following error:
Additionally, adding an additional volume causes an error as well (taken from https://temporal-operator.pages.dev/features/overrides/#example-mount-an-extra-volume-to-the-frontend-pod)
results in the following error in starting the pod:
I think this is due to some of the limitations to StrategicMergePatch with the default object, where the override replaces the existing object at index 0 with something that conflicts on a key, so there may be other fields where the same limitations applies. For example, env can have either the
value
field or thevalueFrom
field. When the operator does the StrategicMergePatch call, the result has avalue
field in index 0 where there was previously avalueFrom
field. When kubernetes tries to apply this, it fails, probably similar to the issue in: kubernetes-sigs/kustomize#2734 (comment). The volumes is similar story, it is an array with objects that cannot have bothconfigMap
andsecret
set, so when the first index is overridden with another type it causes this issue.The text was updated successfully, but these errors were encountered: