-
Notifications
You must be signed in to change notification settings - Fork 71
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
add support for custom network provider (part A) #172
Conversation
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #172 +/- ##
==========================================
+ Coverage 43.87% 44.44% +0.56%
==========================================
Files 50 51 +1
Lines 5374 5560 +186
==========================================
+ Hits 2358 2471 +113
- Misses 2618 2666 +48
- Partials 398 423 +25
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1726d03
to
0e5bd2d
Compare
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
api/v1alpha1/trafficrouting_types.go
Outdated
@@ -149,6 +151,12 @@ type TrafficRoutingList struct { | |||
Items []TrafficRouting `json:"items"` | |||
} | |||
|
|||
type CustomNetworkRef struct { | |||
APIVersion string `json:"apiVersion,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the omitempty, because apiversion, kind, name always be not empty.
@@ -0,0 +1,306 @@ | |||
/* | |||
Copyright 2021. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2023 The Kruise Authors.
klog.Errorf("failed to store custom network provider %s/%s", obj.GetKind(), obj.GetName()) | ||
return err | ||
} | ||
klog.Infof("store custom network provider %s/%s success", obj.GetKind(), obj.GetName()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
store custom network provider(%s/%s) old configuration in annotations(%s) success, xx,xx,xx, OriginalSpecAnnotation.
7259ecf
to
16aacbb
Compare
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
lua_configuration/lua.go
Outdated
return fmt.Errorf("failed to walk path: %s", err.Error()) | ||
} | ||
dir := filepath.Dir(path) | ||
if _, err := os.Stat(filepath.Join(dir, "testdata")); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is testdata directory included in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testdata and lua scripts are not included in this PR. This function aims to convert testdata into lua objects. When the user wants to debug their lua scripts, they could use this function to generate lua objects and copy the generated objects to their lua scripts for debugging.
lua_configuration/lua.go
Outdated
@@ -0,0 +1,225 @@ | |||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this source file a UT? can we run it when building the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is more like a plugin to facilitate the development of Lua scripts.
newStatus.Phase = v1alpha1.TrafficRoutingPhaseHealthy | ||
newStatus.Message = "TrafficRouting is Healthy" | ||
newStatus.Phase = v1alpha1.TrafficRoutingPhaseInitial | ||
newStatus.Message = "TrafficRouting is Initializing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why changing routing to initializing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the status to Healthy works fine for gateway and ingress since they only check if the resource exists when initializing, however, for custom network providers, the original configuration is stored in annotation in initialization, and the annotation will be removed after finalising, without this annotation, customController can't do EnsureRoutes(). So it is necessary to first initialize after finalising, or next time customController will not work.
Signed-off-by: Kuromesi <[email protected]>
@@ -0,0 +1,337 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mv the custom/custom.go to customNetworkProvider/custom_network_provider.go
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
Signed-off-by: Kuromesi <[email protected]>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zmberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Ⅰ. Describe what this PR does
add support for custom network provider
Ⅱ. Does this pull request fix one issue?
Ⅲ. Special notes for reviews