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

Merge main jaas resources #585

Merged
merged 39 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
daded1c
feat(githubactions): dependabot to use custom labels
cderici Jul 11, 2024
6c14733
fix(application): update resource example to use correct charm storag…
anvial Jul 24, 2024
11fbba9
chore(deps): bump github.com/hashicorp/terraform-plugin-framework
dependabot[bot] Jul 15, 2024
ed37461
fix(storagedirective): fix storage directive validator
anvial Aug 1, 2024
65128b6
chore: updated comment for validator
anvial Aug 6, 2024
1cc0b61
chore(deps): bump deps
dependabot[bot] Jul 15, 2024
e42ad8b
chore(deps): bump github.com/juju/cmd/v3 from 3.0.14 to 3.0.16
dependabot[bot] Aug 8, 2024
0a68047
test: run microk8s against 3 1 rather than 2 9
hmlanigan Aug 12, 2024
61f1e6c
test: use the latest terraform cli in testing
hmlanigan Aug 12, 2024
91dd07e
feat(application): deploy applications with custom resources
gatici May 29, 2024
473d74f
feat(application): update custom images when application is updated
gatici Jun 2, 2024
7ee23b3
feat(application): remove resorces when the plan does not specify res…
gatici Jun 6, 2024
1a391cf
feat(resources): address review comments to update to latest resource…
gatici Jul 2, 2024
368c3fc
revert(docs): removing additional example from resource.tf
gatici Jul 8, 2024
ee7dda3
chore: add necessary lines for imports
gatici Jul 8, 2024
27591fe
chore: resolve merge conflicts
gatici Jul 8, 2024
a4b7b0a
docs(resource): simplify the resourceKeyMarkdownDescription
gatici Jul 8, 2024
e50e33c
style: adding resources.go file
gatici Jul 23, 2024
7f6f749
fix(application): use -1 to indicate that revision is not provided
gatici Jul 23, 2024
e4f1165
feat(application): adding custom plan validator for ResourceKey
gatici Jul 24, 2024
a6f4f48
refactor(application): rename argument names in addPendingResources a…
gatici Jul 24, 2024
c754019
refactor(application): rename variables in the methods to increase re…
gatici Jul 26, 2024
9bbda43
docs: update the docstring of isInt method definition
gatici Jul 26, 2024
4fd6d58
fix(application): remove the manipulation to use resource version
gatici Jul 26, 2024
c6c6b3a
feat(resources): extend the custom plan validator to validate image r…
gatici Jul 26, 2024
13a70eb
revert: set the debug mode to false
gatici Jul 26, 2024
ca64cf4
fix: addressing review comments
gatici Aug 2, 2024
931ee99
refactor(application): refactoring the addPendingResources function t…
gatici Aug 6, 2024
544860e
docs(resources): arrange the resourceKeyMarkdownDescription
gatici Aug 6, 2024
faecc1e
test(resources): add tests for resourcekey validator
gatici Aug 6, 2024
d002f11
fix(tests): fixing the integration tests
gatici Aug 7, 2024
805ea55
revert: revert the changes which are done in deployFromRepository
gatici Aug 15, 2024
9c36644
chore: fix integration tests, linting issues add more tests
gatici Aug 27, 2024
4a84857
fix(constraints): ensure constraints are non-nil
jack-w-shaw Aug 22, 2024
b8dd787
chore(cla): add cla check action
jack-w-shaw Aug 28, 2024
222971d
fix: bugs 535 and 539 only find storage for application being read
hmlanigan Aug 26, 2024
e1b4049
fix(application): do no panic on nil pointer
hmlanigan Sep 4, 2024
6bf34b9
chore(release): changelog for 0.14.0 release candidate
hmlanigan Sep 9, 2024
d2413c8
feat: improve test speed
kian99 Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ updates:
directory: "/"
schedule:
interval: "daily"
labels:
- "hint/dependencies"
- "area/go"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
labels:
- "hint/dependencies"
- "area/go"
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
fail-fast: false
matrix:
terraform:
- "1.8.*"
- "1.9.*"
include:
- cloud: "lxd"
cloud-channel: "5.21/stable"
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "CLA check"
on: [pull_request, workflow_dispatch]

