armory / spinnaker-operator

Open Source Spinnaker Kubernetes Operator source code
Apache License 2.0
186 stars 71 forks source link

Operator not properly parsing version in SpinnakerService object #251

Closed villasenor closed 1 year ago

villasenor commented 2 years ago

First, I should note that I'm using Kubernetes 1.23.1. The Spinnaker Operator master branch currently will not deploy on 1.23.1, so I'm using this PR branch: https://github.com/armory/spinnaker-operator/pull/250

Other than that, everything is standard.

Following this guide: https://github.com/armory/spinnaker-operator#example-1-basic-install

I constructed a SpinnakerService that looks like this:

apiVersion: spinnaker.io/v1alpha2
kind: SpinnakerService
metadata:
  name: spinnaker
spec:
  spinnakerConfig:
    config:
      version: 1.26.7
      persistentStorage:
        persistentStoreType: s3
        s3:
          bucket: spinnaker
          rootFolder: front50
          endpoint: minio-service
          accessKeyID: [REDACTED]
          secretAccessKey: [REDACTED]
  # spec.expose - This section defines how Spinnaker should be publicly exposed
  expose:
    type: service  # Kubernetes LoadBalancer type (service/ingress), note: only "service" is supported for now
    service:
      type: LoadBalancer

However, no matter what I do, the operator still thinks I haven't set a version. I tried to track down the offending code, but I got lost. Any help here would be much appreciated!

Operator error logs:

spinnaker-operator {"level":"info","ts":1646453687.8882375,"logger":"spinnakerservice","msg":"reconciling SpinnakerService","Request.Namespace":"spinnaker │
│ -operator","Request.Name":"spinnaker"}                                                                                                                     │
│ spinnaker-operator {"level":"info","ts":1646453687.8883622,"logger":"spinnakerservice","msg":"checking spindeploy deployment","Request.Namespace":"spinnak │
│ er-operator","Request.Name":"spinnaker"}                                                                                                                   │
│ spinnaker-operator {"level":"info","ts":1646453687.8884337,"logger":"spinnakerservice","msg":"*config.changeDetector detected a change that needs to be re │
│ conciled","Service":"spinnaker"}                                                                                                                           │
│ halyard 2022-03-05 04:09:20.179  INFO 1 --- [nio-8064-exec-4] c.n.s.h.d.d.v1.ManifestGenerator         : Parsing Halyard config                            │
│ spinnaker-operator {"level":"info","ts":1646453687.8884614,"logger":"spinnakerservice","msg":"retrieving complete Spinnaker configuration","Service":"spin │
│ naker"}                                                                                                                                                    │
│ halyard 2022-03-05 04:14:47.904  INFO 1 --- [nio-8064-exec-5] c.n.s.h.d.d.v1.ManifestGenerator         : Preparing Halyard configuration from incoming req │
│ uest                                                                                                                                                       │
│ spinnaker-operator {"level":"info","ts":1646453687.8884947,"logger":"spinnakerservice","msg":"Unable to retrieve version from config, ignoring error","Ser │
│ vice":"spinnaker"}                                                                                                                                         │
│ spinnaker-operator {"level":"info","ts":1646453687.888527,"logger":"spinnakerservice","msg":"applying options to Spinnaker config with 13 generators","Ser │
│ vice":"spinnaker"}                                                                                                                                         │
│ halyard 2022-03-05 04:14:47.966  INFO 1 --- [nio-8064-exec-5] c.n.s.h.d.d.v1.ManifestGenerator         : Parsing Halyard config                            │
│ spinnaker-operator {"level":"info","ts":1646453687.8885875,"logger":"spinnakerservice","msg":"Setting spin-gate overrideBaseUrl to: "}                     │
│ spinnaker-operator {"level":"info","ts":1646453687.8886254,"logger":"spinnakerservice","msg":"Setting spin-deck overrideBaseUrl to: "}                     │
│ spinnaker-operator {"level":"info","ts":1646453687.8886888,"logger":"spinnakerservice","msg":"generating manifests with Halyard","Service":"spinnaker"}    │
│ spinnaker-operator {"level":"error","ts":1646453688.006892,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"spinnakerservic │
│ e-controller","request":"spinnaker-operator/spinnaker","error":"You must pick a version of Spinnaker to deploy.","stacktrace":"github.com/go-logr/zapr.(*z │
│ apLogger).Error\n\t/opt/spinnaker-operator/build/vendor/github.com/go-logr/zapr/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Cont │
│ roller).reconcileHandler\n\t/opt/spinnaker-operator/build/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:218\nsigs.k8s.io/con │
│ troller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/opt/spinnaker-operator/build/vendor/sigs.k8s.io/controller-runtime/pkg/inter │
│ nal/controller/controller.go:192\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/opt/spinnaker-operator/build/vendor/sigs │
│ .k8s.io/controller-runtime/pkg/internal/controller/controller.go:171\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/opt/spinnaker-operator/build │
│ /vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/opt/spinnaker-operator/build/vendor/k8s.io/apimac │
│ hinery/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/opt/spinnaker-operator/build/vendor/k8s.io/apimachinery/pkg/util/wait/wait.g │
│ o:88"}
prom3theu5 commented 2 years ago

Did you get to the bottom of this, also facing same issue, as well as using same branch as you (k3s by any chance?)

villasenor commented 2 years ago

I haven't had a chance to come back to it yet @prom3theu5, but glad I'm not the only one seeing this! My guess is that the changes made in the branch fixed it enough for the Kubernetes API to not flat out reject the config, but the operator likely needs some code changes to parse the new config format properly. For what it's worth, I don't think k8s vs k3s should make a difference here as k3s is a Certified Kubernetes distribution :)

dogonthehorizon commented 1 year ago

@villasenor or @prom3theu5 are you still facing this issue with the most recent release we made of the Operator (1.3.0 at the time of this writing)?

villasenor commented 1 year ago

I don't have the test env setup for this anymore. Was there a specific code change you made that you feel could have fixed this issue @dogonthehorizon?

kyledmitchell commented 1 year ago

Hi @villasenor. A new version of Operator was released by Armory (the company @dogonthehorizon and I work for). That new version included code changes that we anticipate would have fixed your problem.

villasenor commented 1 year ago

I see. Well if I get around to trying this scenario again I'll definitely report back here! Thanks!

dogonthehorizon commented 1 year ago

Sounds great, thanks @villasenor ! We'll close this issue for now but if you do still run into this issue please re-open or file a new issue :D