ansible / awx-operator

An Ansible AWX operator for Kubernetes built with Operator SDK and Ansible. 🤖
https://www.github.com/ansible/awx
Apache License 2.0
1.23k stars 624 forks source link

Unable to create manual projects on 2.13.1 #1789

Open fopson opened 6 months ago

fopson commented 6 months ago

Please confirm the following

Bug Summary

Unable to create manual project on AWX deployed through Operator. I have attempted to make /var/lib/awx/projects persistent and link it to /op/awx/projects locally on the node. I have followed instructions given in the community forum https://forum.ansible.com/t/awx-change-project-base-path-kubernetes/2473/8 but I still get the same error message.

image

I have been googling solutions for the past 2 days but no luck.

AWX Operator version

2.13.1

AWX version

24

Kubernetes platform

minikube

Kubernetes/Platform version

v1.32.0

Modifications

no

Steps to reproduce

Install AWX Operator 2.13.1

image

Setup Projects Dir

mkdir /opt/awx/projects
sudo chmod 775 /opt/awx/projects
sudo chown 1000:0 /opt/awx/projects

Create Persistent Volume

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-projects-volume
spec:
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  capacity:
    storage: 2Gi
  storageClassName: awx-projects-volume
  hostPath:
    path: /opt/awx/projects

Create Persistent Volume Claim

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: awx-projects-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 2Gi
  storageClassName: awx-projects-volume

Checks

image

Create TLS Secret

---
apiVersion: v1
kind: Secret
metadata:
  name: awx-tls-cert
  namespace: certificate
type: kubernetes.io/tls
data:
  tls.crt: <Base64-of-the-Cert>
  tls.key: <Base64-of-the-Key>

Deploy AWX

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
  namespace: awx
spec:
  # Service
  service_type: clusterip

  # Persisten Storage
  projects_persistence: true
  projects_existing_claim: awx-projects-claim

  # HTTPS
  ingress_type: ingress
  ingress_hosts:
    - hostname: fqdn-1
    - hostname: fqdn-2
      tls_secret: awx-tls-cert

Checks

image image image image image

Create a few projects under /opt/awx/projects/

Check

image

Expected results

Being able to create manual/persistent projects.

Actual results

AWX /var/lib/awx/projects/ doesn't seem to be linked to /opt/awx/projects/ on the local host.

Additional information

No response

Operator Logs

No response

fosterseth commented 5 months ago

your steps look correct to me

can you shell into your awx-task pod (awx-task container) and navigate to /var/lib/awx/projects? does the ls -la output look correct to you? if you touch foo in that directory do you see it on /opt/awx/projects?

fopson commented 5 months ago

Thanks for your comments @fosterseth.

Unfortunately, it looks like the linking of the volume isn't working as expected. A file listing of the /var/lib/awx/projects directory looks different than the file listing of the /opt/awx/projects directory.

image

I am not able to see the file created from within the pod.

kurokobo commented 5 months ago

The hostPath based PV on minikube is quite different from other distributions. Your PV refers /opt/awx/projects of your minikube VM (or docker container) instead of your minikube host. Please investigate inside VM (or docker container) that is used as minikube instance.

Also, /opt on minikube instance is not persisted. Refer to: https://minikube.sigs.k8s.io/docs/handbook/persistent_volumes/