permissions:
contents: read

jobs:
cla-check:
permissions:
pull-requests: write # for canonical/has-signed-canonical-cla to create & update comments
runs-on: ubuntu-latest
steps:
- name: Check if CLA signed
uses: canonical/[email protected]
with:
accept-existing-contributors: true
2 changes: 1 addition & 1 deletion .github/workflows/k8s_tunnel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
cloud:
- "microk8s"
terraform:
- "1.8.*"
- "1.9.*"
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_add_machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
cloud:
- "lxd"
terraform:
- "1.8.*"
- "1.9.*"
juju:
- "2.9/stable"
- "3/stable"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
action-operator:
- { lxd-channel: "5.21/stable", cloud: "lxd", cloud-channel: "5.21", juju: "2.9" }
- { lxd-channel: "5.21/stable", cloud: "lxd", cloud-channel: "5.21", juju: "3" }
- { lxd-channel: "5.21/stable", cloud: "microk8s", cloud-channel: "1.28", juju: "2.9" }
- { lxd-channel: "5.21/stable", cloud: "microk8s", cloud-channel: "1.28-strict", juju: "3.1" }
- { lxd-channel: "5.21/stable", cloud: "microk8s", cloud-channel: "1.28-strict", juju: "3" }
timeout-minutes: 60
steps:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 0.14.0 (September 9, 2024)

NOTES:
* **This release requires juju controller version 2.9.49 or later juju.**
* This release uses juju client api code from the juju 3.5.1 release.

ENHANCEMENTS:

* Allow applications to specify charm resources as oci-image urls, in addition to revisions.

BUG FIXES:

* fix: bugs 535 and 539 only find storage for application being read by @hmlanigan in #557
* fix (application): do no panic on nil pointer by @hmlanigan in #563
* fix(constraints): ensure constraints are non-null by @jack-w-shaw in #556
* fix(storagedirective): fix storage directive validator by @anvial in #538
* fix(application): update resource example to use correct charm storage by @anvial in #533

## 0.13.0 (July 15, 2024)

NOTES:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GOPATH=$(shell go env GOPATH)
PARALLEL_TEST_COUNT ?= 3
EDGE_VERSION ?= 0.14.0
EDGE_VERSION ?= 0.15.0
REGISTRY_DIR=~/.terraform.d/plugins/registry.terraform.io/juju/juju/${EDGE_VERSION}/${GOOS}_${GOARCH}

.PHONY: install
Expand Down
25 changes: 13 additions & 12 deletions docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ resource "juju_application" "this" {
series = "trusty"
}

resources = {
gosherve-image = "gatici/gosherve:1.0"
}

units = 3

placement = "0,1,2"

