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

feat: add svc export trackability #1061

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

Conversation

britaniar
Copy link
Contributor

@britaniar britaniar commented Feb 28, 2025

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@britaniar britaniar force-pushed the svcExportTrackability branch 5 times, most recently from 87efd16 to e49aff2 Compare March 4, 2025 19:25
@britaniar britaniar marked this pull request as ready for review March 4, 2025 22:07
Copy link
Contributor

@ryanzhang-oss ryanzhang-oss left a comment

Choose a reason for hiding this comment

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

this should be separated into two PRs, one just for upgrade controller runtime and the other for serviceExport check

@britaniar
Copy link
Contributor Author

britaniar commented Mar 5, 2025

upgrade controller runtime changes are addressed in #1067 (will need to be merged before this)

@britaniar britaniar force-pushed the svcExportTrackability branch from 9b3574b to 593b6b3 Compare March 5, 2025 01:01
@britaniar britaniar force-pushed the svcExportTrackability branch from 593b6b3 to c47b06c Compare March 5, 2025 22:30
@britaniar britaniar force-pushed the svcExportTrackability branch from 74d71eb to 6b43ca2 Compare March 11, 2025 18:09

weight, err := objectmeta.ExtractWeightFromServiceExport(&svcExport)
if err != nil {
klog.V(2).InfoS("ServiceExport has invalid weight", "serviceExport", svcExportObj, "error", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
klog.V(2).InfoS("ServiceExport has invalid weight", "serviceExport", svcExportObj, "error", err)
klog.Errorf(err, "ServiceExport has invalid weight", "serviceExport", svcExportObj)

weight, err := objectmeta.ExtractWeightFromServiceExport(&svcExport)
if err != nil {
klog.V(2).InfoS("ServiceExport has invalid weight", "serviceExport", svcExportObj, "error", err)
return ManifestProcessingAvailabilityResultTypeFailed, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return ManifestProcessingAvailabilityResultTypeFailed, err
return ManifestProcessingAvailabilityResultTypeNotYetAvailable, err

ManifestProcessingAvailabilityResultTypeFailed means the checking the availability itself is failed.

return ManifestProcessingAvailabilityResultTypeNotYetAvailable, nil
}

weight := svcExport.Annotations[objectmeta.ServiceExportAnnotationWeight]
if weight != "0" {
weight, err := objectmeta.ExtractWeightFromServiceExport(&svcExport)
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add a comment here to indicate why we check the annotation here?

eg,
"Updating the annotation won't change the object generation, so the current status is not reliable and we validate the annotation again here."

Name: "test-svcExport",
Namespace: nsName,
Annotations: map[string]string{},
Generation: 3,
},
}

testCases := []struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

add a test if the weight annotation is invalid

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.

3 participants