Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use host network for podman containers #60

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions data/ignition.template
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ storage:
name: core
group:
name: core
- path: /home/core/.config/containers/systemd/agent.network
contents:
inline: |
[Network]
user:
name: core
group:
name: core
- path: /home/core/.config/containers/systemd/planner-agent.container
mode: 0644
contents:
Expand All @@ -95,8 +87,8 @@ storage:
Exec= -config /agent/config/config.yaml
PublishPort=3333:3333
Volume=/home/core/.migration-planner:/agent:Z
Environment=OPA_SERVER=opa:8181
Network=agent.network
Environment=OPA_SERVER=127.0.0.1:8181
Network=host
UserNS=keep-id:uid=1001

[Install]
Expand All @@ -115,7 +107,7 @@ storage:
Entrypoint=/usr/bin/opa
PublishPort=8181:8181
Exec=run --server /usr/share/opa/policies
Network=agent.network
Network=host

[Install]
WantedBy=multi-user.target default.target
1 change: 1 addition & 0 deletions internal/agent/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (u *InventoryUpdater) initializeCredentialUrl() {

localAddr := conn.LocalAddr().(*net.TCPAddr)
u.credUrl = fmt.Sprintf("http://%s:%d", localAddr.IP.String(), agentPort)
u.log.Infof("Discovered Agent IP address: %s", u.credUrl)
}

func calculateStatus(dataDir string) (api.SourceStatus, string, *api.Inventory) {
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ var _ = Describe("e2e", func() {
Eventually(func() bool {
return agent.IsServiceRunning(agentIP, "planner-agent")
}, "3m", "2s").Should(BeTrue())

Eventually(func() string {
s, err := svc.GetSource()
if err != nil {
return ""
}
if s.CredentialUrl != nil {
return *s.CredentialUrl
}

return ""
}, "3m", "2s").Should(Equal(fmt.Sprintf("http://%s:3333", agentIP)))
})

AfterEach(func() {
Expand All @@ -54,8 +66,11 @@ var _ = Describe("e2e", func() {

Context("Flow", func() {
It("Up to date", func() {
// Check that planner-agent service is running
r := agent.IsServiceRunning(agentIP, "planner-agent")
Expect(r).To(BeTrue())

// Put the vCenter credentials and check that source is up to date eventually
err = agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "user", "pass")
Expect(err).To(BeNil())
Eventually(func() bool {
Expand Down
Loading