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

Capacitor with namespace scope #138

Open
blezoray opened this issue Nov 29, 2024 · 1 comment
Open

Capacitor with namespace scope #138

blezoray opened this issue Nov 29, 2024 · 1 comment

Comments

@blezoray
Copy link

Hello,

I try to deploy Capacitor on a Openshift cluster, as enduser, with only a namespace scope.
For that, I replaced the ClusterRole/ClusterRoleBinding by Role/RoleBinding.
I also remove some pod security context:

        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          readOnlyRootFilesystem: true
          #runAsGroup: 101
          runAsNonRoot: true
          #runAsUser: 100
          seccompProfile:
            type: RuntimeDefault

But, when Capacitor pod starts, It generates a lot of logs because it tries get resources at cluster scope:

W1129 13:26:32.502906       1 reflector.go:561] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: failed to list *v1.Event: events is forbidden: User "system:serviceaccount:ubly7356-free:capacitor" cannot list resource "events" in API group "" at the cluster scope
E1129 13:26:32.503107       1 reflector.go:158] "Unhandled Error" err="pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: Failed to watch *v1.Event: failed to list *v1.Event: events is forbidden: User \"system:serviceaccount:ubly7356-free:capacitor\" cannot list resource \"events\" in API group \"\" at the cluster scope" logger="UnhandledError"
W1129 13:26:39.349203       1 reflector.go:561] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: failed to list *v1.Ingress: ingresses.networking.k8s.io is forbidden: User "system:serviceaccount:ubly7356-free:capacitor" cannot list resource "ingresses" in API group "networking.k8s.io" at the cluster scope
E1129 13:26:39.349281       1 reflector.go:158] "Unhandled Error" err="pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: Failed to watch *v1.Ingress: failed to list *v1.Ingress: ingresses.networking.k8s.io is forbidden: User \"system:serviceaccount:ubly7356-free:capacitor\" cannot list resource \"ingresses\" in API group \"networking.k8s.io\" at the cluster scope" logger="UnhandledError"
W1129 13:26:47.580034       1 reflector.go:561] pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: failed to list *v1.Pod: pods is forbidden: User "system:serviceaccount:ubly7356-free:capacitor" cannot list resource "pods" in API group "" at the cluster scope
E1129 13:26:47.580089       1 reflector.go:158] "Unhandled Error" err="pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: Failed to watch *v1.Pod: failed to list *v1.Pod: pods is forbidden: User \"system:serviceaccount:ubly7356-free:capacitor\" cannot list resource \"pods\" in API group \"\" at the cluster scope" logger="UnhandledError"

Is it possible to add an feature in order to specify the namespace scope ?

Rgds, Bruno.

@wombat
Copy link

wombat commented Jan 30, 2025

I didn´t make it work with a namespace scope but this is what I used to make it run at all on Openshift:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: capacitor
  namespace: flux-system
spec:
  targetNamespace: flux-system
  interval: 1h
  retryInterval: 2m
  timeout: 5m
  wait: true
  prune: true
  path: "./"
  sourceRef:
    kind: OCIRepository
    name: capacitor
  patches:
    - patch: |
        apiVersion: apps/v1
        kind: Deployment
        metadata:
          name: all
        spec:
          template:
            spec:
              securityContext:
                $patch: delete
              containers:
                - name: capacitor
                  securityContext:
                    runAsUser: null
                    seccompProfile:
                      $patch: delete
      target:
        kind: Deployment
        name: capacitor
        namespace: flux-system

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

No branches or pull requests

2 participants