operator-framework / operator-lifecycle-manager

A management framework for extending Kubernetes with Operators
https://olm.operatorframework.io
Apache License 2.0
1.7k stars 542 forks source link

I can't delete OLM and all namespaces created by OLM - Namespaces stuck terminating. #3356

Closed avo-sepp closed 1 month ago

avo-sepp commented 1 month ago

Type of question

Support question

Question

What did you do? I deleted the namespaces olm and operators, along with all namespaces of projects created by olm

What did you expect to see? These namespaces get deleted.

What did you see instead? Under which circumstances?

  phase: Terminating
  conditions:
    - type: NamespaceDeletionDiscoveryFailure
      status: 'True'
      lastTransitionTime: '2024-08-02T14:18:08Z'
      reason: DiscoveryFailed
      message: >-
        Discovery failed for some groups, 1 failing: unable to retrieve the
        complete list of server APIs: packages.operators.coreos.com/v1: stale
        GroupVersion discovery: packages.operators.coreos.com/v1
    - type: NamespaceDeletionGroupVersionParsingFailure
      status: 'False'
      lastTransitionTime: '2024-08-02T14:18:09Z'
      reason: ParsedGroupVersions
      message: All legacy kube types successfully parsed
    - type: NamespaceDeletionContentFailure
      status: 'False'
      lastTransitionTime: '2024-08-02T14:18:09Z'
      reason: ContentDeleted
      message: All content successfully deleted, may be waiting on finalization
    - type: NamespaceContentRemaining
      status: 'False'
      lastTransitionTime: '2024-08-02T14:19:06Z'
      reason: ContentRemoved
      message: All content successfully removed
    - type: NamespaceFinalizersRemaining
      status: 'False'
      lastTransitionTime: '2024-08-02T14:18:09Z'
      reason: ContentHasNoFinalizers
      message: All content-preserving finalizers finished
spec:
  finalizers:
    - kubernetes

The namespaces are stuck with the following conditions. Deleting the Kubernetes finalizer did NOT work.

I noticed that packages.operators.coreos.com/v1 is non-existent. I tried to reinstall olm with operator-sdk in order to get back any CRDs that the API server might be looking for. It failed. I Also tried to uninstall OLM with the operator-sdk and that also failed, it told me there is no OLM currently installed in the cluster.

Environment

1.29.x

Additional context Add any other context about the question here.

avo-sepp commented 1 month ago

I solved this issue. I had to find and delete the apiservice which was not backed by an application anymore.

kubectl get apiservice

find the one that is showing "False" in my case it was packages.operators.coreos.com. Then you can perform

kubectl delete apiservice <service name from previous>

And it will delete that apiservice and allow the namespaces to continue on their way.