Skip to content
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
28 changes: 16 additions & 12 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Publish Docker Image

env:
platforms: ${{ 'linux/amd64,linux/arm64' }}
platforms: linux/amd64,linux/arm64

on:
push:
Expand All @@ -12,21 +12,22 @@ on:
paths-ignore:
- 'docs/**'
- '**/*.md'
workflow_dispatch:
inputs:
platforms:
description: 'Manual build trigger for arm64 architecture'
required: false
default: 'linux/arm64'
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
types: [labeled]

jobs:
buildAndPush:
if: |
(github.event_name == 'push') ||
(github.event_name == 'pull_request' && github.event.label.name == 'ok-to-image')
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'release' && github.ref || github.event_name == 'push' && github.ref }}

- uses: docker/metadata-action@v5
id: meta
with:
Expand All @@ -41,6 +42,7 @@ jobs:
type=sha
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
Expand All @@ -54,6 +56,7 @@ jobs:
CONTEXT_NAME="builders-${GITHUB_RUN_ID}"
docker context create $CONTEXT_NAME
echo "CONTEXT_NAME=$CONTEXT_NAME" >> $GITHUB_ENV

- name: Set up Docker Buildx
timeout-minutes: 5
uses: docker/setup-buildx-action@v3
Expand All @@ -66,15 +69,16 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
timeout-minutes: 60
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{env.platforms}}
push: ${{ github.event_name != 'workflow_dispatch' }}
platforms: ${{ env.platforms }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: production
secrets: |
"github_token=${{ secrets.BOT_PAT }}"
"github_token=${{ secrets.BOT_PAT }}"
5 changes: 4 additions & 1 deletion cli/dpservice-cli/cmd/create_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func CreateInterface(dpdkClientFactory DPDKClientFactory, rendererFactory Render
cmd := &cobra.Command{
Use: "interface <--id> <--ipv4> [<--ipv6>] <--vni> <--device> [<--underlay>] [<--total-meter-rate>] [<--public-meter-rate>]",
Short: "Create an interface",
Example: "dpservice-cli create interface --id=vm4 --ipv4=10.200.1.4 --ipv6=2000:200:1::4 --vni=200 --device=net_tap5 --underlay=fc00::1 --total-meter-rate=1000(mbits/s) --public-meter-rate=500(mbits/s)",
Example: "dpservice-cli create interface --id=vm4 --ipv4=10.200.1.4 --ipv6=2000:200:1::4 --vni=200 --device=net_tap5 --underlay=fc00::1 --total-meter-rate=1000(mbits/s) --public-meter-rate=500(mbits/s) --hostname=my-vm",
Aliases: InterfaceAliases,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -55,6 +55,7 @@ type CreateInterfaceOptions struct {
PxeFileName string
TotalMeterRate uint64
PublicMeterRate uint64
Hostname string
}

func (o *CreateInterfaceOptions) AddFlags(fs *pflag.FlagSet) {
Expand All @@ -68,6 +69,7 @@ func (o *CreateInterfaceOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&o.PxeFileName, "pxe-file-name", o.PxeFileName, "PXE boot file name.")
fs.Uint64Var(&o.TotalMeterRate, "total-meter-rate", 0, "Total meter rate.")
fs.Uint64Var(&o.PublicMeterRate, "public-meter-rate", 0, "Public meter rate.")
fs.StringVar(&o.Hostname, "hostname", o.Hostname, "Hostname for the interface.")
}

func (o *CreateInterfaceOptions) MarkRequiredFlags(cmd *cobra.Command) error {
Expand Down Expand Up @@ -98,6 +100,7 @@ func RunCreateInterface(ctx context.Context, dpdkClientFactory DPDKClientFactory
UnderlayRoute: &opts.PreferredUnderlay,
PXE: &api.PXE{Server: opts.PxeServer, FileName: opts.PxeFileName},
Metering: &api.MeteringParams{TotalRate: opts.TotalMeterRate, PublicRate: opts.PublicMeterRate},
HostName: opts.Hostname,
},
})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cli/dpservice-cli/renderer/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (t defaultTableConverter) loadBalancerTargetTable(lbtargets []api.LoadBalan
}

func (t defaultTableConverter) interfaceTable(ifaces []api.Interface) (*TableData, error) {
headers := []any{"ID", "VNI", "Device", "IPv4", "IPv6", "UnderlayRoute", "TotalMeterRate", "PublicMeterRate"}
headers := []any{"ID", "VNI", "Device", "IPv4", "IPv6", "UnderlayRoute", "TotalMeterRate", "PublicMeterRate", "Hostname"}
vfNeeded := isColumnNeeded(ifaces, "Spec.VirtualFunction")
if vfNeeded {
headers = append(headers, "VirtualFunction")
Expand All @@ -265,7 +265,7 @@ func (t defaultTableConverter) interfaceTable(ifaces []api.Interface) (*TableDat

columns := make([][]any, len(ifaces))
for i, iface := range ifaces {
columns[i] = []any{iface.ID, iface.Spec.VNI, iface.Spec.Device, iface.Spec.IPv4, iface.Spec.IPv6, iface.Spec.UnderlayRoute, iface.Spec.Metering.TotalRate, iface.Spec.Metering.PublicRate}
columns[i] = []any{iface.ID, iface.Spec.VNI, iface.Spec.Device, iface.Spec.IPv4, iface.Spec.IPv6, iface.Spec.UnderlayRoute, iface.Spec.Metering.TotalRate, iface.Spec.Metering.PublicRate, iface.Spec.HostName}
if iface.Spec.VirtualFunction != nil {
columns[i] = append(columns[i], iface.Spec.VirtualFunction.Name)
} else if vfNeeded {
Expand Down
1 change: 1 addition & 0 deletions go/dpservice-go/api/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func ProtoInterfaceToInterface(dpdkIface *proto.Interface) (*Interface, error) {
IPv6: &primaryIpv6,
UnderlayRoute: &underlayRoute,
Metering: ProtoMeteringParamsToInterfaceMeteringParams(dpdkIface.GetMeteringParams()),
HostName: dpdkIface.Hostname,
},
}, nil
}
Expand Down
1 change: 1 addition & 0 deletions go/dpservice-go/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ type InterfaceSpec struct {
Nat *Nat `json:"nat,omitempty"`
VIP *VirtualIP `json:"vip,omitempty"`
Metering *MeteringParams `json:"metering,omitempty"`
HostName string `json:"hostname,omitempty"`
}

type VirtualFunction struct {
Expand Down
1 change: 1 addition & 0 deletions go/dpservice-go/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ func (c *client) CreateInterface(ctx context.Context, iface *api.Interface, igno
DeviceName: iface.Spec.Device,
MeteringParameters: api.InterfaceMeteringParamsToProtoMeteringParams(iface.Spec.Metering),
PreferredUnderlayRoute: api.NetIPAddrToByteSlice(iface.Spec.UnderlayRoute),
Hostname: iface.Spec.HostName,
}
if iface.Spec.PXE != nil {
if iface.Spec.PXE.FileName != "" && iface.Spec.PXE.Server != "" {
Expand Down
2 changes: 2 additions & 0 deletions go/dpservice-go/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var _ = Describe("interface tests", Label("interface"), func() {
TotalRate: 100,
PublicRate: 50,
},
HostName: "tap5Host",
},
}

Expand Down Expand Up @@ -82,6 +83,7 @@ var _ = Describe("interface tests", Label("interface"), func() {

Expect(res.Spec.IPv4.String()).To(Equal("10.200.1.5"))
Expect(res.Spec.IPv6.String()).To(Equal("2000:200:1::5"))
Expect(res.Spec.HostName).To(Equal("tap5Host"))
Expect(res.Spec.Metering.TotalRate).To(Equal(uint64(0))) //MeteringRarams shouldn't take any effect on tap devices
Expect(res.Spec.Metering.PublicRate).To(Equal(uint64(0)))
})
Expand Down
Loading
Loading