Uploaded image for project: 'Maistra'
  1. Maistra
  2. MAISTRA-1982

Specifying an invalid global.logging.level causes v1 conversion to panic

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • maistra-2.0.0
    • None
    • None
    • None
    • MAISTRA 2.0.0

      If the .global.logging.level is set to an invalid value this causes the conversion to panic within the operator as it assumes a format of <scope>:<level> and does not validate.

      For example

      logging:
        level:info
      

      leads to the following panic

      {"level":"info","ts":1604622447.586733,"logger":"smcp-mutator","msg":"Setting .spec.profiles to default value","ServiceMeshControlPlane":"istio-system/auth","profiles":["default"]}
      2020/11/06 00:27:27 http: panic serving 10.128.0.1:39596: runtime error: index out of range [1] with length 1
      goroutine 24186 [running]:
      net/http.(*conn).serve.func1(0xc001e3cc80)
      	/usr/lib/golang/src/net/http/server.go:1800 +0x139
      panic(0x1878ce0, 0xc0009a32e0)
      	/usr/lib/golang/src/runtime/panic.go:975 +0x3e3
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.componentLogLevelsFromString(0xc004ea2eac, 0x4, 0x14)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/logging.go:65 +0x1d3
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.populateControlPlaneLoggingConfig(0xc004c56998, 0xc001a30418, 0x0, 0x100)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/logging.go:75 +0x1ec
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.populateGeneralConfig(0xc004c56998, 0xc001a30418, 0x0, 0x0)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/general.go:28 +0x39
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.Convert_v1_ControlPlaneSpec_To_v2_ControlPlaneSpec(0xc007f9a358, 0xc001a30418, 0x0, 0x0, 0x17a59e0, 0x193c7c0)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/conversion_v1_to_v2.go:98 +0x276
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.autoConvert_v1_ServiceMeshControlPlane_To_v2_ServiceMeshControlPlane(0xc007f9a240, 0xc001a30300, 0x0, 0x0, 0x40a155, 0x17a59e0)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/zz_generated.conversion.go:118 +0x8f
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.Convert_v1_ServiceMeshControlPlane_To_v2_ServiceMeshControlPlane(...)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/zz_generated.conversion.go:129
      github.com/maistra/istio-operator/pkg/apis/maistra/conversion.init.0.func1(0x1bdab80, 0xc007f9a240, 0x1bdad80, 0xc001a30300, 0xc001a30300, 0xc0009a2100)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/conversion/controller.go:22 +0xee
      github.com/maistra/istio-operator/pkg/apis/maistra/v1.(*ServiceMeshControlPlane).ConvertTo(0xc007f9a240, 0x1bfa940, 0xc001a30300, 0x1bfa940, 0xc001a30300)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/pkg/apis/maistra/v1/conversion.go:17 +0x84
      sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).convertObject(0xc0006498f0, 0x1bdab80, 0xc007f9a240, 0x1bdad80, 0xc001a30300, 0x1bdad80, 0xc001a30300)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/conversion/conversion.go:144 +0x6f8
      sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).handleConvertRequest(0xc0006498f0, 0xc006c2ff00, 0xc0070e9e00, 0x0, 0x0)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/conversion/conversion.go:107 +0x1f8
      sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*Webhook).ServeHTTP(0xc0006498f0, 0x1c09100, 0xc000203880, 0xc00713a200)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/conversion/conversion.go:74 +0x10b
      sigs.k8s.io/controller-runtime/pkg/webhook.instrumentedHook.func1(0x1c09100, 0xc000203880, 0xc00713a200)
      	/builddir/build/BUILD/OPERATOR/src/github.com/maistra/istio-operator/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/server.go:129 +0xec
      net/http.HandlerFunc.ServeHTTP(0xc0005ccff0, 0x1c09100, 0xc000203880, 0xc00713a200)
      	/usr/lib/golang/src/net/http/server.go:2041 +0x44
      net/http.(*ServeMux).ServeHTTP(0xc0007708c0, 0x1c09100, 0xc000203880, 0xc00713a200)
      	/usr/lib/golang/src/net/http/server.go:2416 +0x1a5
      net/http.serverHandler.ServeHTTP(0xc0009520e0, 0x1c09100, 0xc000203880, 0xc00713a200)
      	/usr/lib/golang/src/net/http/server.go:2836 +0xa3
      net/http.(*conn).serve(0xc001e3cc80, 0x1c0d840, 0xc006c2fc40)
      	/usr/lib/golang/src/net/http/server.go:1924 +0x86c
      created by net/http.(*Server).Serve
      	/usr/lib/golang/src/net/http/server.go:2962 +0x35c
      

        1. smcp.yaml
          2 kB
          Kevin Conner

              mluksa@redhat.com Marko Luksa
              kconner@redhat.com Kevin Conner (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: