voxpupuli / puppet-corosync

Sets up and manages Corosync.
https://forge.puppet.com/puppet/corosync
Apache License 2.0
44 stars 159 forks source link

Make promotable resources configurable with cs_clone #532

Closed maartenbeeckmans closed 3 months ago

maartenbeeckmans commented 1 year ago

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 commented 1 year ago

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 commented 8 months ago

Is there any plan to merge this PR?

bastelfreak commented 8 months ago

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

agriffit79 commented 8 months ago

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

maartenbeeckmans commented 7 months ago

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 commented 7 months ago

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 commented 3 months ago

@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 commented 3 months ago

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

Vincevrp commented 3 months ago

@bastelfreak there we go

bastelfreak commented 3 months ago

thanks for all the work!