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

evebox support #28

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions internal/netconf/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ func (configurator FirewallConfigurator) getUnits() []unitConfiguration {
},
enabled: true,
},
{
unit: systemdUnitEveboxAgent,
templateFile: tplEveboxAgent,
constructApplier: func(kb KnowledgeBase, v ServiceValidator) (net.Applier, error) {
return NewEveboxAgentServiceApplier(kb, v)
},
enabled: true,
},
}
}

Expand Down
29 changes: 29 additions & 0 deletions internal/netconf/evebox-agent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package netconf

import (
"github.com/metal-stack/metal-networker/pkg/net"
)

// tplEveboxAgent is the name of the template for the evebox-agent service.
const tplEveboxAgent = "evebox-agent.service.tpl"

// systemdUnitEveboxAgent is the name of the systemd unit for the evebox-agent.
const systemdUnitEveboxAgent = "evebox-agent.service.service"

// EveboxAgentData contains the data to render the evebox-agent service template.
type EveboxAgentData struct {
Comment string
DefaultRouteVrf string
}

// NewEveboxAgentServiceApplier constructs a new instance of this type.
func NewEveboxAgentServiceApplier(kb KnowledgeBase, v net.Validator) (net.Applier, error) {
defaultRouteVrf, err := getDefaultRouteVRFName(kb)
if err != nil {
return nil, err
}

data := EveboxAgentData{Comment: versionHeader(kb.Machineuuid), DefaultRouteVrf: defaultRouteVrf}

return net.NewNetworkApplier(data, v, nil), nil
}
12 changes: 12 additions & 0 deletions internal/netconf/testdata/evebox-agent.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=EveBox Agent

[Service]
LimitMEMLOCK=infinity
User=root
Group=root
Type=oneshot
ExecStart=/bin/ip vrf exec vrf104009 /usr/bin/evebox agent

[Install]
WantedBy=multi-user.target
12 changes: 12 additions & 0 deletions internal/netconf/tpl/evebox-agent.service.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=EveBox Agent

[Service]
LimitMEMLOCK=infinity
User=root
Group=root
Type=oneshot
ExecStart=/bin/ip vrf exec {{ .DefaultRouteVrf }} /usr/bin/evebox agent

[Install]
WantedBy=multi-user.target