evryfs/github-actions-runner-operator

`podTemplateSpec`'s `metadata` is not passing to actual running pods

AmitBenAmi opened this issue · 1 comments

I want to set NetworkPolicy to my runners' pods, and for that I wanted to add some custom labels for them.
I added the metadata section under the podTemplateSpec container, and add some labels:

podTemplateSpec:
  metadata:
    labels:
      app.kubernetes.io/instance: github-actions-runner-operator
      app.kubernetes.io/name: github-actions-runner-operator
      name: github-actions-runner-operator

However, anytime I try to kubectl apply, the Runner spec is missing the metadata section (it is empty), and the pods don't have the labels I specified.

Also, I get the errors:

2021-04-20T11:28:29.810Z	INFO	controllers.GithubActionRunner	Scaling up	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi", "numInstances": 1}
2021-04-20T11:28:30.116Z	INFO	controllers.GithubActionRunner	Creating a new Pod	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi", "Pod.Namespace": "github-runners", "Pod.Name": "kubernetes-1cores-2048mi-pod-lvjjk", "result": "created"}
2021-04-20T11:28:30.117Z	DEBUG	controller-runtime.manager.events	Normal	{"object": {"kind":"GithubActionRunner","namespace":"github-runners","name":"kubernetes-1cores-2048mi","uid":"7f8af490-7680-4665-a804-e5a151c26973","apiVersion":"garo.tietoevry.com/v1alpha1","resourceVersion":"129654100"}, "reason": "Scaling", "message": "Created pod github-runners/kubernetes-1cores-2048mi-pod-lvjjk"}
2021-04-20T11:28:30.148Z	INFO	controllers.GithubActionRunner	Reconciling GithubActionRunner	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi"}
2021-04-20T11:28:31.073Z	INFO	controllers.GithubActionRunner	Pods and runner API not in sync, returning early	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi"}
2021-04-20T11:28:31.084Z	ERROR	util.api	unable to update status	{"error": "Operation cannot be fulfilled on githubactionrunners.garo.tietoevry.com \"kubernetes-1cores-2048mi\": the object has been modified; please apply your changes to the latest version and try again"}
github.com/go-logr/zapr.(*zapLogger).Error
	/go/pkg/mod/github.com/go-logr/zapr@v0.2.0/zapr.go:132
sigs.k8s.io/controller-runtime/pkg/log.(*DelegatingLogger).Error
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/log/deleg.go:144
github.com/redhat-cop/operator-utils/pkg/util.(*ReconcilerBase).ManageSuccessWithRequeue
	/go/pkg/mod/github.com/redhat-cop/operator-utils@v1.1.2/pkg/util/reconciler.go:418
github.com/redhat-cop/operator-utils/pkg/util.(*ReconcilerBase).ManageOutcomeWithRequeue
	/go/pkg/mod/github.com/redhat-cop/operator-utils@v1.1.2/pkg/util/reconciler.go:367
github.com/evryfs/github-actions-runner-operator/controllers.(*GithubActionRunnerReconciler).manageOutcome
	/workspace/controllers/githubactionrunner_controller.go:181
github.com/evryfs/github-actions-runner-operator/controllers.(*GithubActionRunnerReconciler).handleScaling
	/workspace/controllers/githubactionrunner_controller.go:122
github.com/evryfs/github-actions-runner-operator/controllers.(*GithubActionRunnerReconciler).Reconcile
	/workspace/controllers/githubactionrunner_controller.go:97
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:298
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:216
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.UntilWithContext
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:99
2021-04-20T11:28:31.084Z	ERROR	controller-runtime.manager.controller.githubactionrunner	Reconciler error	{"reconciler group": "garo.tietoevry.com", "reconciler kind": "GithubActionRunner", "name": "kubernetes-1cores-2048mi", "namespace": "github-runners", "error": "Operation cannot be fulfilled on githubactionrunners.garo.tietoevry.com \"kubernetes-1cores-2048mi\": the object has been modified; please apply your changes to the latest version and try again"}
github.com/go-logr/zapr.(*zapLogger).Error
	/go/pkg/mod/github.com/go-logr/zapr@v0.2.0/zapr.go:132
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:302
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:253
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.8.3/pkg/internal/controller/controller.go:216
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.UntilWithContext
	/go/pkg/mod/k8s.io/apimachinery@v0.20.5/pkg/util/wait/wait.go:99
2021-04-20T11:28:31.089Z	INFO	controllers.GithubActionRunner	Reconciling GithubActionRunner	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi"}
2021-04-20T11:28:31.923Z	INFO	controllers.GithubActionRunner	Pods and runner API not in sync, returning early	{"githubactionrunner": "github-runners/kubernetes-1cores-2048mi"}

This is the compare window I see in ArgoCD after trying to sync:
Screen Shot 2021-04-20 at 14 49 51

I'm using the latest version of the operator, using the Helm Chart with version: v0.9.1.

Duplicate of #204