Gitlab-Pages externalHttps Causes CrashLoop in Operator

Summary

When global.pages.externalHttps has a value the controller will crash on Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-gitlab-pages-custom-domains"}

Steps to reproduce

Setting any ip address in externalHttps[], will cause the controller to fail and crash loop.

spec:
  chart:
    values:
      global:
        pages:
          enabled: true
          externalHttps:
          - 10.0.0.1

Configuration used

spec:
  chart:
    values:
      global:
        pages:
          enabled: true
          externalHttps:
          - 10.0.0.1

Current behavior

Operator fails and crashloops.

Expected behavior

Operator should be able to support , and not crash when externalHttps is set.

Versions

  • Operator: 0.8.1
  • Platform:
    • Cloud: Openstack
  • Kubernetes: (kubectl version)
    • Client: v1.24.0
    • Server: v1.23.7

Relevant logs

gitlabctl.PagesService(template) should be gitlabctl.PagesDomainsService(template) according to pkg.go.dev/github.com/xanzy/go-gitlab

2022-06-28T05:49:13.668Z DEBUG template The template is rendered. Check the warnings (if any). {"namespace": "gitlab-system", "releaseName": "gitlab", "hash": "1fb7a87c9855fad5", "warnings": 0} 2022-06-28T05:49:13.668Z DEBUG template Caching the template. {"namespace": "gitlab-system", "releaseName": "gitlab", "hash": "1fb7a87c9855fad5"} 2022-06-28T05:49:13.922Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-shared-secrets"} 2022-06-28T05:49:13.928Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Job", "reference": "gitlab-system/gitlab-shared-secrets-1-eht"} 2022-06-28T05:49:13.928Z DEBUG controllers.GitLab Creating object {"gitlab": "gitlab.gitlab-system", "type": "*v1.Job", "reference": "gitlab-system/gitlab-shared-secrets-1-eht"} 2022-06-28T05:49:13.984Z LEVEL(-2) controllers.GitLab Checking the status of Job {"gitlab": "gitlab.gitlab-system", "job": "gitlab-shared-secrets-1-eht", "namespace": "gitlab-system"} 2022-06-28T05:50:02.007Z LEVEL(-2) controllers.GitLab Job succeeded {"gitlab": "gitlab.gitlab-system", "job": "gitlab-shared-secrets-1-eht", "namespace": "gitlab-system"} 2022-06-28T05:50:02.007Z INFO controllers.GitLab self-signed certificates job skipped, not needed per configuration {"gitlab": "gitlab.gitlab-system"} 2022-06-28T05:50:02.008Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-postgresql-init-db"} 2022-06-28T05:50:02.011Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.StatefulSet", "reference": "gitlab-system/gitlab-postgresql"} 2022-06-28T05:50:02.169Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-postgresql-headless"} 2022-06-28T05:50:02.263Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-postgresql"} 2022-06-28T05:50:02.265Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-postgresql-metrics"} 2022-06-28T05:50:02.268Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-redis-scripts"} 2022-06-28T05:50:02.270Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-redis-health"} 2022-06-28T05:50:02.272Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-redis"} 2022-06-28T05:50:02.273Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.StatefulSet", "reference": "gitlab-system/gitlab-redis-master"} 2022-06-28T05:50:02.364Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-redis-headless"} 2022-06-28T05:50:02.366Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-redis-metrics"} 2022-06-28T05:50:02.368Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-redis-master"} 2022-06-28T05:50:02.369Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-gitaly"} 2022-06-28T05:50:02.371Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.StatefulSet", "reference": "gitlab-system/gitlab-gitaly"} 2022-06-28T05:50:02.961Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-gitaly"} 2022-06-28T05:50:03.068Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-gitlab-shell"} 2022-06-28T05:50:03.070Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-nginx-ingress-tcp"} 2022-06-28T05:50:03.071Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-gitlab-shell-sshd"} 2022-06-28T05:50:03.187Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-gitlab-shell"} 2022-06-28T05:50:03.205Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-gitlab-shell"} 2022-06-28T05:50:03.260Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-registry"} 2022-06-28T05:50:03.262Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-registry"} 2022-06-28T05:50:03.272Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-registry"} 2022-06-28T05:50:03.274Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Ingress", "reference": "gitlab-system/gitlab-registry"} 2022-06-28T05:50:03.367Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-toolbox"} 2022-06-28T05:50:03.369Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-toolbox"} 2022-06-28T05:50:03.462Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-gitlab-exporter"} 2022-06-28T05:50:03.464Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-gitlab-exporter"} 2022-06-28T05:50:03.478Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-gitlab-exporter"} 2022-06-28T05:50:03.561Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.ConfigMap", "reference": "gitlab-system/gitlab-gitlab-pages"} 2022-06-28T05:50:03.563Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Deployment", "reference": "gitlab-system/gitlab-gitlab-pages"} 2022-06-28T05:50:03.573Z LEVEL(-2) controllers.GitLab Setting controller reference {"gitlab": "gitlab.gitlab-system", "type": "*v1.Service", "reference": "gitlab-system/gitlab-gitlab-pages-custom-domains"} 2022-06-28T05:50:03.575Z INFO controllers.GitLab Controller is not able to delete managed resources. This is a known issue {"gitlab": "gitlab.gitlab-system"} panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0x137f8c2]

