-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for getting instsance values yaml (spec), add create and get …
…instance scripts
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 deletions.
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,40 @@ | ||
import os | ||
import yaml | ||
from ckan_cloud_operator import kubectl | ||
from ckan_cloud_operator.providers.ckan.instance import manager as ckan_instance_manager | ||
|
||
|
||
instance_type = 'helm' | ||
|
||
instance_id = os.environ.get('INSTANCE_ID') | ||
|
||
instance_name = os.environ.get('INSTANCE_NAME') | ||
|
||
values_yaml = os.environ.get('VALUES_YAML') | ||
assert values_yaml | ||
values = yaml.load(values_yaml) | ||
|
||
exists_ok = os.environ.get('EXISTS_OK') | ||
exists_ok = exists_ok == 'yes' | ||
|
||
dry_run = os.environ.get('DRY_RUN') | ||
dry_run = dry_run == 'yes' | ||
|
||
update = os.environ.get('UPDATE') | ||
update = update == 'yes' | ||
|
||
wait_ready = os.environ.get('WAIT_READY') | ||
wait_ready = wait_ready == 'yes' | ||
|
||
|
||
instance_id = ckan_instance_manager.create( | ||
instance_type=instance_type, instance_id=instance_id, instance_name=instance_name, | ||
values=values, exists_ok=exists_ok, dry_run=dry_run | ||
) | ||
|
||
|
||
if update: | ||
if dry_run: | ||
raise Exception('dry run is not supported with update') | ||
else: | ||
ckan_instance_manager.update(instance_id, wait_ready=wait_ready) |
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,19 @@ | ||
import os | ||
import yaml | ||
from ckan_cloud_operator import kubectl | ||
from ckan_cloud_operator import logs | ||
from ckan_cloud_operator.providers.ckan.instance import manager as ckan_instance_manager | ||
|
||
|
||
instance_id_or_name = os.environ.get('INSTANCE_ID_OR_NAME') | ||
|
||
attr = os.environ.get('ATTR') | ||
|
||
with_spec = os.environ.get('WITH_SPEC') | ||
with_spec = with_spec == 'yes' | ||
|
||
|
||
logs.print_yaml_dump( | ||
ckan_instance_manager.get(instance_id_or_name=instance_id_or_name, attr=attr, with_spec=with_spec), | ||
exit_success=True | ||
) |