storage = {
storage_directives = {
files = "101M"
}

Expand All @@ -55,17 +59,14 @@ resource "juju_application" "this" {
- `expose` (Block List) Makes an application publicly available over the network (see [below for nested schema](#nestedblock--expose))
- `name` (String) A custom name for the application deployment. If empty, uses the charm's name.
- `placement` (String) Specify the target location for the application's units
- `resources` (Map of Number) Charm resource revisions. Must evaluate to an integer.

There are a few scenarios that need to be considered:
* If the plan does not specify resource revision and resources are added to the plan,
resources with specified revisions will be attached to the application (equivalent
to juju attach-resource).
* If the plan does specify resource revisions and:
* If the charm revision or channel is updated, then resources get updated to the
latest revision.
* If the charm revision or channel are not updated, then no changes will take
place (juju does not have an "un-attach" command for resources).
- `resources` (Map of String) Charm resources. Must evaluate to a string. A resource could be a resource revision number from CharmHub or a custom OCI image resource.
Specify a resource other than the default for a charm. Note that not all charms have resources.

Notes:
* A resource can be specified by a revision number or by URL to a OCI image repository. Resources of type 'file' can only be specified by revision number. Resources of type 'oci-image' can be specified by revision number or URL.
* A resource can be added or changed at any time. If the charm has resources and None is specified in the plan, Juju will use the resource defined in the charm's specified channel.
* If a charm is refreshed, by changing the charm revision or channel and if the resource is specified by a revision in the plan, Juju will use the resource defined in the plan.
* Resources specified by URL to an OCI image repository will never be refreshed (upgraded) by juju during a charm refresh unless explicitly changed in the plan.
- `storage` (Attributes Set) Storage used by the application. (see [below for nested schema](#nestedatt--storage))
- `storage_directives` (Map of String) Storage directives (constraints) for the juju application. The map key is the label of the storage defined by the charm, the map value is the storage directive in the form <pool>,<count>,<size>. Changing an existing key/value pair will cause the application to be replaced. Adding a new key/value pair will add storage to the application on upgrade.
- `trust` (Boolean) Set the trust for the application.
Expand Down
6 changes: 5 additions & 1 deletion examples/resources/juju_application/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ resource "juju_application" "this" {
series = "trusty"
}

resources = {
gosherve-image = "gatici/gosherve:1.0"
}

units = 3

placement = "0,1,2"

storage = {
storage_directives = {
files = "101M"
}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ require (
github.com/canonical/jimm-go-sdk/v3 v3.0.4
github.com/dustin/go-humanize v1.0.1
github.com/hashicorp/terraform-json v0.22.1
github.com/hashicorp/terraform-plugin-framework v1.9.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-framework v1.10.0
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
github.com/juju/charm/v12 v12.1.0
github.com/juju/clock v1.1.1
github.com/juju/cmd/v3 v3.0.15
github.com/juju/cmd/v3 v3.0.16
github.com/juju/collections v1.0.4
github.com/juju/errors v1.0.0
github.com/juju/names/v4 v4.0.0-20220207005702-9c6532a52823
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7
github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A=
github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c=
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
github.com/hashicorp/terraform-plugin-framework v1.9.0 h1:caLcDoxiRucNi2hk8+j3kJwkKfvHznubyFsJMWfZqKU=
github.com/hashicorp/terraform-plugin-framework v1.9.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc=
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg=
github.com/hashicorp/terraform-plugin-framework v1.10.0 h1:xXhICE2Fns1RYZxEQebwkB2+kXouLC932Li9qelozrc=
github.com/hashicorp/terraform-plugin-framework v1.10.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM=
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E=
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo=
github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co=
github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
Expand Down Expand Up @@ -330,8 +330,8 @@ github.com/juju/charm/v12 v12.1.0 h1:V0M440FBP4ASRgA98jxEWqlcb38ahP0rus4u05ftPJ8
github.com/juju/charm/v12 v12.1.0/go.mod h1:QRuKxXC5zzfPlAa8ipmxX1tvpbIBliueLVHGbs3T7wU=
github.com/juju/clock v1.1.1 h1:NvgHG9DQmOpBevgt6gzkyimdWBooLXDy1cQn89qJzBI=
github.com/juju/clock v1.1.1/go.mod h1:HIBvJ8kiV/n7UHwKuCkdYL4l/MDECztHR2sAvWDxxf0=
github.com/juju/cmd/v3 v3.0.15 h1:/n/n/L4CX5hL9Bwkt9QV31Qsa3Vo8GB95gtpQPEIEb0=
github.com/juju/cmd/v3 v3.0.15/go.mod h1:lGtDvm2BG+FKnIS8yY/vrhxQNX9imnL6bPIYGSTchuI=
github.com/juju/cmd/v3 v3.0.16 h1:P/tG4BPtE+MsmECtnFx+KBC8NFi1ESvHbZ8NzMAll1g=
github.com/juju/cmd/v3 v3.0.16/go.mod h1:lGtDvm2BG+FKnIS8yY/vrhxQNX9imnL6bPIYGSTchuI=
github.com/juju/collections v1.0.4 h1:GjL+aN512m2rVDqhPII7P6qB0e+iYFubz8sqBhZaZtk=
github.com/juju/collections v1.0.4/go.mod h1:hVrdB0Zwq9wIU1Fl6ItD2+UETeNeOEs+nGvJufVe+0c=
github.com/juju/description/v5 v5.0.4 h1:qA35hRglZ47j1mmo9zUM9R+2WSDCH5dvL5ik7gA2aVE=
Expand Down
Loading
Loading