-
Notifications
You must be signed in to change notification settings - Fork 128
docs: switch chapter 1 to Charmcraft charm #2259
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
Open
dwilding
wants to merge
15
commits into
canonical:k8s-tutorial-uv
Choose a base branch
from
dwilding:k8s-tutorial-minimal-charm
base: k8s-tutorial-uv
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2c674e5
update instructions for creating minimal charm
dwilding ca4c4f5
update packed charm name
dwilding 65dbd3c
fix version returned from server
dwilding 5f7b6dd
fix table formatting
dwilding d9ffc20
add a note about the workload module
dwilding 7141ee8
update unit tests
dwilding 0b68c0b
update integration tests
dwilding 66261ee
update code for charm 1
dwilding 1c22615
fix formatting
dwilding 338264f
fix more formatting
dwilding 93c2a46
Merge remote-tracking branch 'upstream/k8s-tutorial-uv' into k8s-tuto…
dwilding d997e73
add links to reference docs
dwilding 57f272c
switch to self.on[...].pebble_ready
dwilding 024c4ed
improve wording around packing
dwilding 2cc0f8b
stick with single quotes in later charms (for now)
dwilding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
432 changes: 128 additions & 304 deletions
432
...-to-hero-write-your-first-kubernetes-charm/create-a-minimal-kubernetes-charm.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,56 @@ | ||
| # This file configures Charmcraft. | ||
| # See https://documentation.ubuntu.com/charmcraft/stable/reference/files/charmcraft-yaml-file/ | ||
| type: charm | ||
| bases: | ||
| - build-on: | ||
| - name: ubuntu | ||
| channel: "22.04" | ||
| run-on: | ||
| - name: ubuntu | ||
| channel: "22.04" | ||
|
|
||
| name: demo-api-charm | ||
| title: | | ||
| demo-fastapi-k8s | ||
| name: fastapi-demo | ||
| title: Web Server Demo | ||
| summary: A demo charm that operates a small Python FastAPI server. | ||
| description: | | ||
| This is a demo charm built on top of a small Python FastAPI server. | ||
| summary: | | ||
| FastAPI Demo charm for Kubernetes | ||
| This charm demonstrates how to write a Kubernetes charm with Ops. | ||
| # Documentation: | ||
| # https://documentation.ubuntu.com/charmcraft/stable/howto/build-guides/select-platforms/ | ||
| base: [email protected] | ||
| platforms: | ||
| amd64: | ||
| arm64: | ||
|
|
||
| parts: | ||
| charm: | ||
| plugin: uv | ||
| source: . | ||
| build-snaps: | ||
| - astral-uv | ||
|
|
||
| # (Optional) Configuration options for the charm | ||
| # This config section defines charm config options, and populates the Configure | ||
| # tab on Charmhub. | ||
| # More information on this section at: | ||
| # https://documentation.ubuntu.com/charmcraft/stable/reference/files/charmcraft-yaml-file/#config | ||
| # General configuration documentation: | ||
| # https://documentation.ubuntu.com/juju/3.6/reference/configuration/#application-configuration | ||
| config: | ||
| options: | ||
| # An example config option to customise the log level of the workload | ||
| log-level: | ||
| description: | | ||
| Configures the log level of gunicorn. | ||
| assumes: | ||
| - juju >= 3.1 | ||
| - k8s-api | ||
| Acceptable values are: "info", "debug", "warning", "error" and "critical" | ||
| default: "info" | ||
| type: string | ||
|
|
||
| containers: | ||
| demo-server: | ||
| resource: demo-server-image | ||
|
|
||
| resources: | ||
| # An OCI image resource for each container listed above. | ||
| # You may remove this if your charm will run without a workload sidecar container. | ||
| # An OCI image resource for the container listed above. | ||
| demo-server-image: | ||
| type: oci-image | ||
| description: OCI image from GitHub Container Repository | ||
| # The upstream-source field is ignored by Juju. It is included here as a reference | ||
| # so the integration testing suite knows which image to deploy during testing. This field | ||
| # is also used by the 'canonical/charming-actions' GitHub action for automated releasing. | ||
| # The upstream-source field is ignored by Charmcraft and Juju, but it can be | ||
| # useful to developers in identifying the source of the OCI image. It is also | ||
| # used by the 'canonical/charming-actions' GitHub action for automated releases. | ||
| # The test_deploy function in tests/integration/test_charm.py reads upstream-source | ||
| # to determine which OCI image to use when running the charm's integration tests. | ||
| upstream-source: ghcr.io/canonical/api_demo_server:1.0.1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's worth retaining these. It seems they're not in the Charmcraft template. I'm kind of surprised that
assumes: k8s-apiisn't in the Kubernetes one. Is that a considered decision on our part, or an oversight?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess
containersmeans it's K8s so maybe it's just redundant?