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

docs: add k8s Deploy action example with shared manifests #4992

Merged
merged 3 commits into from
Sep 3, 2023

Conversation

eysi09
Copy link
Collaborator

@eysi09 eysi09 commented Aug 29, 2023

What this PR does / why we need it:

From the commit message:

This commit adds an example that uses the kubernetes deploy action and shares the same manifests between a couple of actions. This is achieved by using Garden template strings in the manifests.

The example is a three tier web app version of the vote example with "web", "API", and "DB" components that I think we should consider using by default.

It's not as complex as the main vote example which tends to draw attention away from the functionality being demonstrated, and not as trivial as the basic "demo-project".

Three tier web apps are also a common pattern that a lot of people will be familiar with.

And lastly, this is also the same example we use in the "How Garden Works" video series so it will become familiar to users eventually.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Added this example following the conversation here: #4729

We'll also be adding actual docs on the topic, this example is just the first step and can be used as a reference in those docs.

@eysi09 eysi09 marked this pull request as draft August 29, 2023 02:13
@eysi09 eysi09 force-pushed the k8s-deploy-action-examples branch 2 times, most recently from 82a08bc to 53cf3ab Compare August 29, 2023 03:58
@eysi09 eysi09 marked this pull request as ready for review August 29, 2023 03:58
@worldofgeese
Copy link
Contributor

I have now tested this locally to confirm everything runs and is accessible.

I see this as part of a larger initiative to directly address needs in our docs. Currently we suggest the container module for a simplified abstract for users. I think there's a space in our docs for positioning this Config Templates example and a Helm library chart example as methods to provide helpful abstractions to downstream (of the Platform Team) consumers.

E.g. a docs page, even a Seed, that walks users through generating shared manifests. This could even be turned into a native garden command such as, garden generate configtemplates similar to helm create.

Your PR mentions,

  • Actions cannot reference files in parent directories. That's why we "hoist" the Garden config for the web and API components to the root (where the manifests reside) and name the config files api.garden.yml and web.garden.yml.
  • You can also set non primitive values like maps and arrays by
    using the jsonEncode templating function.

Your first bullet sounds like something we should support in garden natively. Do we have a feature request for it? Or any reason why we wouldn't want to implement a feature like this?

For your jsonEncode example, could you expand on this with a post-transform example? So users can directly see.

Copy link
Contributor

@worldofgeese worldofgeese left a comment

Choose a reason for hiding this comment

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

See comment above 👀

@eysi09
Copy link
Collaborator Author

eysi09 commented Sep 1, 2023

I see this as part of a larger initiative to directly address needs in our docs

Absolutely, it is. I just started with the examples because they had been requested. But the overall goal is to update the docs and reference the examples from there.

Your first bullet sounds like something we should support in garden natively. Do we have a feature request for it? Or any reason why we wouldn't want to implement a feature like this?

Yes, we do but they're stale. My plan was to open a new one with up to date context.

I feel quite strongly that we should support this. The current workaround is to hoist everything to the top which is not nice.

For your jsonEncode example, could you expand on this with a post-transform example? So users can directly see.

Will do.

@eysi09 eysi09 force-pushed the k8s-deploy-action-examples branch 2 times, most recently from 57e86c5 to 93f0f96 Compare September 2, 2023 23:42
@eysi09
Copy link
Collaborator Author

eysi09 commented Sep 2, 2023

@worldofgeese, I added a new commit addressing your comments.

This commit adds an example that uses the `kubernetes` deploy action
and shares the same manifests between a couple of actions. This is
achieved by using Garden template strings in the manifests.

The example is a three tier web app version of the vote example
with "web", "API", and "DB" components that I think we
should consider using by default.

It's not as complex as the main vote example which tends to draw
attention away from the functionality being demonstrated, and not as
trivial as the basic "demo-project".

Three tier web apps are also a common pattern that a lot of people will
be familiar with.

And lastly, this is also the same example we use in the "How Garden
Works" video series so it will become familiar to users eventually.
worldofgeese
worldofgeese previously approved these changes Sep 3, 2023
Copy link
Contributor

@worldofgeese worldofgeese left a comment

Choose a reason for hiding this comment

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

Looks good to me! 🥇

Instead of hoisting the Garden config to the root, we leave it in the
service directories and overwrite the source path.
Copy link
Contributor

@worldofgeese worldofgeese left a comment

Choose a reason for hiding this comment

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

Great shot of clarity and taught me a new key to use for rewriting source path ⚡

@eysi09 eysi09 enabled auto-merge September 3, 2023 18:14
@eysi09 eysi09 added this pull request to the merge queue Sep 3, 2023
Merged via the queue into main with commit 9ecd87b Sep 3, 2023
@eysi09 eysi09 deleted the k8s-deploy-action-examples branch September 3, 2023 19:11
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.

2 participants