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

Custom pause image for Pod Failure Chaos #1981

Merged
merged 3 commits into from
Jun 17, 2021

Conversation

aido123
Copy link
Contributor

@aido123 aido123 commented Jun 16, 2021

What problem does this PR solve?

Issue Number: close #1925

Problem Summary:

What is changed and how it works?

Proposal: This PR allows users to specify a pod failure pause image via helm values. This is useful for for organizations who can only pull images from internal registries and also where organizations have policy applied where images can only come from xyz.com

What's Changed:

  • Added a new environmental variable (controller deployment) for the pause image to the chaos controller
  • Add this new environment variable to the controller config. Defaults to gcr.io pause image
  • Add this controller config to the pod failure impl and set the pause image from this config

Tests

  • Unit test
  • E2E test
  • Manual test (add detailed scripts or steps below)
  • No code

Manual Tests

Test 1

  • Config Controller Mesh Deployment env to
          - name: POD_FAILURE_PAUSE_IMAGE
            value: test.io/google-containers/pause:latest
  • Install chaos mesh on kind with helm
./hack/local-up-chaos-mesh.sh
./install.sh --local kind --dependency-only
  • Install sample nginx deployment
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
  • Install Pod Failure
apiVersion: chaos-mesh.org/v1alpha1
kind: PodChaos
metadata:
  name: pod-failure-example
spec:
  action: pod-failure
  mode: one
  value: ''
  selector:
    labelSelectors:
      'app': 'nginx'
  • Get pod yaml and check if image is updated "test.io/google-containers/pause:latest"
  • Delete pod failure chaos and get image and reverted back to original docker.io/library/nginx:1.14.2

Test 2

  • Repeat Test 1, but revert install.sh POD_FAILURE_PAUSE_IMAGE back to the default gcr.io pause container. Get pod yaml of nginx pod and image should be updated to "gcr.io/google-containers/pause:latest". Delete pod failure chaos and get image and reverted back to original docker.io/library/nginx:1.14.2
          - name: POD_FAILURE_PAUSE_IMAGE
            value: gcr.io/google-containers/pause:latest

…ge via helm values

Signed-off-by: aido123 <adrianhynes@gmail.com>
Signed-off-by: aido123 <adrianhynes@gmail.com>
@aido123 aido123 changed the title Custompauseimage Custom pause image for Pod Failure Chaos Jun 16, 2021
Copy link
Member

@STRRL STRRL left a comment

Choose a reason for hiding this comment

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

LGTM!

@codecov-commenter
Copy link

Codecov Report

Merging #1981 (b788b9f) into master (7e9ff3f) will decrease coverage by 22.21%.
The diff coverage is 39.48%.

❗ Current head b788b9f differs from pull request most recent head b0f49d4. Consider uploading reports for the commit b0f49d4 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1981       +/-   ##
===========================================
- Coverage   55.78%   33.57%   -22.22%     
===========================================
  Files          68      121       +53     
  Lines        4383     7283     +2900     
===========================================
  Hits         2445     2445               
- Misses       1768     4629     +2861     
- Partials      170      209       +39     
Impacted Files Coverage Δ
api/v1alpha1/awschaos_types.go 0.00% <0.00%> (ø)
api/v1alpha1/dnschaos_type.go 0.00% <0.00%> (ø)
api/v1alpha1/dnschaos_webhook.go 0.00% <0.00%> (ø)
api/v1alpha1/gcpchaos_types.go 0.00% <0.00%> (ø)
api/v1alpha1/httpchaos_types.go 0.00% <0.00%> (ø)
api/v1alpha1/httpchaos_webhook.go 0.00% <0.00%> (ø)
api/v1alpha1/iochaos_types.go 0.00% <0.00%> (-40.00%) ⬇️
api/v1alpha1/jvmchaos_webhook.go 0.00% <0.00%> (ø)
api/v1alpha1/kernelchaos_types.go 0.00% <0.00%> (-20.00%) ⬇️
api/v1alpha1/kinds.go 25.00% <0.00%> (-1.67%) ⬇️
... and 190 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 c8be4ad...b0f49d4. Read the comment docs.

Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • STRRL
  • cwen0

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@cwen0
Copy link
Member

cwen0 commented Jun 17, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: b0f49d4

@ti-chi-bot
Copy link
Member

@aido123: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit d4a3484 into chaos-mesh:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pause container in Pod Failure from Private Registry
5 participants