Skip to content

Commit

Permalink
fix ep log
Browse files Browse the repository at this point in the history
  • Loading branch information
abbas-gheydi committed Sep 7, 2024
1 parent 3a489c2 commit 7d1f787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/controller/service/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (re *ReconcilerExtended) buildCNP() (cnp *ciliumv2.CiliumNetworkPolicy, err
cilium_policy_api.EntityWorld,
}

endpointSelector, err := getEndponitSelector(re.service.Spec.Selector)
endpointSelector, err := re.getEndponitSelector(re.service.Spec.Selector)
if err == nil {
cnp = &ciliumv2.CiliumNetworkPolicy{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -92,10 +92,10 @@ func (re *ReconcilerExtended) buildCNP() (cnp *ciliumv2.CiliumNetworkPolicy, err
// getEndponitSelector is used to filter and extract cilium endpoint selector from service labels.
//
//nolint:wsl
func getEndponitSelector(serviceSlector map[string]string) (ciliumEndPointSelector cilium_policy_api.EndpointSelector, err error) {
func (re *ReconcilerExtended) getEndponitSelector(serviceSlector map[string]string) (ciliumEndPointSelector cilium_policy_api.EndpointSelector, err error) {
identityLabels, informationLabels := cilium_labelsfilter.Filter(cilium_labels.Map2Labels(serviceSlector, cilium_labels.LabelSourceK8s))
if len(informationLabels.K8sStringMap()) != 0 {
log.Log.Info("excluded_labels", "information labels", informationLabels.String())
re.logger.Info("excluded_labels", "information labels", informationLabels.String())
}

identityLabelSelector := cilium_slim_metav1.LabelSelector{MatchLabels: identityLabels.K8sStringMap()}
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/service/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ func Test_getEndponitSelector(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotCiliumEndPointSelector, err := getEndponitSelector(tt.given)
re := &ReconcilerExtended{}
gotCiliumEndPointSelector, err := re.getEndponitSelector(tt.given)
if (err != nil) != tt.wantErr {
t.Errorf("getEndponitSelector() error = %v, wantErr %v", err, tt.wantErr)
return
Expand Down

0 comments on commit 7d1f787

Please sign in to comment.