Class: KubesGoogle::Secrets::Fetcher
- Inherits:
-
Object
- Object
- KubesGoogle::Secrets::Fetcher
- 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
Constant Summary collapse
- @@cache =
{}
Instance Method Summary collapse
- #fetch(short_name) ⇒ Object
- #fetcher ⇒ Object
-
#initialize(options = {}) ⇒ Fetcher
constructor
A new instance of Fetcher.
Methods included from Logging
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 = end |
Instance Method Details
#fetch(short_name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kubes_google/secrets/fetcher.rb', line 11 def fetch(short_name) return @@cache[short_name] if @@cache[short_name] if ENV['KUBES_MOCK_SECRET'] logger.info "KUBES_MOCK_SECRET=1 is set. Mocking secret: #{short_name}" unless ENV['KUBES_MOCK_SECRET_QUIET'] @@cache[short_name] = "mock" else logger.debug "Fetching secret: #{short_name}" @@cache[short_name] = fetcher.fetch(short_name) end rescue KubesGoogle::VpnSslError logger.info "Retry fetching secret with the gcloud strategy" fetcher = Gcloud.new(@options) fetcher.fetch(short_name) end |