Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to apply actions-runner-controller.yaml v0.20.0 #823

Closed
1 of 2 tasks
pje opened this issue Sep 15, 2021 · 8 comments
Closed
1 of 2 tasks

Unable to apply actions-runner-controller.yaml v0.20.0 #823

pje opened this issue Sep 15, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@pje
Copy link
Member

pje commented Sep 15, 2021

Describe the bug

When I run this:

$ kubectl apply -f https://github.com/actions-runner-controller/actions-runner-controller/releases/download/v0.20.0/actions-runner-controller.yaml

I get this error:

namespace/actions-runner-system unchanged
customresourcedefinition.apiextensions.k8s.io/horizontalrunnerautoscalers.actions.summerwind.dev configured
customresourcedefinition.apiextensions.k8s.io/runnersets.actions.summerwind.dev configured
role.rbac.authorization.k8s.io/leader-election-role unchanged
clusterrole.rbac.authorization.k8s.io/manager-role configured
clusterrole.rbac.authorization.k8s.io/proxy-role unchanged
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding unchanged
clusterrolebinding.rbac.authorization.k8s.io/manager-rolebinding unchanged
clusterrolebinding.rbac.authorization.k8s.io/proxy-rolebinding unchanged
service/controller-manager-metrics-service unchanged
service/webhook-service unchanged
deployment.apps/controller-manager unchanged
certificate.cert-manager.io/serving-cert unchanged
issuer.cert-manager.io/selfsigned-issuer unchanged
mutatingwebhookconfiguration.admissionregistration.k8s.io/mutating-webhook-configuration configured
validatingwebhookconfiguration.admissionregistration.k8s.io/validating-webhook-configuration configured
Error from server (Invalid): error when applying patch:
...[truncated]...
to:
Resource: "apiextensions.k8s.io/v1, Resource=customresourcedefinitions", GroupVersionKind: "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
Name: "runners.actions.summerwind.dev", Namespace: ""
for: "https://github.com/actions-runner-controller/actions-runner-controller/releases/download/v0.20.0/actions-runner-controller.yaml": CustomResourceDefinition.apiextensions.k8s.io "runners.actions.summerwind.dev" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema

Checks

  • My actions-runner-controller version (v0.18.2) does support the feature
  • I'm using an unreleased version of the controller I built from HEAD of the default branch

To Reproduce
Steps to reproduce the behavior:

  1. Given a preexisting cluster—with 0.18.2 already applied—run: kubectl apply -f https://github.com/actions-runner-controller/actions-runner-controller/releases/download/v0.20.0/actions-runner-controller.yaml

Expected behavior
kubectl apply should apply CustomResourceDefinitions without errors.

Environment

  • Controller Version: currently 0.18.2, attempting to upgrade to 0.20
  • Deployment Method: kubectl, aws

Additional context
Add any other context about the problem here.

@mumoshu
Copy link
Collaborator

mumoshu commented Sep 16, 2021

@pje Thanks for reporting!

It seems like we need to add preserveUnknownFields: false as we can't just omit defaults from the CRD spec because we do need it: https://github.com/actions-runner-controller/actions-runner-controller/blob/ac3721d0d5174e4b4eb9f2f386553c89a81398dc/config/crd/bases/actions.summerwind.dev_runners.yaml#L1445

FYI this is how Calico handled the same error. They didn't need defaulting so the choice was to omit defaults. However that's not the case for us.

@jstewart612
Copy link
Contributor

Can confirm same issue using Helm chart loaded via an Application CRD in Argo CD so be sure you hit the helm chart as well

CustomResourceDefinition.apiextensions.k8s.io "runnerdeployments.actions.summerwind.dev" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema

@sp-ludovic-ivain
Copy link

Just got the same issue upgrading to 0.20.0 with chart version 0.13.0

Fixed it adding the default preserveUnknownFields value in the failing CRDs

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.6.0
  creationTimestamp: null
  name: runnerdeployments.actions.summerwind.dev
spec:
  preserveUnknownFields: false
  group: actions.summerwind.dev
...

Upgrade goes well

@toast-gear toast-gear added the bug Something isn't working label Sep 22, 2021
@tyrken
Copy link
Contributor

tyrken commented Sep 22, 2021

Trying to get my head around this (sorry for not testing upgrades during #803) - as above I've tested manually adding preserveUnknownFields: false to the CRDs and they can then apply (testing on a 1.21 kind & 1.20 EKS cluster). And they appear to still work for my limited use case.

Whilst I don't yet know how to change this repo's toolchain to get that set during CRD creation, is there a problem going this way rather than reverting-my-revert?

@tyrken
Copy link
Contributor

tyrken commented Sep 22, 2021

It appears getting controller-gen to add preserveUnknownFields explicitly false is tricky WIP according to kubernetes-sigs/controller-tools#476 - for now, the quickest hack is to bring back yq, as in the below:

yq eval --inplace '.spec.preserveUnknownFields = false' config/crd/bases/actions.summerwind.dev_*.yaml

@mumoshu
Copy link
Collaborator

mumoshu commented Sep 24, 2021

@tyrken Thanks for your efforts! My original assumption was that an upgrade from preserveUnknownFields: true to false isn't supported by Kubernetes, but apparently not. I'm now inclined to go with explicitly adding preserveUnknownFields: false.

@toast-gear
Copy link
Collaborator

This should be resolved with the release of v0.20.1 @pje, please confirm and close

@pje
Copy link
Member Author

pje commented Sep 24, 2021

Can confirm that kubectl apply -f https://github.com/actions-runner-controller/actions-runner-controller/releases/download/v0.20.1/actions-runner-controller.yaml works without error.

Thanks for the fix!

@pje pje closed this as completed Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants