Skip to content

Commit

Permalink
Merge pull request #22773 from nasark/messaging_cert_default
Browse files Browse the repository at this point in the history
Mount messaging cert if root not present

(cherry picked from commit 3baa1f3)
  • Loading branch information
Fryguy committed Jan 5, 2024
1 parent 98ee3e7 commit 4b3220b
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 4b3220b

Please sign in to comment.