Skip to content
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

Revert "Don't modify resource names when generating sidecar pod spec" #90

Merged
merged 2 commits into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flytekit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import
import flytekit.plugins

__version__ = '0.5.2'
__version__ = '0.5.3'
4 changes: 2 additions & 2 deletions flytekit/common/tasks/sidecar_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def reconcile_partial_pod_spec_and_task(self,
resource_requirements = _lazy_k8s.io.api.core.v1.generated_pb2.ResourceRequirements()
for resource in self._container.resources.limits:
resource_requirements.limits[
_core_task.Resources.ResourceName.Name(resource.name)].CopyFrom(
_core_task.Resources.ResourceName.Name(resource.name).lower()].CopyFrom(
_lazy_k8s.io.apimachinery.pkg.api.resource.generated_pb2.Quantity(string=resource.value))
for resource in self._container.resources.requests:
resource_requirements.requests[
_core_task.Resources.ResourceName.Name(resource.name)].CopyFrom(
_core_task.Resources.ResourceName.Name(resource.name).lower()].CopyFrom(
_lazy_k8s.io.apimachinery.pkg.api.resource.generated_pb2.Quantity(string=resource.value))
if resource_requirements.ByteSize():
# Important! Only copy over resource requirements if they are non-empty.
Expand Down
4 changes: 2 additions & 2 deletions tests/flytekit/unit/sdk/tasks/test_sidecar_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_sidecar_task():
'{{.outputPrefix}}']
assert primary_container['volumeMounts'] == [{'mountPath': 'some/where', 'name': 'volume mount'}]
assert {'name': 'foo', 'value': 'bar'} in primary_container['env']
assert primary_container['resources'] == {'requests': {'CPU': {'string': '10'}},
'limits': {'GPU': {'string': '2'}}}
assert primary_container['resources'] == {'requests': {'cpu': {'string': '10'}},
'limits': {'gpu': {'string': '2'}}}
assert pod_spec['containers'][1]['name'] == 'another container'
assert simple_sidecar_task.custom['primaryContainerName'] == 'a container'