-
Notifications
You must be signed in to change notification settings - Fork 282
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
Improve the osmapping defaults in osmap.yaml #159
Conversation
Please consider #125 during PR of osmap.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noelmcloughlin Thanks for the PR.
The cleanup of pillar.example
and fixing Suse is definitely a valuable contribution.
However, did you have any real issues installing on Debians and RedHats using only stock defaults already in place? As for me, there is just a duplication of previous efforts.
More over, the formula handles pretty complex logic on determine the proper parameters for any possible packaged version of PostgreSQL distribution.
And again, please try to separate concerns and don't attempt to fix everything within single change :-) That's too hard, believe the experience of other contributors.
Although, you did a great job, thank you for being interested in making this formula even better.
pillar.example
Outdated
## pkg_client: 'postgresql-client-9.3' | ||
## pkgs_extra: | ||
## - postgresql-contrib | ||
## - postgresql-plpython |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, I think these items are no longer necessary. AFAIR they are legacy defaults for the test kitchen with Ubuntu 14. That should work smoothly now.
Just wondering, why double hashes everythere? (##
)
I usually see the following convention then commenting out YAML or code blocks:
- Real comments, i.e. developer notes are starting from
#
(hash followed by single space) or##
(two hashes with space). - Commented code or key-value pairs starts from
#
: hash sign only without following space, the space added only in case of required indentation.
This is easy to read and automatically strip off comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values are Debian specific but Salt supports many OS. I'd prefer to remove but compromise is commenting out with 'one' hash ;-) I used two hashes to try to attract comment during PR review to be honest. I've noted your comments regarding commenting conventions. thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, did you have any real issues installing on Debians and RedHats using only stock defaults already in place? As for me, there is just a duplication of previous efforts. More over, the formula handles pretty complex logic on determine the proper parameters for any possible packaged version of PostgreSQL distribution.
As mentioned in #156 the problems started when using pillars and involved heavy customization of pillar.example with jinja to get this working. Requiring end-users to do heavy customisation is unnecessary - the pillar.example should just work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how I see the ideal formula use case:
- Check it out and run with stock defaults with no Pillars set at all.
- Find out that something wrong or not applicable to my environment and look at
pillar.example
. - See every value which could be customizable and adjust to my case.
- Apply again and get profit.
So, the formula must just work without pillar.example
, but pillar.example
must provide working reference (or source for some test cases) without hard coded OS and implementation specific details whenever possible.
pillar.example
Outdated
@@ -46,6 +43,8 @@ postgres: | |||
# Set ``False`` to stop creation of backups when config files change. | |||
{%- if salt['status.time']|default(none) is callable %} | |||
config_backup: ".backup@{{ salt['status.time']('%y-%m-%d_%H:%M:%S') }}" | |||
{% else %} | |||
config_backup: '.bak' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default going to be merged from defaults.yaml
. I don't think it is really necessary, if you would need to change the default, you'd need to remember to edit it in two places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK can remove. Does "if" always evaluate to true? Is false possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess on modern Salt versions it always be true.
pillar.example
Outdated
@@ -58,7 +57,7 @@ postgres: | |||
# Use ``bake_image`` setting to control how PostgreSQL will be started: if set | |||
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init | |||
# script, job or unit run with Salt ``service`` state. | |||
bake_image: True | |||
bake_image: False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks it is even better to comment this out and leave just for the reference. Good spot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out; but true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default it is false, there is an explanation above why you might want to uncomment the feature.
@@ -19,6 +19,17 @@ Debian: | |||
pkg_dev: postgresql-server-dev-all | |||
pkg_libpq_dev: libpq-dev | |||
|
|||
pkg: 'postgresql-{{ repo.version }}' | |||
pkg_client: 'postgresql-client-{{ repo.version }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do it here. We have special file codenamemap.yaml
to take care of this. The package names are really depending on use_upstream_repo
setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree - The dilemma arises because these are defined in pillar.example for Debian, and osmap.yaml for RedHat and I don't like the inconsistency. I moved the Debian variables to osmap.yaml for consistency; but open to suggestions here. Looking at codenamemap.yaml Debian and Fedora are defined today.
@@ -19,6 +19,17 @@ Debian: | |||
pkg_dev: postgresql-server-dev-all | |||
pkg_libpq_dev: libpq-dev | |||
|
|||
pkg: 'postgresql-{{ repo.version }}' | |||
pkg_client: 'postgresql-client-{{ repo.version }}' | |||
pkgs_extra: [ postgresql-contrib, postgresql-plpython-{{ repo.version }}, libpostgresql-jdbc-java] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure everybody wants all the optional stuff, additional Python and Java dependencies by default?
This makes the formula run longer (read: it's longer to test).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - we should support pkgs_extra without forcing it.
But I think "pkgs_extra: []
" should be default in pillar.example uncommented. Then it should be easy to toggle this by removing "pkgs_extra: []
" pillar. This makes regression test and end-user support seamless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added pkgs_extra: []
to pillar.example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that the formula by default should provide minimum working installation. And in many use cases a user just don't need to wait and download a half of the distribution just to get a separate DB for WordPress backend or something.
I understand that those packages are system-specific, but still I think it is up to the user to figure out and fill in any additional stuff. I suggest to keep pkgs_extra: []
as default and mention it in pillar.example
without exposing values for some particular distro.
{% set data_dir = '/var/lib/postgresql/data' %} | ||
conf_dir: {{ data_dir }} | ||
prepare_cluster: | ||
command: /usr/lib/postgresql/9.6/bin/initdb --pgdata={{ data_dir }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You definitely should not do it here. Especially with hard-coded values like 9.6
,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. The default postgres.server state did not work properly. Fixing in pillar.example is considered wrong (see discussion at #156) so where should this be handled?
Yes, This should read {{ repo.version }} not 9.6.
prepare_cluster: | ||
command: initdb --pgdata='{{ data_dir }}' | ||
test: test -f '{{ data_dir }}/PG_VERSION' | ||
user: postgres |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these lines are unnecessary, please see defaults.yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But initdb
and data_dir
paths can differ between OS in theory.
How can this be addressed? See: #160
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you just moved the section that should be defined for upstream PostgreSQL distribution.
If these parameters are not defined, the corresponding ones from defaults.yaml
would be merged in.
|
||
{% set data_dir = '/var/lib/pgsql/data' %} | ||
prepare_cluster: | ||
command: /usr/lib/postgresql/bin/initdb --pgdata={{ data_dir }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is the only required change for Suse. Are you sure that initdb
is not in $PATH
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command failed on SuSE so that is path.
The command failed on Ubuntu too - path is /usr/lib/postgresql/9.6/bin/initdb #160
|
||
{% set data_dir = '/var/lib/pgsql/data' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're going to set global variable, better to put it on top of the file. It would be redefined in if
statement when necessary. But you don't need it at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed.
|
||
prepare_cluster: | ||
command: initdb --pgdata='{{ data_dir }}' | ||
test: test -f '{{ data_dir }}/PG_VERSION' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole section is here for the purpose: the values should be set like this only when use_upstream_repo
has been set to True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. Note however that initdb
, data_dir
and conf_dir
path can differ between OS.
@noelmcloughlin This PR and conversation threads are getting too complex to follow and grasp.
Then we will be able to do more cool stuff. And we would get clean history of changes for free! |
@vutny I agree with your suggestion, but I will do the pillar.example PR only for now. For the problems with Fedora and Ubuntu I have raised issues. I will do same for SuSE. In saltstack-formulas I detect two main interfaces ...
The aggregated Pillar model (https://docs.saltstack.com/en/latest/topics/pillar/) is the Saltstack version of a CIM (http://www.dmtf.org/standards/cim). Any type of CIM must be constructed from element model fragments - aka pillar.example in this scenario - but using postgres pillar.example as a reference model does not work: #156, #157, #158, #160, #161, .... Tomcat formula has same problem and I shared similar opinion there with @whiteinge
I'll close this PR shortly and follow up. |
From my experience, pillar.example is broken by design. Its purpose is to show some (most) of the actionable controls of a formula, it does not tell you what you should put in your configuration as only you do know. My view on the matter of formula expected behavior is:
I get that pillar.example then is misnamed but that's the current state of formula in the community afaics and it is a (bad) shortcut for documentation, although I still wonder how formula documentation could look like given it just is a transposition of upstream settings. |
That pillar.example is broken by design is my experience too. I am familiar with orchestration and technical solutions and this community satisfies my expectations. But pillar.example remains a puzzle. Sure its an optional artefact and, in my experience formulas tend to work without it within certain boundaries, but its a system model fragment. And if I want a systems description language (SDL) then I'm keenly interested in pillars as the information model. Here formulas are simply model/namespace fragments to be resused, applied in isolation, merged and orchestrated, etc. Again the pillar information model seems to be the native system description language for integrating saltstack into system solutions - the interface. We model user cases using some SDL (saltstack uses pillars, many modelling technologies exist) to build interesting solutions (formula yaml files are internal interfaces). Seeking a reference model the only reference model is pillar.example - the saltstack integration point for MANO - refer to https://wiki.opnfv.org/display/mano/MANO+Group+Home. WRT Mano, robust modelling is important. You explanation of pillar.example is the best one I have seen yet & I need to think about it. The bugs I raised on postgres recently - whilst maybe avoidable if I accept pillar.example as un-guaranteed artifact - must remain bugs because if I cannot model stuff using a SDL (pillars) then saltstack-formulas and saltstack could be bad fit for MANO and orchestartion user cases. We need to figure out how to describe and position the pillar interface to build confidence of system modellers in this technology & community. Thanks @vutny |
|
I think if these are going to keep off topic this PR should be closed. |
Thanks @vutny for collaborating on this pull request and I think we agreed the best plan is to split into some smaller tasks although I want to do further research first but some ideas were:
In summary the community consensus for data/pillar model seems to be as follows:
I'll look further at https://docs.saltstack.com/en/latest/topics/pillar/. All four of these layers are important and I'll need to find the best balance and that will come with experience. Cheers. |
This PR is to resolve #156 by instead populating osmap.yaml with more accurate OS defaults. The goal is to improve formula onboarding and working defaults. Three files are updated:
repo.yaml
osmap.yaml
pillar.example
Verified on SUSE (no issues seen, all states passed)
Verified on Fedora (see #157, #158)
Todo: Ubuntu