Skip to content

Commit

Permalink
working upgrade (vmware#1330)
Browse files Browse the repository at this point in the history
Signed-off-by: ltimothy7 <66969084+ltimothy7@users.noreply.github.com>
  • Loading branch information
ltimothy7 authored Mar 31, 2022
1 parent 7014748 commit 5a7d516
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions container_service_extension/rde/models/rde_2_1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,14 @@ def from_native_entity(cls, native_entity: AbstractNativeEntity):
else:
# Upgrade RDE 2.0 -> 2.1
# Ensure settings.cni is deprecated
upgraded_native_entity = NativeEntity(native_entity.to_dict())
if not upgraded_native_entity.spec.settings.network.cni: # noqa: E501
upgraded_native_entity = cls(
metadata=native_entity.metadata,
spec=native_entity.spec,
status=native_entity.status,
kind=native_entity.kind,
api_version=rde_constants.PAYLOAD_VERSION_2_1
)
if upgraded_native_entity.spec.settings.network.cni is not None: # noqa: E501
cni_version_list = upgraded_native_entity.spec.settings.network.cni.split() # noqa: E501
upgraded_native_entity.spec.settings.cni.name = cni_version_list[0] # noqa: E501
if len(cni_version_list) > 1:
Expand Down

0 comments on commit 5a7d516

Please sign in to comment.