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

[test-framework] Improve Kubernetes and Mixer support. #8912

Merged
merged 4 commits into from
Sep 25, 2018
Merged

[test-framework] Improve Kubernetes and Mixer support. #8912

merged 4 commits into from
Sep 25, 2018

Conversation

ozevren
Copy link
Contributor

@ozevren ozevren commented Sep 22, 2018

  • Changed istio-system command-line flag and calculation behavior, so that the default system namespace is "istio-system" when nothing is specified. As we make more progress on being able to deploy dynamically to non-"istio-system" namespaces, we can change the behavior.
  • Added generic DumpState support to environment interface, to allow dumping of state of later investigation. This should be particularly useful in CI environments.
  • Sprinkled calls to DumpState everywhere. Ideally we should have a centralized way to do this. Unfortunately, I haven't figured out a clean way
    to do this holistically yet.
  • Improved Pod Data dump to include both the pod logs, as well as the current snapshot of the Pod resource in Yaml format. Both get dumped to the work directory, in case of failures.
  • Fine-tuned and normalized retry timing characteristics for all Kubernetes operations.
  • Added logic to extract attribute manifest directly from the Helm charts. The attribute manifest needs to be injected during local environment runs, but is not needed in the Kubernetes environment. This approach allows us to have identical configuration for Mixer that can be used in both Local and Kubernetes environments.
  • Added a retry logic to Mixer bypass adapter's connectivity logic to help issues with initial connectivity after config push.
  • Introduced framework/repository as a place for common constants for Istio source repository.
  • Removed the logic that deletes collected reports from the PolicyBackend fake, to reduce state management that needs to be done in the TestFramework.
  • Updated PolicyBackend's APIs to do a subset query of reports, instead of exact match. This is needed, as unrelated telemetry is also collected (i.e. Mixer's own telemetry) during testing.
  • Added retry logic in a few places in the Kubernetes code to deal with eventual consistency.
  • Added template expansion support to Mixer instances.
  • Fixed the issue with PolicyBackend deployment in CircleCI environment (ImagePullPolicy Always => IfNotPresent)
  • Fixed basic Mixer tests to work in both environments.

@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Sep 22, 2018
@ozevren ozevren removed the request for review from geeknoid September 22, 2018 01:17
@codecov
Copy link

codecov bot commented Sep 23, 2018

Codecov Report

Merging #8912 into master will decrease coverage by 1%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #8912    +/-   ##
=======================================
- Coverage      70%     70%   -<1%     
=======================================
  Files         416     416            
  Lines       37604   37921   +317     
=======================================
+ Hits        26098   26306   +208     
- Misses      10314   10417   +103     
- Partials     1192    1198     +6
Impacted Files Coverage Δ
mixer/adapter/bypass/bypass.go 65% <100%> (+3%) ⬆️
mixer/adapter/servicecontrol/handler.go 38% <0%> (-16%) ⬇️
mixer/adapter/solarwinds/log_handler.go 58% <0%> (-11%) ⬇️
...ilot/pkg/networking/core/v1alpha3/networkfilter.go 34% <0%> (-9%) ⬇️
mixer/adapter/signalfx/tracing.go 80% <0%> (-2%) ⬇️
mixer/adapter/servicecontrol/utils.go 88% <0%> (-1%) ⬇️
galley/pkg/kube/source/listener.go 96% <0%> (ø) ⬇️
pilot/pkg/networking/core/v1alpha3/listener.go 75% <0%> (ø) ⬇️
mixer/template/template.gen.go 0% <0%> (ø) ⬆️
mixer/pkg/attribute/mutableBag.go 100% <0%> (ø) ⬆️
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90ea574...929f4fb. Read the comment docs.

@smg223
Copy link

smg223 commented Sep 23, 2018 via email

