Skip to content

Commit

Permalink
Merge branch 'main' into feat/ct-metrics-legacy-cp
Browse files Browse the repository at this point in the history
  • Loading branch information
SRodi authored Feb 5, 2025
2 parents 56b5f66 + 9aa763c commit 647647b
Show file tree
Hide file tree
Showing 188 changed files with 12,641 additions and 263 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_ID }} \
BUILDX_ACTION=--push
else
make retina-image \
Expand Down Expand Up @@ -102,6 +103,7 @@ jobs:
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_ID }} \
WINDOWS_YEARS=${{ matrix.year }} \
BUILDX_ACTION=--push
else
Expand Down Expand Up @@ -153,6 +155,7 @@ jobs:
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }} \
IMAGE_REGISTRY=${{ vars.ACR_NAME }} \
APP_INSIGHTS_ID=${{ secrets.AZURE_APP_INSIGHTS_ID }} \
BUILDX_ACTION=--push
else
make retina-operator-image \
Expand Down Expand Up @@ -332,9 +335,9 @@ jobs:
set -euo pipefail
go test -v ./test/e2e/. -timeout 60m -tags=e2e -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository}}
perf:
perf-basic:
if: ${{ github.event_name == 'merge_group' && success('manifests')}}
name: Retina Performance Test
name: Retina Basic Performance Test
runs-on: ubuntu-latest
needs: [manifests]

Expand All @@ -345,7 +348,41 @@ jobs:
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
go-version: 1.23
- run: go version

- name: Az CLI login
uses: azure/login@v2
if: ${{ github.event_name == 'merge_group' }}
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}

- name: Run Perf Tests
env:
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
shell: bash
run: |
set -euo pipefail
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository }} -retina-mode=basic
perf-advanced:
if: ${{ github.event_name == 'merge_group' && success('manifests')}}
name: Retina Advanced Performance Test
runs-on: ubuntu-latest
needs: [manifests]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: go version

- name: Az CLI login
Expand All @@ -364,4 +401,4 @@ jobs:
shell: bash
run: |
set -euo pipefail
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository }}
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository }} -retina-mode=advanced
44 changes: 40 additions & 4 deletions .github/workflows/perf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ permissions:
id-token: write

jobs:
perf_test:
name: Retina Performance Test
perf-test-basic:
name: Retina Basic Performance Test
runs-on: ubuntu-latest

steps:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
go-version: 1.23
- run: go version

- name: Az CLI login
Expand All @@ -49,4 +49,40 @@ jobs:
else
TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
fi
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$TAG -image-registry=ghcr.io -image-namespace=${{ github.repository }}
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$TAG -image-registry=ghcr.io -image-namespace=${{ github.repository }} -retina-mode=basic
perf-test-advanced:
name: Retina Advanced Performance Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: go version

- name: Az CLI login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}

- name: Run performance measurement for Retina
env:
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
TAG=${{ github.event.inputs.tag }}
else
TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
fi
go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$TAG -image-registry=ghcr.io -image-namespace=${{ github.repository }} -retina-mode=advanced
2 changes: 1 addition & 1 deletion .github/workflows/release-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
set -euo pipefail
export TAG=$(make version)
helm package ./deploy/legacy/manifests/controller/helm/retina --version $TAG
helm package ./deploy/standard/manifests/controller/helm/retina --version $TAG
# Get Helm chart's SHA digest from helm push cmd output
helm push retina-$TAG.tgz oci://ghcr.io/${{ github.repository }}/charts >> helm_push_result.txt 2>&1
cat helm_push_result.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scale-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
NUM_NETPOLS: ${{ inputs.num_netpol }}
CLEANUP: ${{ inputs.cleanup }}
IMAGE_REGISTRY: ${{ vars.ACR_NAME }}
IMAGE_NAMESPACE: ${{ github.repository }}
IMAGE_NAMESPACE: ${{ inputs.image_namespace == '' && github.repository || inputs.image_namespace }}
TAG: ${{ inputs.image_tag }}
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
days-before-pr-close: 7
days-before-pr-stale: 30
delete-branch: true
exempt-draft-pr: true
exempt-pr-labels: "meta/preserve"
stale-issue-label: "meta/waiting-for-author"
stale-pr-label: "meta/waiting-for-author"
operations-per-run: 100
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/test-multicloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test Multicloud

on:
pull_request:
paths:
- 'test/multicloud/**'

jobs:
multicloud-test:
runs-on: ubuntu-latest

steps:
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.8.3

- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.23'

- name: Install dependencies
run: go mod download
working-directory: test/multicloud/

- name: Run tests
run: make test
working-directory: test/multicloud/
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PLATFORM ?= $(OS)/$(ARCH)
PLATFORMS ?= linux/amd64 linux/arm64 windows/amd64
OS_VERSION ?= ltsc2019

