# Class KubernetesMembershipProvider

java.lang.Object
org.apache.catalina.tribes.membership.MembershipProviderBase
org.apache.catalina.tribes.membership.cloud.CloudMembershipProvider
org.apache.catalina.tribes.membership.cloud.KubernetesMembershipProvider

All Implemented Interfaces:
  `ChannelListener, Heartbeat, MembershipProvider`

public class KubernetesMembershipProvider extends CloudMembershipProvider
A `MembershipProvider` that uses Kubernetes API to retrieve the members of a cluster.

## Field Summary

### Fields inherited from class CloudMembershipProvider

`connectionTimeout, CUSTOM_ENV_PREFIX, expirationTime, headers, localIp, port, readTimeout, sm, startTime, streamProvider, url`

### Fields inherited from class MembershipProviderBase

`executor, membership, membershipListener, service`

## Constructor Summary

Constructors
Constructor
Description
`KubernetesMembershipProvider()`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`protected Member[]`
`fetchMembers()`
Fetch current cluster members from the cloud orchestration.
`protected void`
`parsePods(Reader reader, List<MemberImpl> members)`
Parses the pod data from the given reader and populates the members list.
`void`
`start(int level)`
Start the membership provider.
`boolean`
`stop(int level)`
Stop the membership provider.

### Methods inherited from class CloudMembershipProvider

`accept, digest, getEnv, getNamespace, heartbeat, init, messageReceived, updateMember`

### Methods inherited from class MembershipProviderBase

`getMember, getMembers, hasMembers, setMembershipListener, setMembershipService`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### KubernetesMembershipProvider

public KubernetesMembershipProvider()
Default constructor.

## Method Details

### start

public void start(int level) throws Exception
Description copied from interface: `MembershipProvider`
Start the membership provider.

Specified by:
  `start` in interface `MembershipProvider`
Overrides:
  `start` in class `CloudMembershipProvider`
Parameters:
  `level` - the readiness level
  - Channel.DEFAULT - will start all services
  - Channel.MBR_RX_SEQ - starts the membership receiver
  - Channel.MBR_TX_SEQ - starts the membership broadcaster
Throws:
  `Exception` - if an error occurs

### stop

public boolean stop(int level) throws Exception
Description copied from interface: `MembershipProvider`
Stop the membership provider.

Specified by:
  `stop` in interface `MembershipProvider`
Overrides:
  `stop` in class `CloudMembershipProvider`
Parameters:
  `level` - the readiness level
  - Channel.DEFAULT - will stop all services
  - Channel.MBR_RX_SEQ - stops the membership receiver
  - Channel.MBR_TX_SEQ - stops the membership broadcaster
Returns:
  `true` if successful
Throws:
  `Exception` - if an error occurs

### fetchMembers

protected Member[] fetchMembers()
Description copied from class: `CloudMembershipProvider`
Fetch current cluster members from the cloud orchestration.

Specified by:
  `fetchMembers` in class `CloudMembershipProvider`
Returns:
  the member array

### parsePods

protected void parsePods(Reader reader, List<MemberImpl> members)
Parses the pod data from the given reader and populates the members list.

Parameters:
  `reader` - The reader with pod data
  `members` - The list to populate with members