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

Feature Wants: kubectel delete -k . should only delete all the awx resources, but not the entire namespace #15173

Closed
5 of 9 tasks
wangzhihaocom opened this issue May 8, 2024 · 5 comments
Labels

Comments

@wangzhihaocom
Copy link

wangzhihaocom commented May 8, 2024

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.

Feature type

Enhancement to Existing Feature

Feature Summary

Currently., when I deploy the awx in the existing namespace, I use kustomization.yaml
kubectl apply -k . command ,

but when I want to delete all the resources, I use kubectl delete -k .

It will terminate all the resources, as well as the entire existing namespace( including our other existing pod in the namespace), which is not good.

Is there a better to just delete all the awx resource but not to delete the entire namespace?

This is my kustomization.yaml

kind: Kustomization
namespace: devops

generatorOptions:
  disableNameSuffixHash: true

secretGenerator:
  - name: awx-postgres-configuration
    type: Opaque
    literals:
      - host=<host>
      - port=<port>
      - database=<db>
      - username=<user>
      - password=<password>
      - type=unmanaged
      - sslmode=prefer

  - name: awx-admin-password
    type: Opaque
    literals:
      - password=admin

resources:
  - github.com/ansible/awx-operator/config/default?ref=2.16.1
  - awx.yaml

images:
  - name: quay.io/ansible/awx-operator
    newTag: 2.16.1

Select the relevant components

  • UI
  • API
  • Docs
  • Collection
  • CLI
  • Other

Steps to reproduce

kubectl apply -k .
kubectl delete -k .

Current results

When run kubectl delete -k ., it delete the entire existing namespace deletes

Sugested feature result

Should only delete the awx resources , not delete the entire namespace

Additional information

N/A

@TheRealHaoLiu
Copy link
Member

awx repo does not handle the installation of awx, please open this issue on awx-operator repo.

also... not sure if this is possible...

@rooftopcellist
Copy link
Member

@wangzhihaocom do you mind opening this issue in the awx-operator repo?

FYI, for anyone stumbling upon this issue, a work-around for now to delete everything awx related in the namespace except the namespace itself is to run:

kubectl kustomize . | sed '/kind: Namespace/,+5d' | kubectl delete -f -

@wangzhihaocom
Copy link
Author

sure I will open it

@wangzhihaocom
Copy link
Author

@rooftopcellist here it is ansible/awx-operator#1864

@wangzhihaocom
Copy link
Author

wangzhihaocom commented May 21, 2024

@rooftopcellist I am using this command to delete the AWX resources, the resources got deleted but I got some error at the end . so that my gitlab CICD job failed. Is this command correct?

kubectl kustomize . | sed '/kind: Namespace/,+5d' | kubectl delete -f -

customresourcedefinition.apiextensions.k8s.io "awxbackups.awx.ansible.com" deleted customresourcedefinition.apiextensions.k8s.io "awxmeshingresses.awx.ansible.com" deleted customresourcedefinition.apiextensions.k8s.io "awxrestores.awx.ansible.com" deleted customresourcedefinition.apiextensions.k8s.io "awxs.awx.ansible.com" deleted serviceaccount "awx-operator-controller-manager" deleted role.rbac.authorization.k8s.io "awx-operator-awx-manager-role" deleted role.rbac.authorization.k8s.io "awx-operator-leader-election-role" deleted clusterrole.rbac.authorization.k8s.io "awx-operator-metrics-reader" deleted clusterrole.rbac.authorization.k8s.io "awx-operator-proxy-role" deleted rolebinding.rbac.authorization.k8s.io "awx-operator-awx-manager-rolebinding" deleted rolebinding.rbac.authorization.k8s.io "awx-operator-leader-election-rolebinding" deleted clusterrolebinding.rbac.authorization.k8s.io "awx-operator-proxy-rolebinding" deleted configmap "awx-operator-awx-manager-config" deleted secret "awx-admin-password" deleted secret "awx-postgres-configuration" deleted service "awx-operator-controller-manager-metrics-service" deleted deployment.apps "awx-operator-controller-manager" deleted ingress.networking.k8s.io "awx" deleted Error from server (NotFound): error when deleting "STDIN": the server could not find the requested resource (delete awxs.awx.ansible.com awx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants