Skip to content

Commit

Permalink
deployment errors if all config isn't provided at deploy time (#5)
Browse files Browse the repository at this point in the history
* lint/license adjustments

* spelling corrections, example usage

* consistent status messages, formatting, use block vs waiting appropriately

* no need for duplicate cni-joined and cni-changed relations; ensure state gates are bools; no update-status unless configured; need image secret before tigera, and license after

* fix non-leader premature kubectl calls

- non-leader units should wait for the cni relation before we consider
them 'configured' to ensure they'll have a valid kubeconfig available.
- waiting_for_cni in update_status is no longer needed since units won't
be 'configured' until that check passes.
- k-c-p may be in the middle of restarting the apiserver when we attempt
to query the tigera pod; handle that as if no pod is available. we'll
try again on the next hook that calls update_status.

* address failing integration tests

- test against stable bundle
- ensure model debug and halt on hook failure
- try/catch creation of install / crd manifests independently
- let our status handler fail since we're in a retry loop (fail well)

* retry kubectl calls (up to 3m) with tenacity

---------

Co-authored-by: Mateo Florido <32885896+mateoflorido@users.noreply.github.com>
  • Loading branch information
kwmonroe and mateoflorido authored Mar 24, 2024
1 parent d855833 commit c7404b9
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 125 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 pguimaraes
Copyright 2024 Canonical Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
17 changes: 11 additions & 6 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ options:
default: ""
type: string
description: |
LicenseKey should be a file, appiled as a bas64 string
LicenseKey should be a file, applied as a base64 string
file format:
kind: LicenseKey
Expand All @@ -27,7 +27,8 @@ options:
certificate: <content>
token: <content>
$ juju config calico-enterprise license="$(cat license | base64 -w0)"
example use:
juju config calico-enterprise license="$(cat license | base64 -w0)"
addons:
default: False
type: boolean
Expand Down Expand Up @@ -66,7 +67,10 @@ options:
default: ""
type: string
description: |
String in the format of "user:password" run through base64 encoding
Credentials in the format <user>:<password>, applied as a base64 string
example use:
juju config calico-enterprise image_registry_secret="$(echo user:password | base64 -w0)"
tigera_version:
default: 'distro'
type: string
Expand Down Expand Up @@ -119,10 +123,9 @@ options:
description: |
If set, BGP will be configured in the early stage (pre-k8s) and passed on to k8s.
If the configuration is unset or has a string len=0, then bgp_parameters is considered
empty. This option can be configured as follows:
$ juju config tigera bgp_parameters="$(cat bgp_params.yaml)"
empty.
For example:
file format:
- hostname: <hostname>
asn: <number>
stableAddress: <IP>
Expand All @@ -136,3 +139,5 @@ options:
peerASN: <2>
- ...
example use:
juju config calico-enterprise bgp_parameters="$(cat bgp_params.yaml)"
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ target-version = ["py38"]
# Linting tools configuration
[tool.ruff]
line-length = 99
select = ["E", "W", "F", "C", "N", "D", "I001"]
extend-exclude = ["__pycache__", "*.egg_info"]

[tool.ruff.lint]
extend-ignore = [
"D203",
"D204",
Expand All @@ -32,8 +34,8 @@ extend-ignore = [
"D413",
]
ignore = ["E501", "D107"]
extend-exclude = ["__pycache__", "*.egg_info"]
per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]}
select = ["E", "W", "F", "C", "N", "D", "I001"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 10
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ops >= 1.5.0
git+https://github.com/charmed-kubernetes/conctl#egg=conctl
Jinja2 < 3.1
pydantic <=1.9.0 # Python 3.6 support requires <= 1.9.0
tenacity
Loading

0 comments on commit c7404b9

Please sign in to comment.