From a53d3bb7f9104526c26ab34a90ff69adf4b61f12 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 10:52:59 +1300 Subject: [PATCH 1/5] docs: note that additionalProperties is not safe to rely on the default --- docs/howto/manage-actions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/howto/manage-actions.md b/docs/howto/manage-actions.md index 40d46345e..0455321df 100644 --- a/docs/howto/manage-actions.md +++ b/docs/howto/manage-actions.md @@ -39,6 +39,8 @@ actions: additionalProperties: false ``` +Note that you should **always** include the `additionalProperties` field, which controls whether users can provide properties that are not in the definition, as the default changed from `true` in Juju 3 to `false` in Juju 4. If you don't explicitly include it in the YAML, then the charm behaviour will differ depending on which Juju version the charm is deployed to. + In the `src/charm.py` file of the charm, add a class that mirrors the configuration from `charmcraft.yaml`. This lets your static type checker and IDE know what Python type the parameters should be, and provides a place to do From 033c3143420541a3aacc3b8d89c25d25cf0070b7 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 11:38:43 +1300 Subject: [PATCH 2/5] Also set additionalProperties to false in the tutorial charm. --- .../expose-operational-tasks-via-actions.md | 1 + examples/k8s-4-action/charmcraft.yaml | 1 + examples/k8s-5-observe/charmcraft.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md b/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md index 95351e8b2..96f1bf7f5 100644 --- a/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md +++ b/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md @@ -37,6 +37,7 @@ actions: description: Show username and password in output information type: boolean default: False + additionalProperties: False ``` ## Define an action class diff --git a/examples/k8s-4-action/charmcraft.yaml b/examples/k8s-4-action/charmcraft.yaml index 8340a8b9c..399235208 100644 --- a/examples/k8s-4-action/charmcraft.yaml +++ b/examples/k8s-4-action/charmcraft.yaml @@ -44,6 +44,7 @@ actions: description: Show username and password in output information type: boolean default: False + additionalProperties: False containers: demo-server: diff --git a/examples/k8s-5-observe/charmcraft.yaml b/examples/k8s-5-observe/charmcraft.yaml index b1a775b06..1624500fb 100644 --- a/examples/k8s-5-observe/charmcraft.yaml +++ b/examples/k8s-5-observe/charmcraft.yaml @@ -69,6 +69,7 @@ actions: description: Show username and password in output information type: boolean default: False + additionalProperties: false containers: demo-server: From d247fc25342049c43fce1ab4d9222bde46f2cd6e Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 13:25:49 +1300 Subject: [PATCH 3/5] Update docs/howto/manage-actions.md Co-authored-by: Dave Wilding --- docs/howto/manage-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/manage-actions.md b/docs/howto/manage-actions.md index 0455321df..0bd090577 100644 --- a/docs/howto/manage-actions.md +++ b/docs/howto/manage-actions.md @@ -39,7 +39,7 @@ actions: additionalProperties: false ``` -Note that you should **always** include the `additionalProperties` field, which controls whether users can provide properties that are not in the definition, as the default changed from `true` in Juju 3 to `false` in Juju 4. If you don't explicitly include it in the YAML, then the charm behaviour will differ depending on which Juju version the charm is deployed to. +You should **always** include the `additionalProperties` field, which controls whether users can provide properties that are not in the definition. The default value of the field changed from `true` in Juju 3 to `false` in Juju 4. If you don't explicitly include the field, the charm behaviour will differ depending on which Juju version the charm is deployed to. In the `src/charm.py` file of the charm, add a class that mirrors the configuration from `charmcraft.yaml`. This lets your static type checker and From 647fc6b9858840bcc871e997886d64737b70d73f Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 17:18:24 +1300 Subject: [PATCH 4/5] Update docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../expose-operational-tasks-via-actions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md b/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md index 96f1bf7f5..710829372 100644 --- a/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md +++ b/docs/tutorial/from-zero-to-hero-write-your-first-kubernetes-charm/expose-operational-tasks-via-actions.md @@ -36,8 +36,8 @@ actions: show-password: description: Show username and password in output information type: boolean - default: False - additionalProperties: False + default: false + additionalProperties: false ``` ## Define an action class From 967af310854435f6594def2d4c6b1b93ebf07494 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 17:18:36 +1300 Subject: [PATCH 5/5] Update examples/k8s-4-action/charmcraft.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- examples/k8s-4-action/charmcraft.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/k8s-4-action/charmcraft.yaml b/examples/k8s-4-action/charmcraft.yaml index 399235208..6b8c21948 100644 --- a/examples/k8s-4-action/charmcraft.yaml +++ b/examples/k8s-4-action/charmcraft.yaml @@ -43,8 +43,8 @@ actions: show-password: description: Show username and password in output information type: boolean - default: False - additionalProperties: False + default: false + additionalProperties: false containers: demo-server: