Class: KubernetesDeploy::KubeclientBuilder::GoogleFriendlyConfig
- Inherits:
-
Kubeclient::Config
- Object
- Kubeclient::Config
- KubernetesDeploy::KubeclientBuilder::GoogleFriendlyConfig
- Defined in:
- lib/kubernetes-deploy/kubeclient_builder/google_friendly_config.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.read(filename) ⇒ Object
15 16 17 |
# File 'lib/kubernetes-deploy/kubeclient_builder/google_friendly_config.rb', line 15 def self.read(filename) new(YAML.safe_load(File.read(filename), [Time]), File.dirname(filename)) end |
Instance Method Details
#fetch_user_auth_options(user) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/kubernetes-deploy/kubeclient_builder/google_friendly_config.rb', line 7 def (user) if user.dig('auth-provider', 'name') == 'gcp' { bearer_token: new_token } else super end end |
#new_token ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kubernetes-deploy/kubeclient_builder/google_friendly_config.rb', line 19 def new_token scopes = ['https://www.googleapis.com/auth/cloud-platform'] = Google::Auth.get_application_default(scopes) .apply({}) .access_token rescue Signet::AuthorizationError => e = (e.response.body) || e. raise KubeException.new(e.response.status, , e.response.body) end |