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

feat: update service asset to pass service name #430

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading