Class: Kuby::Redis::Plugin

Inherits:
Plugin
  • Object
show all
Defined in:
lib/kuby/redis/plugin.rb

Defined Under Namespace

Classes: APIResourcesError, KubyRedisError

Constant Summary collapse

REPO_NAME =
'redis-operator'.freeze
REPO_URL =
'https://spotahome.github.io/redis-operator'.freeze
CHART_NAME =
'redis-operator/redis-operator'.freeze
CHART_VERSION =
'3.1.4'.freeze
RELEASE_NAME =
'redis-operator'.freeze
NAMESPACE =
'kube-system'.freeze
WAIT_INTERVAL =

seconds

5
WAIT_MAX =

seconds

120

Instance Method Summary collapse

Instance Method Details

#configure(&block) ⇒ Object



21
22
23
# File 'lib/kuby/redis/plugin.rb', line 21

def configure(&block)
  instance_eval(&block) if block
end

#instance(name, &block) ⇒ Object



25
26
27
28
29
# File 'lib/kuby/redis/plugin.rb', line 25

def instance(name, &block)
  instances[name] ||= Instance.new(name, environment)
  instances[name].instance_eval(&block) if block
  instances[name]
end

#resourcesObject



31
32
33
# File 'lib/kuby/redis/plugin.rb', line 31

def resources
  instances.flat_map { |_, instance| instance.resources }
end

#setupObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/kuby/redis/plugin.rb', line 35

def setup
  Kuby.logger.info('Setting up the Redis operator')

  Kuby.logger.info("Updating the #{REPO_NAME} Helm repository")
  helm_cli.add_repo(REPO_NAME, REPO_URL)
  helm_cli.update_repos

  Kuby.logger.info('Deploying the Redis operator')
  operator_deployed? ? upgrade_operator : install_operator

  wait_for_api_resources do
    Kuby.logger.info('Waiting for API resources to become available')
  end

  Kuby.logger.info('Redis operator setup finished')
end