+ Changed istio-system command-line flag and calculation behavior, so that the default system namespace is "istio-system" when nothing is specified. As we make more progress on being able to deploy dynamically to non-"istio-system" namespaces, we can change the behavior.
+ Added generic DumpState support to environment interface, to allow dumping of state of later investigation. This should be particularly useful in CI environments.
+ Sprinkled calls to DumpState everywhere. Ideally we should have a centralized way to do this. Unfortunately, I haven't figured out a clean way
to do this holistically yet.
+ Improved Pod Data dump to include both the pod logs, as well as the current snapshot of the Pod resource in Yaml format. Both get dumped to the work directory, in case of failures.
+ Fine-tuned and normalized retry timing characteristics for all Kubernetes operations.
+ Added logic to extract attribute manifest directly from the Helm charts. The attribute manifest needs to be injected during local environment runs, but is not needed in the Kubernetes environment. This approach allows us to have identical configuration for Mixer that can be used in both Local and Kubernetes environments.
+ Added a retry logic to Mixer bypass adapter's connectivity logic to help issues with initial connectivity after config push.
+ Introduced framework/repository as a place for common constants for Istio source repository.
+ Removed the logic that deletes collected reports from the PolicyBackend fake, to reduce state management that needs to be done in the TestFramework.
+ Updated PolicyBackend's APIs to do a subset query of reports, instead of exact match. This is needed, as unrelated telemetry is also collected (i.e. Mixer's own telemetry) during testing.
+ Added retry logic in a few places in the Kubernetes code to deal with eventual consistency.
+ Added template expansion support to Mixer instances.
+ Fixed the issue with PolicyBackend deployment in CircleCI environment (ImagePullPolicy Always => IfNotPresent)
+ Fixed basic Mixer tests to work in both environments.
@ozevren ozevren changed the title WIP: [test-framework] Cleanup of the Kubernetes environment and Mixer component. [test-framework] Improve Kubernetes and Mixer support. Sep 24, 2018
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Sep 24, 2018
mixer/adapter/bypass/bypass.go Outdated Show resolved Hide resolved
pkg/test/framework/components/mixer/attrmanifest.go Outdated Show resolved Hide resolved
pkg/test/framework/components/mixer/attrmanifest.go Outdated Show resolved Hide resolved
image: {{.Hub}}/test_policybackend:{{.Tag}}
imagePullPolicy: {{.ImagePullPolicy}}
image: "{{.Hub}}/test_policybackend:{{.Tag}}"
imagePullPolicy: IfNotPresent
Copy link
Contributor

Choose a reason for hiding this comment

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

Why hard-coding? For the test framework, I would think we would want Always by defaultt to ensure we're always using the latest image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This causes problems in CircleCI (Hence the change to IfNotPresent). I had it as Always for precisely the same reason as you mentioned.

We currently do not have a "CI" flag. Perhaps we can add something like that, to alter behavior.

@@ -110,6 +110,9 @@ type (
Implementation interface {
// EnvironmentID is the unique ID of the implemented environment.
EnvironmentID() settings.EnvironmentID

// Evaluate the given template with environment specific template variables.
Evaluate(tmpl string) (string, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note: I suspect we'll have to think a bit about this ... we need a different approach here going forward. The tests shouldn't have environment-specific things in them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is somewhat inevitable at this point. For example, we have intrinsic tie to the namespaces. Things like test/deployment/system namespace will frequently be referenced from tests.


// Package repository have utility methods related to accessing a local istio code repository. The repository
// path is deduced from ${GOPATH} environment variable.
package repository
Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems somewhat redundant with https://github.com/istio/istio/blob/master/pkg/test/env/istio.go.

I suggest adding the helm-specific variables there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I aligned the packages, but would it make more sense to try to deduce things from $GO_PATH? or from $ISTIO (given that it is specified in our dev guide). I am not sure where TOP, or other ISTIO_* environment variables get defined.

@@ -60,6 +62,7 @@ type PodSelectOptions struct {
}

func (f *defaultPortForwarder) Start() error {
scopes.Framework.Debugf("starting port forwarder")
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was helpful when debugging an issue. :)

Copy link
Contributor

@nmittler nmittler left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@istio-testing istio-testing added lgtm and removed lgtm labels Sep 24, 2018
@nmittler
Copy link
Contributor

/lgtm
/approve

@geeknoid
Copy link
Contributor

/lgtm
/approve

Mixer parts look good.

@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: geeknoid, nmittler

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ozevren
Copy link
Contributor Author

ozevren commented Sep 25, 2018

/test e2e-mixer-no_auth

@istio-testing istio-testing merged commit 99294e3 into istio:master Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants