-
Notifications
You must be signed in to change notification settings - Fork 155
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
Kubernetes e2e tests #4984
Comments
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
I would really like to see the integration tests for kubernetes work similar to how the integration testing framwork for running on different hosts. Example tests would be something like:
Then running |
I like driving this with the integration test framework for consistency. I don't think we need to start with using a remote cluster in GKE. We could, but we could also start with a Kind cluster running on the local machine if that is simpler to implement. It will certainly be faster to iterate on locally, and we'll be building that anyway as the anolgue of the multipass runner. |
@cmacknz Agree that starting local is easier and should be the first step. Extending to external k8s would be great for better coverage, which I think we would want to do once we have the local one working. |
@blakerouse @cmacknz thanks for the proposals. After looking at the mage-related code, I have the following points for further dicsussion:
some visual aid of what I have in mind flowchart TB
dockerPackage[build agent docker package]
provisionCluster["provision k8s cluster [initially only kind, requires K8S_VERSION env var]"]
exportEnvVarsK8S[export env vars for kubernetes]
provisionStack[provision stack]
exportEnvVars[export env vars for stack]
invokeTest["invoke go kubernetes integration tests [separate package testing/kubernetes]"]
innerTest["define.Require(...)"]
subgraph mage["mage integration:kubernetes"]
dockerPackage --> provisionCluster --> exportEnvVarsK8S --> provisionStack --> exportEnvVars --> invokeTest
end
subgraph test["Individual Kubernetes Test"]
invokeTest -.-> innerTest --> kube["client := info.KubeClient()"] --> dots["..."]
end
buildkite[buildkite VM] --> dockerPackage
|
How are developers going to perform the tests locally from there developer machines if it requires only buildkite to work? That does not provide a way for developers to easily inspect, interact, and debug an issue if it can only be done in CI. Totally possible to have a buildkite provisioner in the integration testing framework that relies on information from buildkite or performs actions to buildkite. The system must be designed in a way that ensures that developers can do the following above. A
Would want to support both. |
probably I am missing something but sorry I don't follow. As far as my understanding goes a dev that wants to test this locally would have docker installed and kind based on their operating system and they will be able to run, as an example, something like this |
Having elastic-agent/.buildkite/pipeline.yml Lines 180 to 200 in b4af28b
elastic-agent/.buildkite/scripts/steps/k8s-tests.sh Lines 4 to 8 in b4af28b
Given you have The next piece is provisioning the stack for the agent to interact with. This could be left completely unchanged, and the agent in the kind cluster could be enrolled with a real stateful or serverless deployment as everything else does. Having a kind cluster available does give us to the option to put the entire stack in the kind cluster as well. This would be quite convenient for local testing as it would have no remote dependencies at all, but it may be faster to start with using the existing stack provisions and add this as a follow up. |
Essentially, this would lead us to replacing everything from this point onward in the existing k8s-tests.sh script with just elastic-agent/.buildkite/scripts/steps/k8s-tests.sh Lines 8 to 30 in b4af28b
|
Needing |
@cmacknz @blakerouse we should also piggy back on @pkoutsovasilis' PR once merged in order to run OTel Collector test on Kubernetes too. |
After this PR the need to have container-based e2e tests became apparent. The first thing that comes to mind are the existing k8s-tests defined here. After syncing with @cmacknz and @blakerouse, in the context of the aforementioned PR, I took a deeper look on what these tests are testing. Here are my findings:
The kind cluster is provisioned with Crashing pods (tested with kind v0.20.0 and k8s v1.29.0)
and the reason behind this is
Error: unknown flag: --port
defined here. As a result, no new pods are gonna get scheduledThe tests create the generated k8s manifest from kustomize templates with
kubectl create ...
. This is essentially a yaml spec validation and it is not failing as thekube-apiserver-kind-control-plane
isRunning
Even if the pods were getting scheduled, the agent container image version "injected" in the k8s manifest is not the one build from sources of a commit but it derives from here.
The text was updated successfully, but these errors were encountered: