@@ -761,27 +761,35 @@ func (proxier *Proxier) isInitialized() bool {
761
761
return atomic .LoadInt32 (& proxier .initialized ) > 0
762
762
}
763
763
764
+ // OnServiceAdd is called whenever creation of new service object
765
+ // is observed.
764
766
func (proxier * Proxier ) OnServiceAdd (service * v1.Service ) {
765
767
namespacedName := types.NamespacedName {Namespace : service .Namespace , Name : service .Name }
766
768
if proxier .serviceChanges .update (& namespacedName , nil , service , proxier .hns ) && proxier .isInitialized () {
767
769
proxier .Sync ()
768
770
}
769
771
}
770
772
773
+ // OnServiceUpdate is called whenever modification of an existing
774
+ // service object is observed.
771
775
func (proxier * Proxier ) OnServiceUpdate (oldService , service * v1.Service ) {
772
776
namespacedName := types.NamespacedName {Namespace : service .Namespace , Name : service .Name }
773
777
if proxier .serviceChanges .update (& namespacedName , oldService , service , proxier .hns ) && proxier .isInitialized () {
774
778
proxier .Sync ()
775
779
}
776
780
}
777
781
782
+ // OnServiceDelete is called whenever deletion of an existing service
783
+ // object is observed.
778
784
func (proxier * Proxier ) OnServiceDelete (service * v1.Service ) {
779
785
namespacedName := types.NamespacedName {Namespace : service .Namespace , Name : service .Name }
780
786
if proxier .serviceChanges .update (& namespacedName , service , nil , proxier .hns ) && proxier .isInitialized () {
781
787
proxier .Sync ()
782
788
}
783
789
}
784
790
791
+ // OnServiceSynced is called once all the initial event handlers were
792
+ // called and the state is fully propagated to local cache.
785
793
func (proxier * Proxier ) OnServiceSynced () {
786
794
proxier .mu .Lock ()
787
795
proxier .servicesSynced = true
@@ -836,27 +844,35 @@ func (proxier *Proxier) updateServiceMap() (result updateServiceMapResult) {
836
844
return result
837
845
}
838
846
847
+ // OnEndpointsAdd is called whenever creation of new endpoints object
848
+ // is observed.
839
849
func (proxier * Proxier ) OnEndpointsAdd (endpoints * v1.Endpoints ) {
840
850
namespacedName := types.NamespacedName {Namespace : endpoints .Namespace , Name : endpoints .Name }
841
851
if proxier .endpointsChanges .update (& namespacedName , nil , endpoints , proxier .hns ) && proxier .isInitialized () {
842
852
proxier .Sync ()
843
853
}
844
854
}
845
855
856
+ // OnEndpointsUpdate is called whenever modification of an existing
857
+ // endpoints object is observed.
846
858
func (proxier * Proxier ) OnEndpointsUpdate (oldEndpoints , endpoints * v1.Endpoints ) {
847
859
namespacedName := types.NamespacedName {Namespace : endpoints .Namespace , Name : endpoints .Name }
848
860
if proxier .endpointsChanges .update (& namespacedName , oldEndpoints , endpoints , proxier .hns ) && proxier .isInitialized () {
849
861
proxier .Sync ()
850
862
}
851
863
}
852
864
865
+ // OnEndpointsDelete is called whenever deletion of an existing endpoints
866
+ // object is observed.
853
867
func (proxier * Proxier ) OnEndpointsDelete (endpoints * v1.Endpoints ) {
854
868
namespacedName := types.NamespacedName {Namespace : endpoints .Namespace , Name : endpoints .Name }
855
869
if proxier .endpointsChanges .update (& namespacedName , endpoints , nil , proxier .hns ) && proxier .isInitialized () {
856
870
proxier .Sync ()
857
871
}
858
872
}
859
873
874
+ // OnEndpointsSynced is called once all the initial event handlers were
875
+ // called and the state is fully propagated to local cache.
860
876
func (proxier * Proxier ) OnEndpointsSynced () {
861
877
proxier .mu .Lock ()
862
878
proxier .endpointsSynced = true
0 commit comments