Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

fix: update the target service deployment spec after the plugin execution #57

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

leoporoli
Copy link
Contributor

No description provided.

@@ -266,7 +265,7 @@ func applyPatch(
}

// if the service is an external service of the target service, it was already handled above
if lo.Contains(externalServices, service) && !lo.Contains(alreadyHandledExternalServices, service.ServiceID) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"alreadyHandledExternalServices" is never filled.
I think the service handled above doesn't fall under this condition because "lo.Contains" is comparing pointers and the service pointer has changed after that modification above

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still true after the new gateway support? let me check it

@@ -206,7 +204,8 @@ func applyPatch(
}

modifiedTargetService := DeepCopyService(targetService)
modifiedTargetService.DeploymentSpec = deploymentSpec
// TODO: find a better way to update deploymentSpec, this assumes there is only container in the pod
modifiedTargetService.DeploymentSpec.Template.Spec.Containers[0].Image = newImage
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the target service deployment spec could have been updated when executing the external plugins before these lines, for instance, there could be some env vars overwriting that we need to keep in the deployment spec.
The new image is the only value we need to maintain from the flow_patch.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should think on a MergeSpec(a Spec, b Spec) Spec function instead. Then we decide how to merge it inside the function (like a always take precedence)

@leoporoli leoporoli requested a review from lostbean September 27, 2024 17:41
Service: devServiceName,
DeploymentSpec: deploymentSpec,
Service: devServiceName,
Image: item.Image,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use the image instead of the spec?

@@ -266,7 +265,7 @@ func applyPatch(
}

// if the service is an external service of the target service, it was already handled above
if lo.Contains(externalServices, service) && !lo.Contains(alreadyHandledExternalServices, service.ServiceID) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still true after the new gateway support? let me check it

@@ -206,7 +204,8 @@ func applyPatch(
}

modifiedTargetService := DeepCopyService(targetService)
modifiedTargetService.DeploymentSpec = deploymentSpec
// TODO: find a better way to update deploymentSpec, this assumes there is only container in the pod
modifiedTargetService.DeploymentSpec.Template.Spec.Containers[0].Image = newImage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should think on a MergeSpec(a Spec, b Spec) Spec function instead. Then we decide how to merge it inside the function (like a always take precedence)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants