generated from canonical/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 8
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
[DPE-5830] Bump to 24.04 #495
Open
reneradoi
wants to merge
35
commits into
2/edge
Choose a base branch
from
bump_to_24_04
base: 2/edge
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
35 commits
Select commit
Hold shift + click to select a range
83ed30c
add Ubuntu 24.04 to charmcraft.yaml
reneradoi 772f0a5
remove build-on and run-on parameters from charmcraft.yaml
reneradoi 5d27abd
fix charmcraft.yaml syntax for using ubuntu 24.04 with charmcraft 3
reneradoi 53897c2
install 24.04 snap
reneradoi b8cb252
switch to snap usage and apply charmcraft patch
zmraul 0668479
add 24 base patch
zmraul 337b880
switch to correct snap
zmraul 64cb585
lint
zmraul 3f3c999
update with keytool app from snap
zmraul cf24129
use snap folder for tmp dirs
zmraul 3a3c019
test charmcraft 3
zmraul 25aad14
test collect bases fix
zmraul 1dcaa19
fix unit tests
zmraul d121e8d
mend
zmraul f4aecff
fix unit test
zmraul 68fb074
update cache
zmraul eec8311
add cloned PR process to 24.04 base
zmraul 2633109
force patch
zmraul 4a6aa94
switch command
zmraul 28aaaaf
authenticate
zmraul cfce9ca
add automated PR creation
zmraul 272761e
switch base branch
zmraul 4a4c8dc
switch base branch
zmraul cacae9c
integrate with charmcraftst124
zmraul 1065ff7
fix application charm app
zmraul 7b1ac8f
fix application charm app
zmraul 754b6e4
fix lint
zmraul e07cd94
test websockets issue
zmraul 2b96dd6
test
zmraul 5f47f14
test
zmraul 494cbfa
run scripts internally
zmraul 4349a7b
update juju
zmraul b616601
move temporary files to conf folde
zmraul e75277b
fix unit tests
zmraul 1445650
rebase
zmraul 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 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 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 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@@ -2,7 +2,7 @@ | ||
# See LICENSE file for licensing details. | ||
|
||
type: charm | ||
-base: [email protected] | ||
+base: [email protected] | ||
platforms: | ||
amd64: | ||
parts: |
This file contains 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 |
---|---|---|
|
@@ -2,13 +2,18 @@ | |
# See LICENSE file for licensing details. | ||
|
||
type: charm | ||
bases: | ||
- build-on: | ||
- name: "ubuntu" | ||
channel: "22.04" | ||
run-on: | ||
- name: "ubuntu" | ||
channel: "22.04" | ||
# base: [email protected] | ||
# platforms: | ||
# amd64: | ||
# Use upcoming ST124 syntax | ||
# To pack this charm, a temporary compatibility wrapper https://github.com/canonical/charmcraftst124 | ||
# is required until ST124 support is added to charmcraft | ||
# (ST124 syntax is needed to enable multi-base charms with Ubuntu 24.04. We use ST124 syntax across | ||
# all of our charms [even those that aren't multi base] for consistency and to simplify CI/CD | ||
# maintenance & tooling) | ||
platforms: | ||
[email protected]:amd64: | ||
[email protected]:amd64: | ||
parts: | ||
files: | ||
plugin: dump | ||
|
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -79,7 +79,7 @@ def __init__( | |
self.peer_relation = peer_relation | ||
self.jdk_path = jdk_path | ||
self.certs_path = certs_path | ||
self.keytool = self.jdk_path + "/bin/keytool" | ||
self.keytool = "opensearch.keytool" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that change and that this is now provided by the snap! |
||
self.certs = TLSCertificatesRequiresV3(charm, TLS_RELATION, expiry_notification_time=23) | ||
|
||
self.framework.observe( | ||
|
@@ -513,8 +513,6 @@ def _create_keystore_pwd_if_not_exists(self, scope: Scope, cert_type: CertType, | |
|
||
def store_new_ca(self, secrets: Dict[str, Any]) -> bool: # noqa: C901 | ||
"""Add new CA cert to trust store.""" | ||
keytool = f"sudo {self.jdk_path}/bin/keytool" | ||
|
||
if not (deployment_desc := self.charm.opensearch_peer_cm.deployment_desc()): | ||
return False | ||
|
||
|
@@ -532,7 +530,7 @@ def store_new_ca(self, secrets: Dict[str, Any]) -> bool: # noqa: C901 | |
|
||
try: | ||
run_cmd( | ||
f"""{keytool} -changealias \ | ||
f"""{self.keytool} -changealias \ | ||
-alias {alias} \ | ||
-destalias old-{alias} \ | ||
-keystore {store_path} \ | ||
|
@@ -549,13 +547,15 @@ def store_new_ca(self, secrets: Dict[str, Any]) -> bool: # noqa: C901 | |
): | ||
raise | ||
|
||
with tempfile.NamedTemporaryFile(mode="w+t") as ca_tmp_file: | ||
with tempfile.NamedTemporaryFile( | ||
mode="w+t", dir=self.charm.opensearch.paths.conf | ||
) as ca_tmp_file: | ||
Comment on lines
+550
to
+552
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 good change. Just for consideration: there is also a |
||
ca_tmp_file.write(secrets.get("ca-cert")) | ||
ca_tmp_file.flush() | ||
|
||
try: | ||
run_cmd( | ||
f"""{keytool} -importcert \ | ||
f"""{self.keytool} -importcert \ | ||
-trustcacerts \ | ||
-noprompt \ | ||
-alias {alias} \ | ||
|
@@ -604,7 +604,6 @@ def read_stored_ca(self, alias: str = "ca") -> Optional[str]: | |
|
||
def remove_old_ca(self) -> None: | ||
"""Remove old CA cert from trust store.""" | ||
keytool = f"sudo {self.jdk_path}/bin/keytool" | ||
ca_trust_store = f"{self.certs_path}/ca.p12" | ||
old_alias = "old-ca" | ||
|
||
|
@@ -613,7 +612,7 @@ def remove_old_ca(self) -> None: | |
|
||
try: | ||
run_cmd( | ||
f"""{keytool} \ | ||
f"""{self.keytool} \ | ||
-list \ | ||
-keystore {ca_trust_store} \ | ||
-storepass {store_pwd} \ | ||
|
@@ -628,7 +627,7 @@ def remove_old_ca(self) -> None: | |
old_ca_content = self.read_stored_ca(alias=old_alias) | ||
|
||
run_cmd( | ||
f"""{keytool} \ | ||
f"""{self.keytool} \ | ||
-delete \ | ||
-keystore {ca_trust_store} \ | ||
-storepass {store_pwd} \ | ||
|
@@ -672,12 +671,16 @@ def store_new_tls_resources(self, cert_type: CertType, secrets: Dict[str, Any]): | |
except OSError: | ||
pass | ||
|
||
tmp_key = tempfile.NamedTemporaryFile(mode="w+t", suffix=".pem") | ||
tmp_key = tempfile.NamedTemporaryFile( | ||
mode="w+t", suffix=".pem", dir=self.charm.opensearch.paths.conf | ||
) | ||
tmp_key.write(secrets.get("key")) | ||
tmp_key.flush() | ||
tmp_key.seek(0) | ||
|
||
tmp_cert = tempfile.NamedTemporaryFile(mode="w+t", suffix=".cert") | ||
tmp_cert = tempfile.NamedTemporaryFile( | ||
mode="w+t", suffix=".cert", dir=self.charm.opensearch.paths.conf | ||
) | ||
tmp_cert.write(secrets.get("cert")) | ||
tmp_cert.flush() | ||
tmp_cert.seek(0) | ||
|
@@ -714,7 +717,7 @@ def all_tls_resources_stored(self, only_unit_resources: bool = False) -> bool: | |
return False | ||
|
||
# to make sure the content is processed correctly by openssl, temporary store it in a file | ||
tmp_ca_file = tempfile.NamedTemporaryFile(mode="w+t") | ||
tmp_ca_file = tempfile.NamedTemporaryFile(mode="w+t", dir=self.charm.opensearch.paths.conf) | ||
tmp_ca_file.write(current_ca) | ||
tmp_ca_file.flush() | ||
tmp_ca_file.seek(0) | ||
|
@@ -819,12 +822,12 @@ def reload_tls_certificates(self): | |
# using the SSL API requires authentication with app-admin cert and key | ||
admin_secret = self.charm.secrets.get_object(Scope.APP, CertType.APP_ADMIN.val) | ||
|
||
tmp_cert = tempfile.NamedTemporaryFile(mode="w+t") | ||
tmp_cert = tempfile.NamedTemporaryFile(mode="w+t", dir=self.charm.opensearch.paths.conf) | ||
tmp_cert.write(admin_secret["cert"]) | ||
tmp_cert.flush() | ||
tmp_cert.seek(0) | ||
|
||
tmp_key = tempfile.NamedTemporaryFile(mode="w+t") | ||
tmp_key = tempfile.NamedTemporaryFile(mode="w+t", dir=self.charm.opensearch.paths.conf) | ||
tmp_key.write(admin_secret["key"]) | ||
tmp_key.flush() | ||
tmp_key.seek(0) | ||
|
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.
Maybe add some
# todo
comments here?