Skip to content

Commit

Permalink
Don't modify resource names when generating sidecar pod spec (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
katrogan authored Mar 5, 2020
1 parent 49aa8ec commit 4c0e1d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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.1'
__version__ = '0.5.2'
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).lower()].CopyFrom(
_core_task.Resources.ResourceName.Name(resource.name)].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).lower()].CopyFrom(
_core_task.Resources.ResourceName.Name(resource.name)].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'

0 comments on commit 4c0e1d1

Please sign in to comment.