Skip to content

Commit

Permalink
Merge pull request #430 from redhatrises/update_service
Browse files Browse the repository at this point in the history
feat: update service asset to pass service name
  • Loading branch information
redhatrises authored Oct 6, 2023
2 parents b6b1dd0 + b6c05cc commit e68f259
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 160 deletions.
23 changes: 0 additions & 23 deletions controllers/falcon_container/ecr.go

This file was deleted.

132 changes: 0 additions & 132 deletions controllers/falcon_container/image_refresher.go

This file was deleted.

2 changes: 1 addition & 1 deletion controllers/falcon_container/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

func (r *FalconContainerReconciler) reconcileService(ctx context.Context, log logr.Logger, falconContainer *falconv1alpha1.FalconContainer) (*corev1.Service, error) {
selector := map[string]string{common.FalconComponentKey: common.FalconSidecarSensor}
service := assets.Service(injectorName, r.Namespace(), common.FalconSidecarSensor, selector, *falconContainer.Spec.Injector.ListenPort)
service := assets.Service(injectorName, r.Namespace(), common.FalconSidecarSensor, selector, common.FalconServiceHTTPSName, *falconContainer.Spec.Injector.ListenPort)
updated := false
existingService := &corev1.Service{}

Expand Down
4 changes: 2 additions & 2 deletions internal/controller/assets/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// Service returns a Kubernetes Service object
func Service(name string, namespace string, component string, selector map[string]string, port int32) *corev1.Service {
func Service(name string, namespace string, component string, selector map[string]string, portName string, port int32) *corev1.Service {
labels := common.CRLabels("service", name, component)
return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -24,7 +24,7 @@ func Service(name string, namespace string, component string, selector map[strin
Selector: selector,
Ports: []corev1.ServicePort{
{
Name: common.FalconServiceHTTPSName,
Name: portName,
Port: port,
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromString(common.FalconServiceHTTPSName),
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/assets/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestService(t *testing.T) {
Selector: selector,
Ports: []corev1.ServicePort{
{
Name: common.FalconServiceHTTPSName,
Name: "portName",
Port: 123,
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromString(common.FalconServiceHTTPSName),
Expand All @@ -36,7 +36,7 @@ func TestService(t *testing.T) {
},
}

got := Service("test", "test", "test", selector, 123)
got := Service("test", "test", "test", selector, "portName", 123)
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("Service() mismatch (-want +got): %s", diff)
}
Expand Down

0 comments on commit e68f259

Please sign in to comment.