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 okteto.yml #7

Merged
merged 1 commit into from
Feb 2, 2021
Merged

add okteto.yml #7

merged 1 commit into from
Feb 2, 2021

Conversation

kingdonb
Copy link
Member

@kingdonb kingdonb commented Feb 2, 2021

cdk8s init typescript-app

(first: npm install -g cdk8s)

"cdk8s import k8s" generate from inside of CI, or committed in the repo?
opted to run it client-side.

tests are not comprehensive (add kubeval in a future iteration)

  • add package-lock.json - there is an error from CI about npm version
    Our upstream base image is using NodeJS 14, which is the LTS release

  • Generally do not commit synths/*.js
    (except for synths/jest.config.js, which is full of test configuration)

  • do not include compilation targets (*.js)
    Generated by npm run compile and they should not be committed in CI

  • do not save snapshots/*.test.ts.snap

I am not sure how to use snapshots as an effective test strategy that
scales, so I will not use them.

(It is better to add health checks, run kubeval before generating a
commit, this way the tool can help you avoid a production incident.)

https://openconstructfoundation.org/testing-cdk8s/
If there are tests or validation in your chosen framework (jsonnet,
cdk8s, etc.) then of course you should also run them, and be sure that
if they fail, a commit is not generated.

We run "npm run compile" and "npm run test" with set -e so the build
will fail, and script will exit without generating a commit if compile
fails, or if a test does not pass. This will prevent downstream failure
based on partial apply or inconsistent state.

So we can see a problem in our generated output thanks to test failures,
the namespace has not been mentioned in the re-hydrated yaml from cdk8s.

Let's add a test that asserts we include the namespace, and include it.

...

  • run the tests in CI
    this should stop synths commit from being generated in event that it
    failed the test (this is imperfect, but it's a useful mitigation)

  • do not use snapshots for now

  • show how to update a deploy through cdk8s synth

cdk8s init typescript-app

(first: npm install -g cdk8s)

"cdk8s import k8s" generate from inside of CI, or committed in the repo?
opted to run it client-side.

tests are not comprehensive (add kubeval in a future iteration)

* add package-lock.json - there is an error from CI about npm version
Our upstream base image is using NodeJS 14, which is the LTS release

* Generally do not commit synths/*.js
(except for synths/jest.config.js, which is full of test configuration)

* do not include compilation targets (*.js)
Generated by npm run compile and they should not be committed in CI

* do not save __snapshots__/*.test.ts.snap

I am not sure how to use snapshots as an effective test strategy that
scales, so I will not use them.

(It is better to add health checks, run kubeval before generating a
commit, this way the tool can help you avoid a production incident.)

https://openconstructfoundation.org/testing-cdk8s/
If there are tests or validation in your chosen framework (jsonnet,
cdk8s, etc.) then of course you should also run them, and be sure that
if they fail, a commit is not generated.

We run "npm run compile" and "npm run test" with set -e so the build
will fail, and script will exit without generating a commit if compile
fails, or if a test does not pass. This will prevent downstream failure
based on partial apply or inconsistent state.

So we can see a problem in our generated output thanks to test failures,
the namespace has not been mentioned in the re-hydrated yaml from cdk8s.

Let's add a test that asserts we include the namespace, and include it.

...

* run the tests in CI
this should stop synths commit from being generated in event that it
failed the test (this is imperfect, but it's a useful mitigation)

* do not use snapshots for now

* show how to update a deploy through cdk8s synth
@kingdonb kingdonb merged commit 293605b into main Feb 2, 2021
@kingdonb
Copy link
Member Author

kingdonb commented Feb 2, 2021

Resolves #2 #3 #4 #5 #6

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.

1 participant