Skip to content

Commit

Permalink
feat: remove implementation of getting Nginx modules from image annot…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
nettoclaudio committed May 22, 2023
1 parent 240a93f commit d65aeb0
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 264 deletions.
10 changes: 0 additions & 10 deletions controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,19 +724,9 @@ func (r *RpaasInstanceReconciler) renderTemplate(ctx context.Context, instance *
return "", err
}

modules, err := r.ImageMetadata.Modules(ctx, plan.Spec.Image)
if err != nil {
return "", err
}

config := nginx.ConfigurationData{
Instance: instance,
Config: &plan.Spec.Config,
Modules: make(map[string]interface{}),
}

for _, mod := range modules {
config.Modules[mod] = nil
}

return cr.Render(config)
Expand Down
7 changes: 0 additions & 7 deletions controllers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1657,19 +1657,12 @@ func TestRpaasInstanceController_Reconcile_Suspended(t *testing.T) {
assert.Equal(t, "Warning RpaasInstanceSuspended no modifications will be done by RPaaS controller", <-fr.Events)
}

type fakeImageMetadata struct{}

func (i *fakeImageMetadata) Modules(ctx context.Context, img string) ([]string, error) {
return []string{"mod1"}, nil
}

func newRpaasInstanceReconciler(objs ...runtime.Object) *RpaasInstanceReconciler {
scheme := extensionsruntime.NewScheme()
return &RpaasInstanceReconciler{
Client: fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(objs...).Build(),
EventRecorder: record.NewFakeRecorder(1),
Log: ctrl.Log,
Scheme: scheme,
ImageMetadata: &fakeImageMetadata{},
}
}
2 changes: 0 additions & 2 deletions controllers/rpaasinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
extensionsv1alpha1 "github.com/tsuru/rpaas-operator/api/v1alpha1"
"github.com/tsuru/rpaas-operator/internal/controllers/certificates"
"github.com/tsuru/rpaas-operator/internal/pkg/rpaas/nginx"
"github.com/tsuru/rpaas-operator/internal/registry"
)

// RpaasInstanceReconciler reconciles a RpaasInstance object
Expand All @@ -36,7 +35,6 @@ type RpaasInstanceReconciler struct {
Log logr.Logger
Scheme *runtime.Scheme
EventRecorder record.EventRecorder
ImageMetadata registry.ImageMetadata
}

// +kubebuilder:rbac:groups="",resources=configmaps;persistentvolumeclaims;secrets;services,verbs=get;list;watch;create;update;delete
Expand Down
5 changes: 0 additions & 5 deletions internal/pkg/rpaas/nginx/configuration_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ var rawNginxConfiguration = `
{{- $all := . -}}
{{- $config := .Config -}}
{{- $instance := .Instance -}}
{{- $modules := .Modules -}}
# This file was generated by RPaaS (https://github.com/tsuru/rpaas-operator.git)
# Do not modify this file, any change will be lost.
Expand All @@ -295,11 +294,7 @@ user {{ . }};
worker_processes {{ . }};
{{- end }}
{{- range $mod, $_ := $modules }}
load_module "modules/{{ $mod }}.so";
{{- else }}
include modules/*.conf;
{{- end }}
{{ template "root" . }}
Expand Down
13 changes: 0 additions & 13 deletions internal/pkg/rpaas/nginx/configuration_render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,19 +518,6 @@ func TestRpaasConfigurationRenderer_Render(t *testing.T) {
\s+\}`, result)
},
},
{
name: "with custom modules",
data: ConfigurationData{
Config: &v1alpha1.NginxConfig{},
Instance: &v1alpha1.RpaasInstance{},
Modules: map[string]interface{}{"mod1": nil, "mod2": nil},
},
assertion: func(t *testing.T, result string) {
assert.NotRegexp(t, `include modules/\*\.conf;`, result)
assert.Regexp(t, `load_module "modules/mod1.so";`, result)
assert.Regexp(t, `load_module "modules/mod2.so";`, result)
},
},
{
name: "with custom log format",
data: ConfigurationData{
Expand Down
97 changes: 0 additions & 97 deletions internal/registry/image.go

This file was deleted.

128 changes: 0 additions & 128 deletions internal/registry/image_test.go

This file was deleted.

Loading

0 comments on commit d65aeb0

Please sign in to comment.