flake8
This commit is contained in:
parent
5d9d5435e8
commit
a9b476c326
@ -33,6 +33,7 @@ from stack_orchestrator.base import get_npm_registry_url
|
|||||||
# TODO: find a place for this
|
# TODO: find a place for this
|
||||||
# epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
|
# epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
|
||||||
|
|
||||||
|
|
||||||
def make_container_build_env(dev_root_path: str,
|
def make_container_build_env(dev_root_path: str,
|
||||||
container_build_dir: str,
|
container_build_dir: str,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
@ -122,6 +123,7 @@ def process_container(stack: str,
|
|||||||
else:
|
else:
|
||||||
print("Skipped")
|
print("Skipped")
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option('--include', help="only build these containers")
|
@click.option('--include', help="only build these containers")
|
||||||
@click.option('--exclude', help="don\'t build these containers")
|
@click.option('--exclude', help="don\'t build these containers")
|
||||||
|
@ -133,21 +133,27 @@ class ClusterInfo:
|
|||||||
|
|
||||||
def get_pvcs(self):
|
def get_pvcs(self):
|
||||||
result = []
|
result = []
|
||||||
volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map)
|
spec_volumes = self.spec.get_volumes()
|
||||||
|
named_volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map)
|
||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print(f"Volumes: {volumes}")
|
print(f"Spec Volumes: {spec_volumes}")
|
||||||
for volume_name in volumes:
|
print(f"Named Volumes: {named_volumes}")
|
||||||
|
for volume_name in spec_volumes:
|
||||||
|
if volume_name not in named_volumes:
|
||||||
|
if opts.o.debug:
|
||||||
|
print(f"{volume_name} not in pod files")
|
||||||
|
continue
|
||||||
spec = client.V1PersistentVolumeClaimSpec(
|
spec = client.V1PersistentVolumeClaimSpec(
|
||||||
access_modes=["ReadWriteOnce"],
|
access_modes=["ReadWriteOnce"],
|
||||||
storage_class_name="manual",
|
storage_class_name="manual",
|
||||||
resources=client.V1ResourceRequirements(
|
resources=client.V1ResourceRequirements(
|
||||||
requests={"storage": "2Gi"}
|
requests={"storage": "2Gi"}
|
||||||
),
|
),
|
||||||
volume_name=volume_name
|
volume_name=f"{self.app_name}-{volume_name}"
|
||||||
)
|
)
|
||||||
pvc = client.V1PersistentVolumeClaim(
|
pvc = client.V1PersistentVolumeClaim(
|
||||||
metadata=client.V1ObjectMeta(name=volume_name,
|
metadata=client.V1ObjectMeta(name=f"{self.app_name}-{volume_name}",
|
||||||
labels={"volume-label": volume_name}),
|
labels={"volume-label": f"{self.app_name}-{volume_name}"}),
|
||||||
spec=spec,
|
spec=spec,
|
||||||
)
|
)
|
||||||
result.append(pvc)
|
result.append(pvc)
|
||||||
@ -172,7 +178,7 @@ class ClusterInfo:
|
|||||||
data[f] = open(full_path, 'rt').read()
|
data[f] = open(full_path, 'rt').read()
|
||||||
|
|
||||||
spec = client.V1ConfigMap(
|
spec = client.V1ConfigMap(
|
||||||
metadata=client.V1ObjectMeta(name=cfg_map_name,
|
metadata=client.V1ObjectMeta(name=f"{self.app_name}-{cfg_map_name}",
|
||||||
labels={"configmap-label": cfg_map_name}),
|
labels={"configmap-label": cfg_map_name}),
|
||||||
data=data
|
data=data
|
||||||
)
|
)
|
||||||
@ -195,8 +201,8 @@ class ClusterInfo:
|
|||||||
host_path=client.V1HostPathVolumeSource(path=get_node_pv_mount_path(volume_name))
|
host_path=client.V1HostPathVolumeSource(path=get_node_pv_mount_path(volume_name))
|
||||||
)
|
)
|
||||||
pv = client.V1PersistentVolume(
|
pv = client.V1PersistentVolume(
|
||||||
metadata=client.V1ObjectMeta(name=volume_name,
|
metadata=client.V1ObjectMeta(name=f"{self.app_name}-{volume_name}",
|
||||||
labels={"volume-label": volume_name}),
|
labels={"volume-label": f"{self.app_name}-{volume_name}"}),
|
||||||
spec=spec,
|
spec=spec,
|
||||||
)
|
)
|
||||||
result.append(pv)
|
result.append(pv)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Copyright © 2023 Vulcanize
|
# Copyright © 2023 Vulcanize
|
||||||
import sys
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -13,6 +12,8 @@ import sys
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -163,7 +164,6 @@ class K8sDeployer(Deployer):
|
|||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print(f"No ingress configured")
|
print(f"No ingress configured")
|
||||||
|
|
||||||
|
|
||||||
def down(self, timeout, volumes):
|
def down(self, timeout, volumes):
|
||||||
self.connect_api()
|
self.connect_api()
|
||||||
# Delete the k8s objects
|
# Delete the k8s objects
|
||||||
|
@ -102,7 +102,8 @@ def volume_mounts_for_service(parsed_pod_files, service):
|
|||||||
volume_name = parts[0]
|
volume_name = parts[0]
|
||||||
mount_path = parts[1]
|
mount_path = parts[1]
|
||||||
mount_options = parts[2] if len(parts) == 3 else None
|
mount_options = parts[2] if len(parts) == 3 else None
|
||||||
volume_device = client.V1VolumeMount(mount_path=mount_path, name=volume_name, read_only="ro" == mount_options)
|
volume_device = client.V1VolumeMount(
|
||||||
|
mount_path=mount_path, name=volume_name, read_only="ro" == mount_options)
|
||||||
result.append(volume_device)
|
result.append(volume_device)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user