Skip to content

Commit

Permalink
Revert "TRON-1636: Setup tron secret_volumes in setup_tron_namespace" (
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmer05 authored Jul 19, 2023
1 parent 55bb7db commit cca03eb
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 228 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ example_cluster/paasta/docker_registry.json
general_itests/fake_etc_paasta/clusters.json
pip-wheel-metadata
debian/debhelper-build-stamp
unique-run

# Coverage artifacts
.coverage
2 changes: 1 addition & 1 deletion paasta_tools/cli/cmds/spark_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ def paasta_spark_run(args):
document = POD_TEMPLATE.format(
spark_pod_label=limit_size_with_hash(f"exec-{app_base_name}"),
)
parsed_pod_template = yaml.safe_load(document)
parsed_pod_template = yaml.load(document)
with open(pod_template_path, "w") as f:
yaml.dump(parsed_pod_template, f)

Expand Down
1 change: 0 additions & 1 deletion paasta_tools/cli/schemas/kubernetes_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@
},
"items": {
"type": "array",
"maxItems": 1,
"items": {
"type": "object",
"properties": {
Expand Down
45 changes: 0 additions & 45 deletions paasta_tools/cli/schemas/tron_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,51 +236,6 @@
},
"uniqueItems": true
},
"secret_volumes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"container_path": {
"type": "string"
},
"secret_name": {
"type": "string"
},
"default_mode": {
"type": "string"
},
"items": {
"type": "array",
"maxItems": 1,
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"path": {
"type": "string"
},
"mode": {
"type": "string"
}
},
"required": [
"key",
"path"
]
},
"uniqueItems": true
}
},
"required": [
"container_path",
"secret_name"
]
},
"uniqueItems": true
},
"cluster": {
"type": "string"
},
Expand Down
8 changes: 0 additions & 8 deletions paasta_tools/secret_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ def is_shared_secret(env_var_val: str) -> bool:
return env_var_val.startswith("SHARED_")


def is_shared_secret_from_secret_name(soa_dir: str, secret_name: str) -> bool:
"""Alternative way of figuring if a secret is shared, directly from the secret_name."""
secret_path = os.path.join(
soa_dir, SHARED_SECRET_SERVICE, "secrets", f"{secret_name}.json"
)
return os.path.isfile(secret_path)


def get_hmac_for_secret(
env_var_val: str, service: str, soa_dir: str, secret_environment: str
) -> Optional[str]:
Expand Down
33 changes: 0 additions & 33 deletions paasta_tools/tron_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from paasta_tools.utils import NoDeploymentsAvailable
from paasta_tools.utils import time_cache
from paasta_tools.utils import filter_templates_from_config
from paasta_tools.utils import TronSecretVolume
from paasta_tools.kubernetes_tools import (
allowlist_denylist_to_requirements,
create_or_find_service_account_name,
Expand All @@ -69,7 +68,6 @@
)
from paasta_tools.secret_tools import is_secret_ref
from paasta_tools.secret_tools import is_shared_secret
from paasta_tools.secret_tools import is_shared_secret_from_secret_name
from paasta_tools.secret_tools import get_secret_name_from_ref
from paasta_tools.kubernetes_tools import get_paasta_secret_name
from paasta_tools.secret_tools import SHARED_SECRET_SERVICE
Expand Down Expand Up @@ -415,40 +413,10 @@ def get_job_name(self):
def get_action_name(self):
return self.action

def get_secret_volumes(self) -> List[TronSecretVolume]: # type: ignore
"""Adds the secret_volume_name to the objet so tron/task_processing can load it downstream without replicating code."""
secret_volumes = super().get_secret_volumes()
return [
TronSecretVolume(
secret_volume_name=self.get_secret_volume_name(
secret_volume["secret_name"]
),
secret_name=secret_volume["secret_name"],
container_path=secret_volume["container_path"],
default_mode=secret_volume["default_mode"],
items=secret_volume["items"],
)
for secret_volume in secret_volumes
]

def get_namespace(self) -> str:
"""Get namespace from config, default to 'paasta'"""
return self.config_dict.get("namespace", KUBERNETES_NAMESPACE)

def get_secret_volume_name(self, secret_name: str) -> str:
service = (
self.service
if not is_shared_secret_from_secret_name(
soa_dir=self.soa_dir, secret_name=secret_name
)
else SHARED_SECRET_SERVICE
)
return get_paasta_secret_name(
self.get_namespace(),
service,
secret_name,
)

def get_deploy_group(self) -> Optional[str]:
return self.config_dict.get("deploy_group", None)

Expand Down Expand Up @@ -901,7 +869,6 @@ def format_tron_action_dict(action_config: TronActionConfig, use_k8s: bool = Fal
"node": action_config.get_node(),
"retries": action_config.get_retries(),
"retries_delay": action_config.get_retries_delay(),
"secret_volumes": action_config.get_secret_volumes(),
"expected_runtime": action_config.get_expected_runtime(),
"trigger_downstreams": action_config.get_trigger_downstreams(),
"triggered_by": action_config.get_triggered_by(),
Expand Down
4 changes: 0 additions & 4 deletions paasta_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@ class SecretVolume(TypedDict, total=False):
items: List[SecretVolumeItem]


class TronSecretVolume(SecretVolume, total=False):
secret_volume_name: str


class MonitoringDict(TypedDict, total=False):
alert_after: Union[str, float]
check_every: str
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ python-iptables==1.0.1
python-utils==2.0.1
pytimeparse==1.1.5
pytz==2016.10
pyyaml==6.0.1
pyyaml==5.4.1
repoze.lru==0.6
requests==2.25.0
requests-cache==0.6.3
Expand Down
Loading

0 comments on commit cca03eb

Please sign in to comment.