-
Notifications
You must be signed in to change notification settings - Fork 87
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
🌱E2E template parametrization #218
🌱E2E template parametrization #218
Conversation
872b3fc
to
de35a45
Compare
/cc @furkatgofurov7 |
a81256c
to
125bf96
Compare
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.
Mostly looks good, have you tested it locally? Also, we can't for now run tests in this patch since we do not have jenkins jobs + according changes in place yet.
hack/e2e/environment.sh
Outdated
export KUBERNETES_VERSION=v1.21.1 | ||
export API_ENDPOINT_HOST=192.168.111.249 | ||
export API_ENDPOINT_PORT=6443 |
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.
I think these and other vars below without quotes also should have a common format as other vars to keep consistency?
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.
Ok, I quoted all of them.
|
||
# preserve the template, to be substituted based on value defined in e2e_test.go | ||
# shellcheck disable=SC2016 | ||
export CONTROL_PLANE_MACHINE_COUNT='${CONTROL_PLANE_MACHINE_COUNT}' |
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.
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.
Hm, I can define the variable and have it substituted in envsubst. But I'm not sure why is decoupling from e2e_test.go better?
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.
Because, that way it is easier IMO to set number of controlplane and worker machines for the user rather than looking for go code.
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.
Ok, I've reverted that change. Although it means that the number given in e2e_test.go will be a bit confusing; it can be even set to a random number like 5
and the test will still pass alright.
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.
Judging by today's call adjusting it in the template is not easier than in go. Maybe let's restore the CONTROL_PLANE_MACHINE_COUNT
?
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.
Yes, let's restore it.
Yes, I did run the tests manually on my VM and they pass. |
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.
There couple of more items that needs parameterization, please go through it once again. These are the ones I spotted, you can use below names borrowed from m3-dev-env if you have not defined them yet in env.sh, otherwise you can reuse already defined ones:
#rolloutStrategy: | ||
# rollingUpdate: | ||
# maxSurge: 1 |
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.
why are these removed?
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.
To not keep commented out code around
4528697
to
ae067ab
Compare
ae067ab
to
7a0b48d
Compare
f4bd392
to
399a947
Compare
preKubeadmCommands: | ||
- netplan apply | ||
- systemctl enable --now crio kubelet | ||
- if (curl -sk --max-time 10 https://192.168.111.249:6443/healthz); then echo "keepalived already running";else systemctl start keepalived; fi | ||
- if (curl -sk --max-time 10 https://${API_ENDPOINT_HOST}:${API_ENDPOINT_PORT}/healthz); then echo "keepalived already running";else systemctl start keepalived; fi |
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.
I think this should be CLUSTER_APIENDPOINT_HOST
and CLUSTER_APIENDPOINT_PORT
to keep the same variable names as are used in the metal3-dev-env.
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.
Good catch. I changed it elsewhere in the file but not here
scripts/ci-e2e.sh
Outdated
M3_DEV_ENV_REPO="https://github.com/nordix/metal3-dev-env.git" | ||
M3_DEV_ENV_BRANCH="run-arbitrary-command-wgslr" |
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.
M3_DEV_ENV_REPO="https://github.com/nordix/metal3-dev-env.git" | |
M3_DEV_ENV_BRANCH="run-arbitrary-command-wgslr" | |
M3_DEV_ENV_REPO="https://github.com/metal3-io/metal3-dev-env.git" | |
M3_DEV_ENV_BRANCH=master |
TODO Revert the change before merging
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.
is this needed for testing with integration test ?
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.
It was needed for checking that e2e tests work. The change can be removed as soon as m3-dev-env#703 gets merged
399a947
to
895f177
Compare
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.
LGTM
895f177
to
cf44319
Compare
fb05f9d
to
2a782ab
Compare
/test-v1a5-e2e |
/test-integration |
cf61bba
to
0a8c838
Compare
/test-v1a5-e2e |
/test-integration |
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.
Overall, it looks good to me. Just leave a comment.
test/e2e/config/e2e_conf.yaml
Outdated
- sourcePath: "${PWD}/templates/test/cluster-template-prow-single-master.yaml" | ||
targetName: "cluster-template-single-master.yaml" | ||
- sourcePath: "${PWD}/templates/test/cluster-template-prow-ha.yaml" | ||
- sourcePath: "${PWD}/templates/test/cluster-template-prow-ha_envsubst.yaml" |
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.
You sure it is not cluster-template-prow-ha.yaml
?
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.
Yes. The cluster-template-prow-ha_envsubst.yaml
is generated by passing cluster-template-prow-ha.yaml
through envsubst, which is done in the e2e-substitutions
make target.
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.
I missed this part while reviewing, would taking e2e-substitutions into e2e-tests make target help with that, because otherwise we would have to have _envsubst
added for each template yaml naming where we could have multiple of them in the future
hack/e2e/environment.sh
Outdated
export CAPI_VERSION=${CAPI_VERSION:-"v1alpha4"} | ||
export CAPM3_VERSION=${CAPM3_VERSION:-"v1alpha5"} |
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.
why v1a4/v1a5? we are not there yet right? I think we can keep both CAPI_VERSION
and CAPM3_VERSION
set to v1a3
&& v1a4
accordingly for now, and we will update it as part of #167
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.
When running in the CI it's overridden by env vars, which are already set to v1alpha4/alpha5. But I can stick to the old values as the defaults for manual runs.
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.
Yes, the point is as of now we do not have a working CAPM3 v1a5 with CAPI v1a4 yet, the vars can be set to anything, it just to avoid confusion for users thinking they are running e2e with latest CAPI.
@@ -1,397 +0,0 @@ | |||
apiVersion: cluster.x-k8s.io/v1alpha3 |
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.
To clarify, we can live without this file and control number of ctpl/workers from the go code itself using the vars from environment.sh?
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.
To clarify, we can live without this file and control number of ctpl/workers from the go code itself using the vars from environment.sh?
Have the same concern. It would be nice if we can have that
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.
Yes. We can control the number of ctpl and workers using ControlPlaneMachineCount and WorkerMachineCount fields in ConfigClusterInput
in the go code. No need to modify environment.sh either, except for setting NUM_NODES high enough to accomodate all the machines.
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.
This is certainly an improvement over having everything hard-coded. But I'm wondering if it would make sense to use go templates instead of envsubst in the long run?
Environment variables are probably fine as long as we just want them set to one value for all tests. However, I guess we may want to set different values for different e2e tests and still run them all as part of one test suite. For example, we may want to create a HA cluster in one test and a single machine cluster in another. With go templates it would be very natural to define these parameters in the test itself instead of setting them through environment variables.
What do you think?
This particular example - differentiating node numbers - is already achievable by chaning values in the go code. But I see your point; if we reach a use case that demands more customization of the templates it may be necessary to move to a templating solution. Do you have some particular templating mechanism in mind? For reference, AWS provider uses kustomize |
0a8c838
to
c7be3ca
Compare
Interesting! Then for AWS it would still require changes outside of the go code to modify the flavors. 🤔 |
/test-v1a5-e2e |
LGTM |
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.
Last thing to clarify before we move on with this one:
Makefile
Outdated
.PHONY: e2e-substitutions | ||
e2e-substitutions: $(ENVSUBST) | ||
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) | ||
$(ENVSUBST) < $(E2E_TEMPLATE_FILE) > $(E2E_TEMPLATE_FILE_ENVSUBST) |
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.
do we really need a separate make target for env substitution? previously we had it within the e2e-tests target is not it?
test/e2e/config/e2e_conf.yaml
Outdated
- sourcePath: "${PWD}/templates/test/cluster-template-prow-single-master.yaml" | ||
targetName: "cluster-template-single-master.yaml" | ||
- sourcePath: "${PWD}/templates/test/cluster-template-prow-ha.yaml" | ||
- sourcePath: "${PWD}/templates/test/cluster-template-prow-ha_envsubst.yaml" |
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.
I missed this part while reviewing, would taking e2e-substitutions into e2e-tests make target help with that, because otherwise we would have to have _envsubst
added for each template yaml naming where we could have multiple of them in the future
/test-v1a5-e2e |
3593b2b
to
0cab4fa
Compare
/test-v1a5-e2e |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: furkatgofurov7, lentzi90, namnx228 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
0cab4fa
to
0e706fe
Compare
/test-v1a5-e2e |
/lgtm |
What this PR does / why we need it:
This PR replaces hardcoded values in e2e testing template with env variable substitution.