kyverno: [Bug] Cannot create ClusterPolicy with generate.clone since v1.14.2 - “no service account provided”
Kyverno Version
1.14.3
Description
Hi,
Since version 1.14.2 (specifically this commit: https://github.com/kyverno/kyverno/commit/d1b4c00559a0b106411a569c656198964691b1f1), I can no longer create the following ClusterPolicy using generate.clone.
The error returned is:
“no service account provided”
I have verified that the service accounts used by both the admission controller and background controller have the necessary permissions (including get/list on namespaces and secrets).
Is this an expected behavior change? If so, is there a workaround or a recommended way to specify the service account explicitly in the policy?
Thanks in advance.
ClusterPolicy:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: replicate-registry-creds-from-kube-system
spec:
admission: true
background: true
emitWarning: false
rules:
- generate:
apiVersion: v1
clone:
name: sec-toto-public-registry
namespace: kube-system
generateExisting: true
kind: Secret
name: sec-toto-public-registry
namespace: '{{request.object.metadata.name}}'
synchronize: true
match:
resources:
kinds:
- Namespace
name: replicate-sec-toto-public-registry
skipBackgroundRequests: true
- generate:
apiVersion: v1
clone:
name: sec-toto-xxx-registry
namespace: kube-system
generateExisting: true
kind: Secret
name: sec-toto-xxx-registry
namespace: '{{request.object.metadata.name}}'
synchronize: true
match:
resources:
kinds:
- Namespace
name: replicate-sec-toto-xxx-registry
skipBackgroundRequests: true
- generate:
apiVersion: v1
clone:
name: docker-hub
namespace: kube-system
generateExisting: true
kind: Secret
name: docker-hub
namespace: '{{request.object.metadata.name}}'
synchronize: true
match:
resources:
kinds:
- Namespace
name: replicate-docker-hub
skipBackgroundRequests: true
validationFailureAction: Audit
Check SA
root@infra-kube:~# kubectl auth can-i get secret/sec-toto-public-registry --namespace kube-system --as system:serviceaccount:kyverno:kyverno-admission-controller
yes
root@infra-kube:~# kubectl auth can-i get secret/sec-toto-public-registry --namespace kube-system --as system:serviceaccount:kyverno:kyverno-background-controller
yes
Screen
Slack discussion
No response
Troubleshooting
- I have read and followed the documentation AND the troubleshooting guide.
- I have searched other issues in this repository and mine is not recorded.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 20 (8 by maintainers)
Sorry, missed that. Thanks for sharing!
Fix is merged we try to prepare a bugfix release today
I found the underlaying issue, you disabled the reports controller right? Created a PR with the fix
I’ll testet as well and all is fine with 1.14.4
Hey @fjogeleit I have the same issue, Kyverno installed from the helm chart, my backgoroundController is enabled by default. I also tried to set what you suggest but nothing seems to work. I left default values except from some extra roles. CleanupControllers, reportsControllers and policyReportsCleanup have been disabled