Skip to content

Conversation

@RafalKorepta
Copy link
Contributor

@RafalKorepta RafalKorepta commented Nov 6, 2024

Add HorizontalPodAutoscaler permission for operator role

The HorizontalPodAutoscaler was not added to permission set for the operator
Role. The operator during GC operation log the following message:

W1106 11:08:59.308067       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v2.HorizontalPodAutoscaler: horizontalpodautoscalers.autoscaling is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "horizontalpodautoscalers" in API group "autoscaling" in the namespace "redpanda"
E1106 11:08:59.308100       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v2.HorizontalPodAutoscaler: failed to list *v2.HorizontalPodAutoscaler: horizontalpodautoscalers.autoscaling is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "horizontalpodautoscalers" in API group "autoscaling" in the namespace "redpanda"

Add Certificate permission for operator role

The Certificate from cert-manager customer resource was not added list permission
set for operator Role. The operator during GC operation log the following
message:

W1106 11:46:57.392913       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v1.Certificate: certificates.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "certificates" in API group "cert-manager.io" in the namespace "redpanda"
E1106 11:46:57.392992       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Certificate: failed to list *v1.Certificate: certificates.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "certificates" in API group "cert-manager.io" in the namespace "redpanda"

Add Issuer permission for operator role

The Issuer from cert-manager customer resource was not added list permission
set for operator Role. The operator during GC operation log the following
message:

W1106 12:46:47.273317       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v1.Issuer: issuers.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "issuers" in API group "cert-manager.io" in the namespace "redpanda"
E1106 12:46:47.273598       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Issuer: failed to list *v1.Issuer: issuers.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "issuers" in API group "cert-manager.io" in the namespace "redpanda"

Release operator chart

Operator chart in version 0.4.33

Remove none existent empty API Group for leases

Leases are located in coordination.k8s.io API Group not in empty API Group.

Add helm and kustomize RBAC rules equivalence test

Default operator helm chart templates is compared with kustomize from
redpanda-operator repository. Kustomize could deploy combination of
cluster and namespace scoped operator. There are few exclusions and corss
checks between helm Role and kustomize Cluster role.

Remove white space in string

K8S-400

@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch from 5e5d25f to 2d1953e Compare November 6, 2024 12:41
@RafalKorepta RafalKorepta changed the title Add HorizontalPodAutoscaler permission for operator role Add missing permissions for operator role Nov 6, 2024
@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch 2 times, most recently from eca22b8 to 5549163 Compare November 6, 2024 13:14
The HorizontalPodAutoscaler was not added to permission set for the operator
Role. The operator during GC operation log the following message:
```
W1106 11:08:59.308067       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v2.HorizontalPodAutoscaler: horizontalpodautoscalers.autoscaling is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "horizontalpodautoscalers" in API group "autoscaling" in the namespace "redpanda"
E1106 11:08:59.308100       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v2.HorizontalPodAutoscaler: failed to list *v2.HorizontalPodAutoscaler: horizontalpodautoscalers.autoscaling is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "horizontalpodautoscalers" in API group "autoscaling" in the namespace "redpanda"
```
@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch 2 times, most recently from ff66f59 to 1d02f7c Compare November 6, 2024 14:41
@chrisseto
Copy link
Contributor

Have the permissions for HPAs been added to the operator itself? Seems like we're missing service monitors as well.

Think we could add a test that asserts that the output permissions are the same as the results of running kustomize against the operator at appVersion? That way we wouldn't have to manually verify this every time.

@RafalKorepta
Copy link
Contributor Author

@chrisseto
Test is added, but I'm not happy about the outcome.

@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch 2 times, most recently from fc4250f to bdea57a Compare November 7, 2024 12:55
delete(helmRoleRules, consoleKey)
delete(kClusterRoleRules, consoleKey)

for k := range helmRoleRules {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This to me says we should probably do something to make the permissions between the chart and the kustomize manifest much more similar 😓

Do you think it would help if we ran controller-gen in the operator separately for V1 and V2 so we'd have distinct sets that we can individually run kustomize on or merge via the default folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be ideal! Should I do it right away and align this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't think it'll be too much extra effort, I'd be in favor of it!

@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch 2 times, most recently from 71eea55 to 2c2cc6a Compare November 8, 2024 20:54
The Certificate from cert-manager customer resource had missing list and watch permission
set for operator Role. The operator during GC operation log the following
message:
```
W1106 11:46:57.392913       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v1.Certificate: certificates.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "certificates" in API group "cert-manager.io" in the namespace "redpanda"
E1106 11:46:57.392992       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Certificate: failed to list *v1.Certificate: certificates.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "certificates" in API group "cert-manager.io" in the namespace "redpanda"
E1106 12:59:35.221498       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Certificate: unknown (get certificates.cert-manager.io)
```
The Issuer from cert-manager customer resource had missing list and watch permission
set for operator Role. The operator during GC operation log the following
message:

```
W1106 12:46:47.273317       1 reflector.go:547] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v1.Issuer: issuers.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "issuers" in API group "cert-manager.io" in the namespace "redpanda"
E1106 12:46:47.273598       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Issuer: failed to list *v1.Issuer: issuers.cert-manager.io is forbidden: User "system:serviceaccount:redpanda:redpanda-operator" cannot list resource "issuers" in API group "cert-manager.io" in the namespace "redpanda"
E1106 12:59:31.320754       1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1.Issuer: unknown (get issuers.cert-manager.io)
```
Default operator helm chart templates is compared with kustomize from
redpanda-operator repository. Kustomize could deploy combination of
cluster and namespace scoped operator. There are few exclusions and corss
checks between helm Role and kustomize Cluster role.
@RafalKorepta RafalKorepta force-pushed the rk/add-operator-permissions branch 2 times, most recently from 4e5fbfc to 2ecec97 Compare November 9, 2024 19:35
@chrisseto
Copy link
Contributor

Subsumed by #1595

@chrisseto chrisseto closed this Nov 11, 2024
@RafalKorepta RafalKorepta deleted the rk/add-operator-permissions branch February 25, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants