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

Make promotable resources configurable with cs_clone #532

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

maartenbeeckmans
Copy link
Contributor

Add the attributes promotable, promoted_max and promoted_node_max to the cs_clone resource.

The cs_clone resource now contains all options present in the pacemaker documentation: the https://www.clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/index.html#clone-options

Pull Request (PR) description

This pr add the parameters for managing promotable resources again, but now with the cs_clone resource instead of the cs_primary resource after that those were removed in PR #499.

This Pull Request (PR) fixes the following issues

Fixes #523

The required code changes in puppet to apply these changes are the following for managing a Redis Leader Follower cluster

Old setup before #499:

cs_primitive { 'redis':
  primitive_class => 'ocf',
  provided_by     => 'heartbeat',
  primitive_type  => 'redis',
  promotable      => true,
  operations      => [
    {
      'monitor' => {
        'interval' => '1s',
        'role'     => 'Master',
        'timeout'  => '40s',
        'on-fail'  => 'restart'
      }
    }, {
      'monitor' => {
        'interval' => '2s',
        'role'     => 'Slave',
        'timeout'  => '40s',
        'on-fail'  => 'restart'
      }
    },
  ],
  ms_metadata     =>  {
    'master-max'      => 1,
    'master-node-max' => 1,
    'clone-node-max'  => 1,
    'target-role'     => 'Master',
    'is-managed'      => true,
    'notify'          => true,
  },
}

Puppet code after this PR:

cs_primitive { 'redis':
  ensure          => present,
  primitive_class => 'ocf',
  provided_by     => 'heartbeat',
  primitive_type  => 'redis',
  operations      => [
    {
      'demote'  => {
        'interval' => '0s',
        'timeout'  => '90'
      }
    }, {
      'monitor' => {
        'interval' => '1s',
        'role'     => 'Promoted',
        'timeout'  => '40s',
        'on-fail'  => 'restart'
      }
    }, {
      'monitor' => {
        'interval' => '2s',
        'role'     => 'Unpromoted',
        'timeout'  => '40s',
        'on-fail'  => 'restart'
      }
    }, {
      'notify' => {
        'interval' => '0s',
        'timeout'  => '90',
      }
    }, {
      'promote' => {
        'interval' => '0s',
        'timeout'  => '90',
      }
    }, {
      'reload' => {
        'interval' => '0s',
        'timeout'  => '30',
      }
    }, {
      'start' => {
        'interval' => '0s',
        'timeout'  => '240',
      }
    }, {
      'stop' => {
        'interval' => '0s',
        'timeout'  => '100',
      }
    },
  ],
}

cs_clone { 'redis-clone':
  ensure          => present,
  primitive       => 'redis',
  clone_max       => 2,
  clone_node_max  => 1,
  promotable      => true,
  promoted_max    => 1,
  promoted_node_max => 1,
  notify_clones   => true,
}

This will create a very simular setup, but master/slave has been renamed to promoted/unpromoted in the pacemaker documentation.

@maartenbeeckmans maartenbeeckmans force-pushed the master branch 2 times, most recently from 84072d3 to 4b1c05a Compare April 12, 2023 14:48
@maartenbeeckmans maartenbeeckmans marked this pull request as ready for review April 12, 2023 14:55
README.md Outdated Show resolved Hide resolved
Gemfile Outdated
@@ -17,6 +17,7 @@ end

group :system_tests do
gem 'voxpupuli-acceptance', '~> 1.0', :require => false
gem 'pry', :require => false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this, the Gemfile is autogenerated and we want to keep it identical across our modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this as now the acceptance tests are failing with the following error:

 An error occurred while loading ./spec/acceptance/cs_primitive_spec.rb. - Did you mean?
                    rspec ./spec/acceptance/cs_commit_spec.rb
                    rspec ./spec/acceptance/cs_order_spec.rb
                    rspec ./spec/acceptance/cs_group_spec.rb

Failure/Error: require 'pry'
LoadError:
  cannot load such file -- pry
  Did you mean?  pty

So this looks like something that's broken on the generator part?

@maartenbeeckmans
Copy link
Contributor Author

The other checks failing are with the installation of pacemaker on debian 10/11, which is not something that I touched in this PR

@agriffit79
Copy link

Is there any plan to merge this PR?

@bastelfreak
Copy link
Member

@agriffit79 we cannot merge it because the whole pipeline is red, this needs to be fixed first.

@agriffit79
Copy link

The fault isn't with this PR though? The test failures seem to have been introduced in #529 ?

@maartenbeeckmans
Copy link
Contributor Author

The fault isn't with this PR though? The test failures seem to have been introduced in #529 ?

Yes, this is the reason why the tests are failing, and I have no clue how to fix this.
I think it is also out of scope of this PR

@agriffit79
Copy link

The fault isn't with this PR though? The test failures seem to have been introduced in #529 ?

Yes, this is the reason why the tests are failing, and I have no clue how to fix this. I think it is also out of scope of this PR

I submitted #540 which fixes most of the tests, but it's not been merged. Not really clear if this module is still actively maintained by anyone.

@Vincevrp
Copy link
Contributor

Vincevrp commented Apr 8, 2024

@bastelfreak I've rebased, fixed the tests, and regenerated the references. Debian 11 is still failing, but this also seems to be the case in other PRs.

@bastelfreak
Copy link
Member

@Vincevrp can you rebase this again please? We just merged other PRs and they had working Debian 11 tests.

Maarten Beeckmans and others added 3 commits April 8, 2024 15:12
Add the attributes promotable, promoted_max and promoted_node_max to the
cs_clone resource.

Write unit and acceptance tests for new cs_clone resource parameters

Write documentation about promotable clones
@bastelfreak bastelfreak added the enhancement New feature or request label Apr 8, 2024
@Vincevrp
Copy link
Contributor

Vincevrp commented Apr 8, 2024

@bastelfreak there we go

@bastelfreak
Copy link
Member

thanks for all the work!

@bastelfreak bastelfreak merged commit 92ab3b5 into voxpupuli:master Apr 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The promotable and ms_metadata attributes have been removed from ms_metadata.
4 participants