Skip to content

Commit

Permalink
Pass a service account to the Kubernetes runner for the task execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Oct 12, 2023
1 parent bc28c48 commit 61ae5dc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/manageiq/providers/workflows/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ def self.floe_docker_runner
host = ENV.fetch("KUBERNETES_SERVICE_HOST")
port = ENV.fetch("KUBERNETES_SERVICE_PORT")

Floe::Workflow::Runner::Kubernetes.new(
"server" => URI::HTTPS.build(:host => host, :port => port).to_s,
"token_file" => "/run/secrets/kubernetes.io/serviceaccount/token",
"ca_cert" => "/run/secrets/kubernetes.io/serviceaccount/ca.crt",
"namespace" => File.read("/run/secrets/kubernetes.io/serviceaccount/namespace")
)
options = {
"server" => URI::HTTPS.build(:host => host, :port => port).to_s,
"token_file" => "/run/secrets/kubernetes.io/serviceaccount/token",
"ca_cert" => "/run/secrets/kubernetes.io/serviceaccount/ca.crt",
"namespace" => File.read("/run/secrets/kubernetes.io/serviceaccount/namespace"),
"task_service_account" => ENV.fetch("AUTOMATION_JOB_SERVICE_ACCOUNT")
}

Floe::Workflow::Runner::Kubernetes.new(options)
elsif MiqEnvironment::Command.is_appliance? || MiqEnvironment::Command.supports_command?("podman")
options = {}
if Rails.env.production?
Expand Down

0 comments on commit 61ae5dc

Please sign in to comment.