HUBBLE_VERSION ?= v1.16.5 # This may be modified via the update-hubble GitHub Action
HUBBLE_VERSION ?= v1.16.6 # This may be modified via the update-hubble GitHub Action

CONTAINER_BUILDER ?= docker
CONTAINER_RUNTIME ?= docker
Expand Down Expand Up @@ -444,7 +444,7 @@ HELM_IMAGE_TAG ?= $(LATEST_TAG)

# basic/node-level mode
helm-install: manifests
helm upgrade --install retina ./deploy/legacy/manifests/controller/helm/retina/ \
helm upgrade --install retina ./deploy/standard/manifests/controller/helm/retina/ \
--namespace kube-system \
--set image.repository=$(IMAGE_REGISTRY)/$(RETINA_IMAGE) \
--set image.initRepository=$(IMAGE_REGISTRY)/$(RETINA_INIT_IMAGE) \
Expand All @@ -457,7 +457,7 @@ helm-install: manifests
--set enabledPlugin_linux="\[dropreason\,packetforward\,linuxutil\,dns\]"

helm-install-with-operator: manifests
helm upgrade --install retina ./deploy/legacy/manifests/controller/helm/retina/ \
helm upgrade --install retina ./deploy/standard/manifests/controller/helm/retina/ \
--namespace kube-system \
--set image.repository=$(IMAGE_REGISTRY)/$(RETINA_IMAGE) \
--set image.initRepository=$(IMAGE_REGISTRY)/$(RETINA_INIT_IMAGE) \
Expand All @@ -474,7 +474,7 @@ helm-install-with-operator: manifests

# advanced/pod-level mode with scale limitations, where metrics are aggregated by source and destination Pod
helm-install-advanced-remote-context: manifests
helm upgrade --install retina ./deploy/legacy/manifests/controller/helm/retina/ \
helm upgrade --install retina ./deploy/standard/manifests/controller/helm/retina/ \
--namespace kube-system \
--set image.repository=$(IMAGE_REGISTRY)/$(RETINA_IMAGE) \
--set image.initRepository=$(IMAGE_REGISTRY)/$(RETINA_INIT_IMAGE) \
Expand All @@ -493,7 +493,7 @@ helm-install-advanced-remote-context: manifests

# advanced/pod-level mode designed for scale, where metrics are aggregated by "local" Pod (source for outgoing traffic, destination for incoming traffic)
helm-install-advanced-local-context: manifests
helm upgrade --install retina ./deploy/legacy/manifests/controller/helm/retina/ \
helm upgrade --install retina ./deploy/standard/manifests/controller/helm/retina/ \
--namespace kube-system \
--set image.repository=$(IMAGE_REGISTRY)/$(RETINA_IMAGE) \
--set image.initRepository=$(IMAGE_REGISTRY)/$(RETINA_INIT_IMAGE) \
Expand Down
4 changes: 2 additions & 2 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:88225e171f29fe5f1f6ffca8eb659535b19b253354e43e1f4fc8a9bc67615ca1 AS builder
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:ef39e430a97a61bec3395adb673a7c5611d2212f14abe40da21cbfd11a9d6e9d AS builder


ARG VERSION
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/microsoft/retina/cmd/legacy"
"github.com/microsoft/retina/cmd/standard"
"github.com/spf13/cobra"
)

Expand All @@ -28,7 +28,7 @@ var (
RunE: func(cmd *cobra.Command, args []string) error {
// Do Stuff Here
fmt.Println("Starting Retina Agent")
d := legacy.NewDaemon(metricsAddr, probeAddr, cfgFile, enableLeaderElection)
d := standard.NewDaemon(metricsAddr, probeAddr, cfgFile, enableLeaderElection)
if err := d.Start(); err != nil {
return fmt.Errorf("starting daemon: %w", err)
}
Expand Down
8 changes: 3 additions & 5 deletions cmd/legacy/daemon.go → cmd/standard/daemon.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package legacy
package standard

import (
"fmt"
"os"
"strings"
"time"

"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -48,8 +47,7 @@ import (
)

const (
logFileName = "retina.log"
heartbeatInterval = 15 * time.Minute
logFileName = "retina.log"

nodeNameEnvKey = "NODE_NAME"
nodeIPEnvKey = "NODE_IP"
Expand Down Expand Up @@ -309,7 +307,7 @@ func (d *Daemon) Start() error {
defer controllerMgr.Stop(ctx)

// start heartbeat goroutine for application insights
go tel.Heartbeat(ctx, heartbeatInterval)
go tel.Heartbeat(ctx, daemonConfig.TelemetryInterval)

// Start controller manager, which will start http server and plugin manager.
go controllerMgr.Start(ctx)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package standard

import "github.com/cilium/ebpf/rlimit"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package standard

func (d *Daemon) RemoveMemlock() error {
// This function is a no-op on Windows.
Expand Down
6 changes: 3 additions & 3 deletions controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ARG OS_VERSION

# pinned base images

# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:88225e171f29fe5f1f6ffca8eb659535b19b253354e43e1f4fc8a9bc67615ca1 AS golang
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:ef39e430a97a61bec3395adb673a7c5611d2212f14abe40da21cbfd11a9d6e9d AS golang

# mcr.microsoft.com/cbl-mariner/base/core:2.0
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/cbl-mariner/base/core@sha256:77651116f2e83cf50fddd8a0316945499f8ce6521ff8e94e67539180d1e5975a AS mariner-core
Expand Down Expand Up @@ -99,7 +99,7 @@ RUN arr="clang tcpdump ip ss iptables-legacy iptables-legacy-save iptables-nft i
ARG GOARCH=amd64
ENV HUBBLE_ARCH=${GOARCH}
# ARG HUBBLE_VERSION may be modified via the update-hubble GitHub Action
ARG HUBBLE_VERSION=v1.16.5
ARG HUBBLE_VERSION=v1.16.6
ENV HUBBLE_VERSION=${HUBBLE_VERSION}
RUN echo "Hubble version: $HUBBLE_VERSION" && \
wget --no-check-certificate https://github.com/cilium/hubble/releases/download/$HUBBLE_VERSION/hubble-linux-${HUBBLE_ARCH}.tar.gz && \
Expand Down
4 changes: 2 additions & 2 deletions controller/Dockerfile.gogen
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:88225e171f29fe5f1f6ffca8eb659535b19b253354e43e1f4fc8a9bc67615ca1
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:ef39e430a97a61bec3395adb673a7c5611d2212f14abe40da21cbfd11a9d6e9d


# Default linux/architecture.
Expand Down
4 changes: 2 additions & 2 deletions controller/Dockerfile.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:88225e171f29fe5f1f6ffca8eb659535b19b253354e43e1f4fc8a9bc67615ca1
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:ef39e430a97a61bec3395adb673a7c5611d2212f14abe40da21cbfd11a9d6e9d

LABEL Name=retina-builder Version=0.0.1

Expand Down
4 changes: 2 additions & 2 deletions controller/Dockerfile.windows-2022
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:88225e171f29fe5f1f6ffca8eb659535b19b253354e43e1f4fc8a9bc67615ca1 AS builder
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-cbl-mariner2.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang@sha256:ef39e430a97a61bec3395adb673a7c5611d2212f14abe40da21cbfd11a9d6e9d AS builder

# Build args
ARG VERSION
Expand Down
4 changes: 2 additions & 2 deletions controller/Dockerfile.windows-cgo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-windowsservercore-ltsc2022
FROM --platform=windows/amd64 mcr.microsoft.com/oss/go/microsoft/golang@sha256:e423369b45d4144324e61d6d64ce7a6d0e2bdf7f181c74d8ed25346891b8aacd AS cgo
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-windowsservercore-ltsc2022
FROM --platform=windows/amd64 mcr.microsoft.com/oss/go/microsoft/golang@sha256:f88b5ef1afd628c18196e98c3d1c6081617768f4ad316433dd29b19a257a46eb AS cgo

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

Expand Down
4 changes: 2 additions & 2 deletions controller/Dockerfile.windows-native
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# buildx targets, and this one requires legacy build.
# Maybe one day: https://github.com/moby/buildkit/issues/616
ARG BUILDER_IMAGE
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.4-windowsservercore-ltsc2022
FROM --platform=windows/amd64 mcr.microsoft.com/oss/go/microsoft/golang@sha256:e423369b45d4144324e61d6d64ce7a6d0e2bdf7f181c74d8ed25346891b8aacd AS builder
# mcr.microsoft.com/oss/go/microsoft/golang:1.23.5-windowsservercore-ltsc2022
FROM --platform=windows/amd64 mcr.microsoft.com/oss/go/microsoft/golang@sha256:f88b5ef1afd628c18196e98c3d1c6081617768f4ad316433dd29b19a257a46eb AS builder
WORKDIR C:\\retina
COPY go.mod .
COPY go.sum .
Expand Down
2 changes: 1 addition & 1 deletion crd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REPO_ROOT = $(shell git rev-parse --show-toplevel)
TOOLS_DIR = $(REPO_ROOT)/hack/tools
TOOLS_BIN_DIR = $(TOOLS_DIR)/bin
CONTROLLER_GEN = $(TOOLS_BIN_DIR)/controller-gen
HELM_CRD_DIR = $(REPO_ROOT)/deploy/legacy/manifests/controller/helm/retina/crds
HELM_CRD_DIR = $(REPO_ROOT)/deploy/standard/manifests/controller/helm/retina/crds

.PHONY: generate manifests

Expand Down
3 changes: 0 additions & 3 deletions deploy/legacy/prometheus/retina/create-cm.sh

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 647647b

Please sign in to comment.