Bug 1380805

Summary: Postgresql pod is error when using persistent storage
Product: OpenShift Container Platform Reporter: Christian Hernandez <chernand>
Component: StorageAssignee: Bradley Childs <bchilds>
Status: CLOSED NOTABUG QA Contact: Jianwei Hou <jhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, jsafrane, nschuetz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-10 12:52:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Christian Hernandez 2016-09-30 15:28:01 UTC
Description of problem:

On 3.3 I'm trying to get a pgsql database up and running and I get the following error
---
waiting for server to start....FATAL:  data directory "/var/lib/pgsql/data/userdata" has wrong ownership
HINT:  The server must be started by the user that owns the data directory.
pg_ctl: could not start server
---

Version-Release number of selected component (if applicable):

[root@ose3-master ~]# oc version
oc v3.3.0.32
kubernetes v1.3.0+52492b4
features: Basic-Auth GSSAPI Kerberos SPNEGO


How reproducible:

Every time


Steps to Reproduce:
1. Create an NFS share

mkdir -m 777 /var/export/vol1/gogs-pgsql 

chown -R nfsnobody:nfsnobody /var/export/vol1/gogs-pgsql 

/var/export/vol1/gogs-pgsql *(rw,sync,all_squash)

exportfs -a

2. Create a pv of 1Gi with RWX,RWO

3. Run the following command

oc new-app --template=postgresql-persistent -p POSTGRESQL_USER=gogs,POSTGRESQL_PASSWORD=gogs,POSTGRESQL_DATABASE=gogs

Actual results:

Deployer Pod errors out

Expected results:

Running PGSQL pod with persistent storage

Additional info:

This doesn't work ~> https://access.redhat.com/solutions/2313231

Comment 1 Christian Hernandez 2016-09-30 15:46:16 UTC
Looks like I needed `root_squash` instead 

The article should list this  https://access.redhat.com/solutions/2313231

Comment 2 Jan Safranek 2016-10-07 12:38:53 UTC
I am not sure what's the bug here - you asked your NFS server to squash all users to nfsnobody and then you complain that PostgreSQL can't create/chown a directory as a user, because it's squashed to nfsnobody.

Yes, root_squash is much more appropriate here. I don't know who created the solution in our customer portal nor the blog post - it may work on GitLab, IMO it can't work for PostgreSQL.