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

process gtps as soon they are applied #223

Conversation

shriramsharma
Copy link
Collaborator

Fixes #221 process gtps as soon they are applied

Signed-off-by: Shriram Sharma shriram_sharma@intuit.com

process gtps as soon they are applied

Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
@@ -243,3 +247,19 @@ func HandleEventForDeployment(event admiral.EventType, obj *k8sAppsV1.Deployment
// Use the same function as added deployment function to update and put new service entry in place to replace old one
modifyServiceEntryForNewServiceOrPod(event, env, globalIdentifier, remoteRegistry)
}

// HandleEventForGlobalTrafficPolicy processes all the events related to GTPs
func HandleEventForGlobalTrafficPolicy(event admiral.EventType, gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
func HandleEventForGlobalTrafficPolicy(event admiral.EventType, gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) {
func HandleEventForGlobalTrafficPolicy(event admiral.EventType, gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) error {

Copy link

Choose a reason for hiding this comment

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

wouldn't an error for error case would help the function ?

@@ -243,3 +247,19 @@ func HandleEventForDeployment(event admiral.EventType, obj *k8sAppsV1.Deployment
// Use the same function as added deployment function to update and put new service entry in place to replace old one
modifyServiceEntryForNewServiceOrPod(event, env, globalIdentifier, remoteRegistry)
}

// HandleEventForGlobalTrafficPolicy processes all the events related to GTPs
func HandleEventForGlobalTrafficPolicy(event admiral.EventType, gtp *v1.GlobalTrafficPolicy, remoteRegistry *RemoteRegistry, clusterName string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can a few test cases be added for HandleEventForGlobalTrafficPolicy?

Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
}

func (gtp *GlobalTrafficHandler) Updated(obj *v1.GlobalTrafficPolicy) {
log.Infof(LogFormat, "Updated", "globaltrafficpolicy", obj.Name, gtp.ClusterID, "received")
HandleEventForGlobalTrafficPolicy(admiral.Update, obj, gtp.RemoteRegistry, gtp.ClusterID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will an assignment of _ = HandleEventForGlobalTrafficPolicy(..) help to prevent warning from Github Actions?

Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
Signed-off-by: Shriram Sharma <shriram_sharma@intuit.com>
@shriramsharma shriramsharma merged commit c930be8 into istio-ecosystem:master Jun 13, 2022
@shriramsharma shriramsharma deleted the gtp_immediate_processing_221 branch June 13, 2022 18:19
psikka1 pushed a commit to psikka1/admiral that referenced this pull request Jun 15, 2022
Signed-off-by: psikka1 <pankaj_sikka@intuit.com>
asushanthk pushed a commit that referenced this pull request Jul 21, 2022
Signed-off-by: sa <sushanth_a@intuit.com>
asushanthk pushed a commit that referenced this pull request Jul 21, 2022
Signed-off-by: sa <sushanth_a@intuit.com>
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.

[FEATURE]: Need GlobalTrafficPolicy config to applied when the event occurs
3 participants