Class: KubesGoogle::Secrets::Fetcher
- Inherits:
-
Object
- Object
- KubesGoogle::Secrets::Fetcher
show all
- Extended by:
- Memoist
- Includes:
- Logging
- Defined in:
- lib/kubes_google/secrets/fetcher.rb,
lib/kubes_google/secrets/fetcher/sdk.rb,
lib/kubes_google/secrets/fetcher/base.rb,
lib/kubes_google/secrets/fetcher/gcloud.rb
Defined Under Namespace
Classes: Base, Gcloud, Sdk
Constant Summary
collapse
- @@cache =
{}
Instance Method Summary
collapse
Methods included from Logging
#logger
Constructor Details
#initialize(options = {}) ⇒ Fetcher
Returns a new instance of Fetcher.
6
7
8
|
# File 'lib/kubes_google/secrets/fetcher.rb', line 6
def initialize(options={})
@options = options
end
|
Instance Method Details
#fetch(short_name) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/kubes_google/secrets/fetcher.rb', line 11
def fetch(short_name)
return @@cache[short_name] if @@cache[short_name]
logger.debug "Fetching secret: #{short_name}"
@@cache[short_name] = fetcher.fetch(short_name)
rescue KubesGoogle::VpnSslError
logger.info "Retry fetching secret with the gcloud strategy"
fetcher = Gcloud.new(@options)
fetcher.fetch(short_name)
end
|
#fetcher ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/kubes_google/secrets/fetcher.rb', line 21
def fetcher
if KubesGoogle.config.secrets.fetcher == "sdk"
Sdk.new(@options)
else
Gcloud.new(@options)
end
end
|