Skip to content

Commit

Permalink
mount messaging cert if root not present
Browse files Browse the repository at this point in the history
  • Loading branch information
nasark committed Dec 11, 2023
1 parent c88dc35 commit 19ff5c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions lib/container_orchestrator/object_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@ def deployment_definition(name)
],
}
}
else
deployment[:spec][:template][:spec][:containers][0][:volumeMounts] ||= []
deployment[:spec][:template][:spec][:containers][0][:volumeMounts] << {
:mountPath => "/etc/pki/ca-trust/source/anchors",
:name => "messaging-certificate",
:readOnly => true,
}

deployment[:spec][:template][:spec][:volumes] ||= []
deployment[:spec][:template][:spec][:volumes] << {
:name => "messaging-certificate",
:secret => {
:secretName => "manageiq-cluster-ca-cert",
:items => [
:key => "ca.crt",
:path => "ca.crt",
],
}
}
end

deployment
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/container_orchestrator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@

deployment_definition = subject.send(:deployment_definition, "test")

expect(deployment_definition.fetch_path(:spec, :template, :spec, :containers, 0, :volumeMounts).length).to eq(2)
expect(deployment_definition.fetch_path(:spec, :template, :spec, :volumes).length).to eq(2)
expect(deployment_definition.fetch_path(:spec, :template, :spec, :containers, 0, :volumeMounts).length).to eq(3)
expect(deployment_definition.fetch_path(:spec, :template, :spec, :volumes).length).to eq(3)
end

it "mounts the database root certificate" do
Expand Down

0 comments on commit 19ff5c4

Please sign in to comment.