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

fix: add a kusion-control label in svc labels #510

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

SparkYuan
Copy link
Member

What type of PR is this?

/kind bug

What this PR does / why we need it:

add a kusion-control label in svc labels

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., design docs, usage docs, etc.:


@liu-hm19
Copy link
Contributor

liu-hm19 commented Sep 7, 2023

lgtm

@liu-hm19 liu-hm19 self-requested a review September 7, 2023 06:05
@liu-hm19 liu-hm19 merged commit 3bfeff3 into KusionStack:main Sep 7, 2023
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2023
if len(ports) == 0 {
return ErrEmptyPorts
}

Copy link
Contributor

Choose a reason for hiding this comment

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

If you don't want to render k8s service, should check the length of ports before new ports generator. If empty, don't new the generator.
Deleting the validation of ports length is not correct, cause the k8s service will still try to get generated but failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

If the ports are nil, the logic below will return immediately. I don't understand why this generator will fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

1, I don't know what is "the logic below" you refer to. Besides, what will get returned? an error, or an empty result?
2, If not k8s svc will get generated, why you new the ports generator? It will generate nothing. Add a judgement in “service generator" is much more concise and correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. The logic below this line. That means the logic in this function. This function will return nil if the ports are empty
  2. Yes, deliberately return before the validation function is more readable

@@ -163,16 +163,13 @@ func (g *portsGenerator) generateK8sSvc(public bool, ports []network.Port) *v1.S

// only support Aliyun SLB for now, and set SLB spec by default.
svc.Annotations[aliyunLBSpec] = aliyunSLBS1Small
svc.Labels[kusionControl] = "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

why you need to add this label? K8s Service will Inherit the label that Collaset/Deployment have, does they don't have the label of kusionControl?

Copy link
Member Author

Choose a reason for hiding this comment

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

This label is used to cooperate with the KAFE svc controller to implement gracefully rollout. The KAFE svc controller will only process svcs with this label and it is given in the svc sample before.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know this. But I want to know does this label is not attached to the KAFE workload, Collaset? Does it only need to attach to the service?
This label works only for KAFE system, should not get added under other situation.

Copy link
Member Author

Choose a reason for hiding this comment

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

It only works with the KAFE workload. We will move this label and all Aliyun-related labels to platform.k in the next version

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.

None yet

3 participants