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

RFE/Question - Turn PV examples into templates #222

Closed
tbielawa opened this issue Sep 19, 2017 · 7 comments
Closed

RFE/Question - Turn PV examples into templates #222

tbielawa opened this issue Sep 19, 2017 · 7 comments

Comments

@tbielawa
Copy link
Contributor

In openshift/openshift-ansible#5336 I converted the server and the postgres db PVs into templates with parameters to make it easier and more natural to use with the openshift-ansible oc_* tools (process, create, etc).

I create the PV templates in here:

And then later I conditionally create each template in here:

Here's the server PV template and the DB template file:

Server Template

DB Template

Would you consider shipping these updated versions in your repo?

They're a little rough right now, so, if you're open to this then I'll submit a PR and we can get them using language/formatting you prefer.

Thanks!

@carbonin
Copy link
Member

I'm 👍 on this.

Our PV examples are, well, just examples right now. This would allow someone to create a pv directly using the oc tooling without editing the files (and dirtying their local git status).

The only question I would have is around how we do backup and restore. @fbladilo would this change that process at all? In particular I'm concerned about the hard-coded values for things like the backup pvc, would we also want to template that as a part of this change to be consistent?

@carbonin
Copy link
Member

Still would want @bdunne and @fbladilo to comment on this about the general direction. You guys have anything to add?

@tbielawa
Copy link
Contributor Author

Some more information

What I did with the example templates you provide was fairly limited:

  • I changed it to the kube template form, which means the FIRST kind tag in the inventory is with value template, then some labels, annots, etc. Then there's a objects section. Basically cut the old PV definitions and indent them as a list. You know, like how the miq-template.yaml and miq-template-ext-db.yaml files are now.

  • I added a parameters key after the list of objects in the objects top-level-key. I replaced variable-value field values with variables.

I know that might sound confusing. So for example:

    capacity:                                                                                                                                                                                                        
      storage: 15Gi                                                                                                                                                                                       

Becomes

    capacity:
      storage: "${DB_PV_SIZE}"
# ...
parameters:
- name: DB_PV_SIZE
  displayName: PV Size for App DB
  required: true
  description: The size of the MIQ DB PV given in Gi
  value: 15Gi

How to process these? During experimentation/study I figured out that this works:

  1. Copy (scp?) your template to your OC cluster
  2. oc create -f /path/to/template.yaml - now it's in the system. You can reference it by name when using oc process later on
  3. oc process <name-of-template> -p NFS_HOST=nfs.example.com DB_PV_SIZE=15Gi BASE_PATH=/exports | oc create -f - You created the thingies the the thing!

@tbielawa
Copy link
Contributor Author

@bdunne @fbladilo @carbonin Any more thoughts on this?

@carbonin
Copy link
Member

I think @bdunne is traveling this week so I would give him some time to respond.

@fbladilo has no excuse 😜

@tbielawa
Copy link
Contributor Author

tbielawa commented Sep 21, 2017

PR sent w/ questions for discussion.

@fbladilo
Copy link
Contributor

@tbielawa @carbonin 😄 Sorry been busy with some ansible training thingies... will check on PR.

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

3 participants