goroutine 440 [running]: sigs.k8s.io/controller-runtime/pkg/client.ObjectKeyFromObject(0x0, 0x0, 0x49, 0xc003f960e0, 0x2, 0x2) /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/client/interfaces.go:35 +0x22 gitlab.com/gitlab-org/cloud-native/gitlab-operator/controllers.(*GitLabReconciler).createOrPatch(0xc001cc6040, 0x22bfc88, 0xc002816420, 0x0, 0x0, 0x22dcb48, 0xc002816fc0, 0x1, 0x0, 0x0) /workspace/controllers/gitlab_controller.go:559 +0x5f gitlab.com/gitlab-org/cloud-native/gitlab-operator/controllers.(*GitLabReconciler).reconcilePagesService(0xc001cc6040, 0x22bfc88, 0xc002816420, 0x22dcb48, 0xc002816fc0, 0x22da188, 0xc00439c5a0, 0x0, 0x0) /workspace/controllers/pages.go:67 +0x8c gitlab.com/gitlab-org/cloud-native/gitlab-operator/controllers.(*GitLabReconciler).reconcilePages(0xc001cc6040, 0x22bfc88, 0xc002816420, 0x22dcb48, 0xc002816fc0, 0x22da188, 0xc00439c5a0, 0x0, 0x0) /workspace/controllers/pages.go:23 +0x1a5 gitlab.com/gitlab-org/cloud-native/gitlab-operator/controllers.(*GitLabReconciler).Reconcile(0xc001cc6040, 0x22bfc88, 0xc002816420, 0xc001890a80, 0xd, 0xc001890b10, 0x6, 0xc002816420, 0xc002816390, 0xc001871db0, ...) /workspace/controllers/gitlab_controller.go:237 +0x1e98 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0xc001dc41e0, 0x22bfc88, 0xc002816390, 0xc001890a80, 0xd, 0xc001890b10, 0x6, 0xc002816300, 0x0, 0x0, ...) /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/internal/controller/controller.go:114 +0x247 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc001dc41e0, 0x22bfbe0, 0xc0006260c0, 0x1dfefa0, 0xc0020ab240) /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/internal/controller/controller.go:311 +0x305 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc001dc41e0, 0x22bfbe0, 0xc0006260c0, 0x20edb00) /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/internal/controller/controller.go:266 +0x205 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2(0xc0020b4790, 0xc001dc41e0, 0x22bfbe0, 0xc0006260c0) /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/internal/controller/controller.go:227 +0x6b created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.1/pkg/internal/controller/controller.go:223 +0x425

Edited by Jeremy