Skip to content
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

Add latest k8s versions in testing #26729

Merged
merged 9 commits into from
Jul 7, 2021

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Jul 6, 2021

What does this PR do?

This PR adds more k8s versions for testing.

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark self-assigned this Jul 6, 2021
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 6, 2021
@ChrsMark ChrsMark added the Team:Integrations Label for the Integrations team label Jul 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 6, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 6, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-07-07T14:10:41.056+0000

  • Duration: 137 min 22 sec

  • Commit: 5547284

Test stats 🧪

Test Results
Failed 0
Passed 48617
Skipped 5266
Total 53883

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 48617
Skipped 5266
Total 53883

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark
Copy link
Member Author

ChrsMark commented Jul 6, 2021

It seems that default ports for proxy and scheduler have been changed in latest versions. We need to tune them accordingly for our test.

@ChrsMark
Copy link
Member Author

ChrsMark commented Jul 6, 2021

I wonder why the config for proxy metricset targets 10252 port at

"hosts": []string{"localhost:10252"},
, while the port should be 10249 like at .

Also we need to find a way to set the proper ports for newest versions of k8s for scheduler and controllermanger since pure http is not support anymore and we should target secure ports now (see https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/).

@jsoriano do you have any ideas on how we could check for what version we are running and set the config accordingly at

func GetSchedulerConfig(t *testing.T, metricSetName string) map[string]interface{} {
?

Signed-off-by: chrismark <chrismarkou92@gmail.com>
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsoriano do you have any ideas on how we could check for what version we are running and set the config accordingly?

More than checking for the version, we might explicitly provide it via environment variables or something, the job invoking the test knows the version, so it could set an environment variable, and then in the methods to get the config we can chose what config to use depending on the version.

Other option is to configure the services to listen always in the same ports, it is possible to customize the control plane with kubeadm, so invoking kind with something like this config might do the trick for the scheduler (not tested):

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    scheduler:
      extraArgs:
        secure-port: "0"
        port: "10251"

Or we can try to enable always the new port, I guess that by setting the secure-port flag. But maybe this doesn't work if older versions don't have this flag.

(Take into account that it is not only a port change, but also a change from HTTP to HTTPS.)

@@ -18,5 +18,5 @@ stages:
make check-no-changes;
stage: lint
k8sTest:
k8sTest: "v1.18.2,v1.17.2,v1.16.4,v1.15.7,v1.14.10"
k8sTest: "v1.20.7,v1.19.11,v1.18.2,v1.17.2,v1.16.4,v1.15.7,v1.14.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to support 1.21 too 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind version required an update to work with 1.21

@@ -18,5 +18,5 @@ stages:
make check-no-changes;
stage: lint
k8sTest:
k8sTest: "v1.18.2,v1.17.2,v1.16.4,v1.15.7,v1.14.10"
k8sTest: "v1.20.7,v1.19.11,v1.18.2,v1.17.2,v1.16.4,v1.15.7,v1.14.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can start dropping some of the old versions from the matrix? I would leave the older one we support, but we can consider removing some of the others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed 1.15 and 1.16

@jsoriano
Copy link
Member

jsoriano commented Jul 6, 2021

@jsoriano do you have any ideas on how we could check for what version we are running and set the config accordingly?

I have been trying some things and we cannot use only the old port because the scheduler pod has a healthcheck for the new one.

Good thing about this is that, if needed, we can use the token in /var/run/secrets/kubernetes.io/serviceaccount/token to query the API and get the port from the health check.

This config works to start with both ports, also in the oldest version:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    scheduler:
      extraArgs:
        bind-address: "0.0.0.0"
        port: "10251"
        secure-port: "10259"

@ChrsMark
Copy link
Member Author

ChrsMark commented Jul 7, 2021

👍🏼 @jsoriano thanks! In integrations we access the endpoint using the token too -> https://github.com/elastic/integrations/blob/master/packages/kubernetes/data_stream/scheduler/_dev/test/system/test-default-config.yml#L7.

However there we test only with latest version. I think the patch for kind will do the trick!

Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark requested a review from a team as a code owner July 7, 2021 07:58
@botelastic botelastic bot added the Team:Automation Label for the Observability productivity team label Jul 7, 2021
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@@ -29,7 +29,7 @@ import (
)

func TestFetchMetricset(t *testing.T) {
config := test.GetAPIServerConfig(t, "controllermanager")
config := test.GetControllerManagerConfig(t, "controllermanager")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark added the backport-v7.14.0 Automated backport with mergify label Jul 7, 2021
@ChrsMark ChrsMark added the backport-v7.15.0 Automated backport with mergify label Jul 7, 2021
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if it looks good to jenkins 🙂

@ChrsMark
Copy link
Member Author

ChrsMark commented Jul 7, 2021

For reference: Versions of k8s should be specified as per https://github.com/kubernetes-sigs/kind/releases/tag/v0.11.1

@ChrsMark ChrsMark merged commit 1654489 into elastic:master Jul 7, 2021
mergify bot pushed a commit that referenced this pull request Jul 7, 2021
mergify bot pushed a commit that referenced this pull request Jul 7, 2021
ChrsMark added a commit that referenced this pull request Jul 8, 2021
(cherry picked from commit 1654489)

Co-authored-by: Chris Mark <chrismarkou92@gmail.com>
ChrsMark added a commit that referenced this pull request Jul 8, 2021
(cherry picked from commit 1654489)

Co-authored-by: Chris Mark <chrismarkou92@gmail.com>
v1v added a commit to v1v/beats that referenced this pull request Jul 8, 2021
* upstream/master: (430 commits)
  CI: increase timeout (elastic#26764)
  Heartbeat: add datastream fields to synthetics (elastic#26774)
  Osquerybeat: Change the query timeout from 3 secs to 60 secs (elastic#26775)
  Remove experimental warning for inputs with variables. (elastic#26762)
  Add latest k8s versions in testing (elastic#26729)
  change type of max_bytes to ByteType (elastic#26699)
  [Elastic Agent] Fix broken enrollment command (elastic#26749)
  Update agent managed manifest to include enrolment token variable (elastic#26756)
  Filebeat: Ensure module pipelines compatibility with previous versions of Elasticsearch (elastic#26737)
  Forward port changelog for 7.13.3 (elastic#26731) to master (elastic#26754)
  Upgrade PyYAML dependency used for tests (elastic#26746)
  Add agent fleet enrolment k8s manifest (elastic#26566)
  CI: retry the step only (elastic#26736)
  Osquerybeat: Fix the configuration poll interval setting (elastic#26739)
  [Filebeat] Replace copy_from with templated value (elastic#26631)
  Reduce the verbosity of the debug log for monitoring (elastic#26583)
  Add instructions on testing metricbeat kubernetes module (elastic#26643)
  Revert "[CI] fight the flakiness with some retry option in the CI only for the Pull Requests (elastic#26617)" (elastic#26704)
  Packaging: linux/armv7 is not supported (elastic#26706)
  Cyberarkpas: Link to official docs on how to setup TLS (elastic#26614)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.14.0 Automated backport with mergify backport-v7.15.0 Automated backport with mergify Team:Automation Label for the Observability productivity team Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants