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: Handle VS hosts nil #265

Merged
merged 2 commits into from
Nov 9, 2022
Merged

fix: Handle VS hosts nil #265

merged 2 commits into from
Nov 9, 2022

Conversation

itsLucario
Copy link
Collaborator

@itsLucario itsLucario commented Nov 7, 2022

VS hosts field is an optional field in Istio's VirtualService CRD spec. It'll be nil when we want to create a delegate Virtual Service.
The fix will do a nil check and if the VS hosts are nil, the admiral will replicate the VS resource as it is within all the clusters.

Signed-off-by: nbn01 <nandan_bn@intuit.com>
if err != nil {
if k8sErrors.IsNotFound(err) {
log.Infof(LogFormat, "Delete", "VirtualService", obj.Name, clusterId, "Either VirtualService was already deleted, or it never existed")
if virtualService.Hosts != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its better to check the length of the slice, because if an empty []string is assigned to virtualService.Hosts then it will not be nil.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, Right!! I've updated

Signed-off-by: nbn01 <nandan_bn@intuit.com>
Copy link
Contributor

@aattuluri aattuluri left a comment

Choose a reason for hiding this comment

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

lgtm

@itsLucario itsLucario merged commit 13daaf0 into master Nov 9, 2022
@itsLucario itsLucario deleted the vs-nil-check-patch branch November 9, 2022 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants