-
Notifications
You must be signed in to change notification settings - Fork 163
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
GlobalTenantRessource only creates object. No updates possibles. #687
Comments
I tried to edit a kubernetes resources, and set it resourceVersion to "". I got the same error capsule gets.
|
AFAIK |
Hey @h4wkmoon, may I ask you to share the GlobalTenantResource you're using? Just to tried to understand if you're using existing resources, or raw ones. |
@prometherion, I tried with both raw & namespaced. Same results. |
I wasn't able to reproduce, sharing the steps tested so far. apiVersion: capsule.clastix.io/v1beta2
kind: Tenant
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"capsule.clastix.io/v1beta2","kind":"Tenant","metadata":{"annotations":{},"name":"oil"},"spec":{"owners":[{"kind":"User","name":"alice"}]}}
creationTimestamp: "2023-01-26T16:22:57Z"
generation: 5
labels:
energy: green
name: oil
resourceVersion: "232417"
uid: 0d34f8c7-7b17-4626-ad1b-4aabe06422a4
spec:
owners:
- clusterRoles:
- admin
- capsule-namespace-deleter
kind: User
name: alice
status:
namespaces:
- oil-development
- oil-production
- oil-staging
size: 3
state: Active This is the GlobalTenantResource I create: apiVersion: capsule.clastix.io/v1beta2
kind: GlobalTenantResource
metadata:
name: green-production
spec:
pruningOnDelete: true
resources:
- rawItems:
- apiVersion: v1
kind: Secret
metadata:
name: raw-secret-1
- apiVersion: v1
kind: Secret
metadata:
name: raw-secret-2
- apiVersion: v1
kind: Secret
metadata:
name: raw-secret-3
resyncPeriod: 60s
tenantSelector:
matchLabels:
energy: green I don't have any secret created in my Namespaces:
Now I apply the GlobalTenantResource and I check the Secrets
I'm going to edit the raw items, adding a field to those secrets. apiVersion: capsule.clastix.io/v1beta2
kind: GlobalTenantResource
metadata:
name: green-production
spec:
pruningOnDelete: true
resources:
- rawItems:
- data:
admin: YWRtaW4=
apiVersion: v1
kind: Secret
metadata:
name: raw-secret-1
- data:
admin: YWRtaW4=
apiVersion: v1
kind: Secret
metadata:
name: raw-secret-2
- data:
admin: YWRtaW4=
apiVersion: v1
kind: Secret
metadata:
name: raw-secret-3
resyncPeriod: 60s
tenantSelector:
matchLabels:
energy: green Checking if the secret is containing the updated value:
Also, tried to grep the logs with the error you reported, but wasn't able to find anything.
@h4wkmoon please, to help you in triaging the bug, and propose a fix, we need first to replicate the issue: it would be absolutely valuable if you could share the data you're trying to replicate, even redacted, so I can work on a patch although I already have an idea on a possible root cause. |
This one will trigger the error :
I guess the difference with secret is that there is an operator that updates the resource somehow. |
Also, I see "managedFields" in the generated alertmanager resource, not for secrets. |
Thanks, I was able to reproduce it now :) Going to propose a hotfix for this, thanks again! |
Just tested the changes introduced with #689, replication seems working. {"level":"info","ts":"2023-01-31T15:04:21.003Z","msg":"start processing","controller":"globaltenantresource","controllerGroup":"capsule.clastix.io","controllerKind":"GlobalTenantResource","globalTenantResource":{"name":"green-production"},"namespace":"","name":"green-production","reconcileID":"9162fbd1-cc76-4b44-a06d-a782ddfbab37"}
{"level":"debug","ts":"2023-01-31T15:04:21.010Z","logger":"controller-runtime.webhook.webhooks","msg":"received request","webhook":"/cordoning","UID":"8963eed0-58c5-44e6-a5dd-6beed7681c18","kind":"monitoring.coreos.com/v1, Kind=Alertmanager","resource":{"group":"monitoring.coreos.com","version":"v1","resource":"alertmanagers"}}
{"level":"debug","ts":"2023-01-31T15:04:21.010Z","logger":"controller-runtime.webhook.webhooks","msg":"wrote response","webhook":"/cordoning","code":200,"reason":"","UID":"8963eed0-58c5-44e6-a5dd-6beed7681c18","allowed":true}
{"level":"info","ts":"2023-01-31T15:04:21.024Z","msg":"resource has been replicated","controller":"globaltenantresource","controllerGroup":"capsule.clastix.io","controllerKind":"GlobalTenantResource","globalTenantResource":{"name":"green-production"},"namespace":"","name":"green-production","reconcileID":"9162fbd1-cc76-4b44-a06d-a782ddfbab37","resource":"oil-development/alertmanager"}
{"level":"debug","ts":"2023-01-31T15:04:21.024Z","logger":"controller-runtime.webhook.webhooks","msg":"received request","webhook":"/cordoning","UID":"7edd835e-f631-4b71-9ba6-8ee4d7506788","kind":"monitoring.coreos.com/v1, Kind=Alertmanager","resource":{"group":"monitoring.coreos.com","version":"v1","resource":"alertmanagers"}}
{"level":"debug","ts":"2023-01-31T15:04:21.024Z","logger":"controller-runtime.webhook.webhooks","msg":"wrote response","webhook":"/cordoning","code":200,"reason":"","UID":"7edd835e-f631-4b71-9ba6-8ee4d7506788","allowed":true}
{"level":"debug","ts":"2023-01-31T15:04:21.025Z","logger":"controller-runtime.webhook.webhooks","msg":"received request","webhook":"/cordoning","UID":"d75a5aac-70b7-4701-9cb2-00c09c277468","kind":"monitoring.coreos.com/v1, Kind=Alertmanager","resource":{"group":"monitoring.coreos.com","version":"v1","resource":"alertmanagers"}}
{"level":"debug","ts":"2023-01-31T15:04:21.025Z","logger":"controller-runtime.webhook.webhooks","msg":"wrote response","webhook":"/cordoning","code":200,"reason":"","UID":"d75a5aac-70b7-4701-9cb2-00c09c277468","allowed":true}
{"level":"info","ts":"2023-01-31T15:04:21.027Z","msg":"resource has been replicated","controller":"globaltenantresource","controllerGroup":"capsule.clastix.io","controllerKind":"GlobalTenantResource","globalTenantResource":{"name":"green-production"},"namespace":"","name":"green-production","reconcileID":"9162fbd1-cc76-4b44-a06d-a782ddfbab37","resource":"oil-staging/alertmanager"}
{"level":"info","ts":"2023-01-31T15:04:21.027Z","msg":"resource has been replicated","controller":"globaltenantresource","controllerGroup":"capsule.clastix.io","controllerKind":"GlobalTenantResource","globalTenantResource":{"name":"green-production"},"namespace":"","name":"green-production","reconcileID":"9162fbd1-cc76-4b44-a06d-a782ddfbab37","resource":"oil-production/alertmanager"}
{"level":"info","ts":"2023-01-31T15:04:21.027Z","msg":"processing completed","controller":"globaltenantresource","controllerGroup":"capsule.clastix.io","controllerKind":"GlobalTenantResource","globalTenantResource":{"name":"green-production"},"namespace":"","name":"green-production","reconcileID":"9162fbd1-cc76-4b44-a06d-a782ddfbab37"} |
Bug description
Globaltenantresource reconciliation fails after the creation of the replicated items. Items are just created, never updated.
Impacts are:
How to reproduce
Steps to reproduce the behavior:
Create any tenant, a namespace inthe tenant, and any globaltenantresource.
Expected behavior
No error. Items are updated.
Logs
Additional context
I think the issue is here:
https://github.com/clastix/capsule/blob/9d6f766cc1af157bb548284ea8dbd37e9ae80fa4/controllers/resources/processor.go#L260
The text was updated successfully, but these errors were encountered: