Charmcraft
Charmcraft project. Documentation: https://documentation.ubuntu.com/charmcraft/stable/
| Type | PlatformCharm | BasesCharm |
|---|---|
| File match |
charmcraft.yaml
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/charmcraft/latest.json |
| Source | https://raw.githubusercontent.com/canonical/charmcraft/main/schema/charmcraft.json |
Validate with Lintel
npx @lintel/lintel check
One of
Definitions
Definition of analysis configuration.
Definition of analysis.ignore configuration.
2 nested properties
[]
[]
Represents a base.
[
"amd64"
]
A charm using the deprecated bases keyword.
This type of charm only supports the following bases: - Ubuntu 18.04 - Ubuntu 20.04 - Ubuntu 22.04 - Alma Linux 9
The name of the project on Charmhub.
This value will be used both in the URL of the charm on Charmhub and when deploying the charm with juju.
Charms should follow the
charm naming guidelines <https://juju.is/docs/sdk/naming>_.
A brief (one-line) summary of your charm.
A multi-line summary of your charm.
Selects a part to inherit metadata from.
Configures the various mechanisms to obtain, process and prepare data from different sources that end up being a part of the final charm.
Keys are user-defined part names. The value of each key is a map where keys are part names.
Example::
parts:
libs:
plugin: dump
source: /usr/local/lib/
organize:
"libxxx.so*": lib/
prime:
- lib/
{
"charm": {
"plugin": "charm",
"source": "."
}
}
The package repositories to use for build and stage packages.
How analysis done on the charm will behave.
Currently the only options are to ignore attributes or linters.
(DEPRECATED): Configuration for accessing charmhub.
Defines one or more actions.
This key is equivalent to the
actions.yaml file <https://juju.is/docs/sdk/actions-yaml>_.
Explicitly state features a Juju model must be able to provide for a
successful deployment of this charm. When a charm includes such
requirements, Juju performs a pre-deployment check and displays
user-friendly error messages if a feature requirement cannot be met by the
model that the user is trying to deploy the charm to. If the assumes
section of the charm metadata is omitted, Juju will make a best-effort
attempt to deploy the charm, and users must rely on the output of
juju status to figure out whether the deployment was successful.
The key consists of a list of features that can be given either directly or, depending on the complexity of the condition you want to enforce, nested under one or both of the boolean expressions any-of or all-of, as shown below. In order for a charm to be deployed, all entries in the assumes block must be satisfied.
Structure::
assumes:
- <feature-1>
- any-of:
- <feature-2>
- <feature-3>
- all-of:
- <feature-4>
- <feature-5>
Juju version requirements can be specified with a string such as
juju >= 3.5 or juju < 4.0. A full list of supported features
can be found in the
Juju documentation <https://juju.is/docs/juju/supported-features>_.
Specifies that the charm code does not need to be run as root. Possible values are:
root: the charm will run as rootsudoer: the charm will run as a non-root user with access to root privileges usingsudo.non-root: the charm will run as a non-root user withoutsudo.
Only affects Kubernetes charms on Juju 3.6.0 or later. If not specified,
Juju will use
its default behaviour <https://juju.is/docs/sdk/metadata-yaml#heading--charm-user>_.
Define a map of containers to be created adjacent to the charm (as a sidecar, in the same pod).
This is required for Kubernetes charms.
This key consists of a dictionary mapping container names to their
specifications. Each container can be specified in terms of resource,
bases and mounts, where one of either the resource or the
bases subkeys must be defined and mounts is optional.
resourceis the name of an OCI image resource used to create the container (that you will then define further in the resources block).basesis a list of bases to be used for resolving a container image, in descending order of preference. To use it, specify a base name (for example,ubuntuoralmalinux), achanneland anarchitecture.mountsis a list of mounted storage volumes for this container. To use it, specify the name of the storage to mount from the charm storage and, optionally, the location where to mount the storage.
Structure::
containers:
<container name>:
resource: <resource name>
bases:
- name: <base name>
channel: <track[/risk][/branch]>
architectures:
- <architecture>
mounts:
- storage: <storage name>
location: <path>
Devices the charm needs.
Structure::
devices:
<device name>:
type: gpu | nvidia.com/gpu | amd.com/gpu
description: <Optional description>
countmin: <Optional minimum number requested>
countmax: <Optional maximum number requested>
A key-only mapping representing extra bindings needed.
A map of peer relations.
Structure::
peers:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A map of interfaces this charm provides.
Structure::
provides:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A map of relations this charm requires.
Structure::
requires:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A mapping of resources that accompany the charm.
See first: Juju | Charm resource <https://juju.is/docs/juju/charm-resource>_
Each resource is made available when the charm is deployed. NOTE:
Kubernetes charms must declare an oci-image type resource for each
container declared in containers.
Structure::
# (Optional) Additional resources that accompany the charm
resources:
<resource name>:
# (Required) The type of the resource
type: file | oci-image
# (Optional) Description of the resource and its purpose
description: <description>
# (Required: when type:file) The filename of the resource as it
# should appear in the filesystem.
filename: <filename>
Storage devices requested by the charm.
Structure::
storage:
# Each key represents the name of the storage
<storage name>:
# (Required) Type of the requested storage
type: filesystem | block
# (Optional) Description of the storage requested
description: <description>
# (Optional) The mount location for filesystem stores. For
# multi-stores the location acts as the parent directory for each
# mounted store.
location: <location>
# Indicates if the storage should be made read-only (where
# possible). Defaults to false
read-only: true | false
# (Optional) The number of storage instances to be requested
multiple:
range: <n> | <n>-<m> | <n>- | <n>+
# (Optional) Minimum size of requested storage in forms G, GiB, GB.
# Size multipliers are M, G, T, P, E, Z or Y. With no multiplier
# supplied, M is implied.
minimum-size: <n> | <n><multiplier>
# (Optional) List of properties, only supported value is "transient"
properties:
- transient
Optional boolean to declare the charm subordinate.
A list of terms to which the user agree by using the charm. These terms are not enforced by the charm, Juju or Canonical.
(Recommended) Links to various additional information used by Charmhub.
One or more configuration options for your charm.
Structure::
config:
options:
# Each option name is the name by which the charm will query the option.
<option name>:
# (Required) The type of the option
type: string | int | float | boolean | secret
# (Optional) The default value of the option
default: <a reasonable default value of the same type as the option>
# (Optional): A string describing the option. Also appears on charmhub.io
description: <description string>
Definition of build-on/run-on combinations.
Example::
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures: [amd64, arm64]
run-on:
- name: ubuntu
channel: "20.04"
architectures: [amd64, arm64]
- name: ubuntu
channel: "22.04"
architectures: [amd64, arm64]
A Charm library dependency for this charm.
Definition of Charmhub endpoint configuration.
Definition of analysis.ignore configuration.
[]
[]
Definition of links in metadata.
A single platform entry in the platforms dictionary.
This model defines how a single value under the platforms key works for a project.
Model for defining a charm using Platforms.
The name of the project on Charmhub.
This value will be used both in the URL of the charm on Charmhub and when deploying the charm with juju.
Charms should follow the
charm naming guidelines <https://juju.is/docs/sdk/naming>_.
A brief (one-line) summary of your charm.
A multi-line summary of your charm.
Configures the various mechanisms to obtain, process and prepare data from different sources that end up being a part of the final charm.
Keys are user-defined part names. The value of each key is a map where keys are part names.
Example::
parts:
libs:
plugin: dump
source: /usr/local/lib/
organize:
"libxxx.so*": lib/
prime:
- lib/
Selects a part to inherit metadata from.
The package repositories to use for build and stage packages.
How analysis done on the charm will behave.
Currently the only options are to ignore attributes or linters.
(DEPRECATED): Configuration for accessing charmhub.
Defines one or more actions.
This key is equivalent to the
actions.yaml file <https://juju.is/docs/sdk/actions-yaml>_.
Explicitly state features a Juju model must be able to provide for a
successful deployment of this charm. When a charm includes such
requirements, Juju performs a pre-deployment check and displays
user-friendly error messages if a feature requirement cannot be met by the
model that the user is trying to deploy the charm to. If the assumes
section of the charm metadata is omitted, Juju will make a best-effort
attempt to deploy the charm, and users must rely on the output of
juju status to figure out whether the deployment was successful.
The key consists of a list of features that can be given either directly or, depending on the complexity of the condition you want to enforce, nested under one or both of the boolean expressions any-of or all-of, as shown below. In order for a charm to be deployed, all entries in the assumes block must be satisfied.
Structure::
assumes:
- <feature-1>
- any-of:
- <feature-2>
- <feature-3>
- all-of:
- <feature-4>
- <feature-5>
Juju version requirements can be specified with a string such as
juju >= 3.5 or juju < 4.0. A full list of supported features
can be found in the
Juju documentation <https://juju.is/docs/juju/supported-features>_.
Specifies that the charm code does not need to be run as root. Possible values are:
root: the charm will run as rootsudoer: the charm will run as a non-root user with access to root privileges usingsudo.non-root: the charm will run as a non-root user withoutsudo.
Only affects Kubernetes charms on Juju 3.6.0 or later. If not specified,
Juju will use
its default behaviour <https://juju.is/docs/sdk/metadata-yaml#heading--charm-user>_.
Define a map of containers to be created adjacent to the charm (as a sidecar, in the same pod).
This is required for Kubernetes charms.
This key consists of a dictionary mapping container names to their
specifications. Each container can be specified in terms of resource,
bases and mounts, where one of either the resource or the
bases subkeys must be defined and mounts is optional.
resourceis the name of an OCI image resource used to create the container (that you will then define further in the resources block).basesis a list of bases to be used for resolving a container image, in descending order of preference. To use it, specify a base name (for example,ubuntuoralmalinux), achanneland anarchitecture.mountsis a list of mounted storage volumes for this container. To use it, specify the name of the storage to mount from the charm storage and, optionally, the location where to mount the storage.
Structure::
containers:
<container name>:
resource: <resource name>
bases:
- name: <base name>
channel: <track[/risk][/branch]>
architectures:
- <architecture>
mounts:
- storage: <storage name>
location: <path>
Devices the charm needs.
Structure::
devices:
<device name>:
type: gpu | nvidia.com/gpu | amd.com/gpu
description: <Optional description>
countmin: <Optional minimum number requested>
countmax: <Optional maximum number requested>
A key-only mapping representing extra bindings needed.
A map of peer relations.
Structure::
peers:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A map of interfaces this charm provides.
Structure::
provides:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A map of relations this charm requires.
Structure::
requires:
<endpoint name>:
interface: <Required interface name>
limit: <Optional: maximum number of supported connections
optional: <Informational only - whether the relation is required.>
scope: <"global" or "container" - the relation scope.>
For more information, see
the Juju documentation <https://juju.is/docs/juju/relation>_.
A mapping of resources that accompany the charm.
See first: Juju | Charm resource <https://juju.is/docs/juju/charm-resource>_
Each resource is made available when the charm is deployed. NOTE:
Kubernetes charms must declare an oci-image type resource for each
container declared in containers.
Structure::
# (Optional) Additional resources that accompany the charm
resources:
<resource name>:
# (Required) The type of the resource
type: file | oci-image
# (Optional) Description of the resource and its purpose
description: <description>
# (Required: when type:file) The filename of the resource as it
# should appear in the filesystem.
filename: <filename>
Storage devices requested by the charm.
Structure::
storage:
# Each key represents the name of the storage
<storage name>:
# (Required) Type of the requested storage
type: filesystem | block
# (Optional) Description of the storage requested
description: <description>
# (Optional) The mount location for filesystem stores. For
# multi-stores the location acts as the parent directory for each
# mounted store.
location: <location>
# Indicates if the storage should be made read-only (where
# possible). Defaults to false
read-only: true | false
# (Optional) The number of storage instances to be requested
multiple:
range: <n> | <n>-<m> | <n>- | <n>+
# (Optional) Minimum size of requested storage in forms G, GiB, GB.
# Size multipliers are M, G, T, P, E, Z or Y. With no multiplier
# supplied, M is implied.
minimum-size: <n> | <n><multiplier>
# (Optional) List of properties, only supported value is "transient"
properties:
- transient
Optional boolean to declare the charm subordinate.
A list of terms to which the user agree by using the charm. These terms are not enforced by the charm, Juju or Canonical.
(Recommended) Links to various additional information used by Charmhub.
One or more configuration options for your charm.
Structure::
config:
options:
# Each option name is the name by which the charm will query the option.
<option name>:
# (Required) The type of the option
type: string | int | float | boolean | secret
# (Optional) The default value of the option
default: <a reasonable default value of the same type as the option>
# (Optional): A string describing the option. Also appears on charmhub.io
description: <description string>