Skip to content
Open
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: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: "1.25"
go-version: "1.26"

- uses: dominikh/staticcheck-action@024238d2898c874f26d723e7d0ff4308c35589a2 # v1.4.0
with:
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: "1.25"
go-version: "1.26"

- name: test
run: sudo --preserve-env make test
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: "1.25"
go-version: "1.26"

- name: Install protoc-gen-go
run: |
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: "1.25"
go-version: "1.26"

- name: e2e
run: make test-e2e
4 changes: 2 additions & 2 deletions activator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.25 as gomod
FROM golang:1.26 AS gomod

WORKDIR /app
ADD go.* /app
Expand All @@ -7,7 +7,7 @@ ADD go.* /app
RUN go mod download

# we use fedora since it has a recent version of bpftool
FROM fedora:43
FROM fedora:44
RUN dnf install -y llvm clang bpftool libbpf-devel golang

RUN mkdir /headers
Expand Down
7 changes: 3 additions & 4 deletions activator/activator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/containerd/log"
"github.com/containernetworking/plugins/pkg/ns"
"golang.org/x/sys/unix"
"k8s.io/utils/ptr"
)

type Server struct {
Expand Down Expand Up @@ -654,14 +653,14 @@ func (s *Server) GetKubeletAddr(isV6 bool) (*netip.Addr, error) {
if err := kubeletAddrMap.Lookup(key, &value); err != nil {
return nil, fmt.Errorf("looking up kubelet addr from map %s: %w", mapName, err)
}
return ptr.To(netip.AddrFrom16(value)), nil
return new(netip.AddrFrom16(value)), nil
}
value := [4]byte{}
if err := kubeletAddrMap.Lookup(key, &value); err != nil {
return nil, fmt.Errorf("looking up kubelet addr from map %s: %w", mapName, err)
}
s.kubeletAddr = ptr.To(netip.AddrFrom4(value))
return ptr.To(netip.AddrFrom4(value)), nil
s.kubeletAddr = new(netip.AddrFrom4(value))
return new(netip.AddrFrom4(value)), nil
}

func GetSandboxIPs(ifaceName string) ([]netip.Addr, error) {
Expand Down
5 changes: 2 additions & 3 deletions activator/activator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/utils/ptr"
)

type testCase struct {
Expand Down Expand Up @@ -124,15 +123,15 @@ func TestActivator(t *testing.T) {
expectedCode: http.StatusOK,
ipv6: false,
expectLastActivity: false,
kubeletAddr: ptr.To(netip.MustParseAddr("127.0.0.1")),
kubeletAddr: new(netip.MustParseAddr("127.0.0.1")),
},
"ignore kubelet traffic ipv6": {
parallelReqs: 1,
expectedBody: "ok",
expectedCode: http.StatusOK,
ipv6: true,
expectLastActivity: false,
kubeletAddr: ptr.To(netip.MustParseAddr("::1")),
kubeletAddr: new(netip.MustParseAddr("::1")),
},
"loop detection": {
parallelReqs: 1,
Expand Down
16 changes: 11 additions & 5 deletions api/runtime/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package v1
import (
reflect "reflect"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

const (
Expand All @@ -20,8 +21,7 @@ var (
GroupVersion = schema.GroupVersion{Group: Group, Version: Version}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
Expand All @@ -33,6 +33,12 @@ var (
MigrationGroupVersionKind = GroupVersion.WithKind(MigrationKind)
)

func init() {
SchemeBuilder.Register(&Migration{}, &MigrationList{})
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion,
&Migration{},
&MigrationList{},
)

metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}
2 changes: 1 addition & 1 deletion api/runtime/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/freezer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.25 AS builder
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder

WORKDIR /workspace
COPY go.mod go.mod
Expand Down
2 changes: 1 addition & 1 deletion cmd/installer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.25 AS builder
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder

WORKDIR /workspace
COPY go.mod go.mod
Expand Down
2 changes: 1 addition & 1 deletion cmd/manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG CRIU_IMAGE=ghcr.io/ctrox/zeropod-criu:v4.2

FROM --platform=$BUILDPLATFORM golang:1.25 AS builder
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder

WORKDIR /workspace
COPY go.mod go.mod
Expand Down
2 changes: 1 addition & 1 deletion criu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:12 as build
FROM debian:12 AS build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git build-essential libprotobuf-dev libprotobuf-c-dev \
protobuf-c-compiler protobuf-compiler python3-protobuf \
Expand Down
2 changes: 1 addition & 1 deletion e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker:29.1.2-cli
FROM docker:29.6.1-cli

RUN apk add --update go make iptables
WORKDIR /app
Expand Down
13 changes: 6 additions & 7 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/ptr"
)

func TestE2E(t *testing.T) {
Expand Down Expand Up @@ -451,12 +450,12 @@ func TestE2E(t *testing.T) {
}{
"running": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricRunning),
gaugeValue: ptr.To(float64(1)),
gaugeValue: new(float64(1)),
pod: runningPod,
},
"not running": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricRunning),
gaugeValue: ptr.To(float64(0)),
gaugeValue: new(float64(0)),
pod: checkpointedPod,
},
"last checkpoint time": {
Expand All @@ -466,7 +465,7 @@ func TestE2E(t *testing.T) {
"checkpoint duration": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricCheckpointDuration),
pod: checkpointedPod,
minHistogramSampleCount: ptr.To(uint64(1)),
minHistogramSampleCount: new(uint64(1)),
},
"last restore time": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricLastRestoreTime),
Expand All @@ -475,17 +474,17 @@ func TestE2E(t *testing.T) {
"restore duration": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricRestoreDuration),
pod: restoredPod,
minHistogramSampleCount: ptr.To(uint64(1)),
minHistogramSampleCount: new(uint64(1)),
},
"checkpoint errors": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricCheckpointErrorsTotal),
pod: restoredPod,
counterValue: ptr.To(float64(0)),
counterValue: new(float64(0)),
},
"restore errors": {
metric: prometheus.BuildFQName(manager.MetricsNamespace, "", manager.MetricRestoreErrorsTotal),
pod: restoredPod,
counterValue: ptr.To(float64(0)),
counterValue: new(float64(0)),
},
}

Expand Down
10 changes: 3 additions & 7 deletions e2e/kind.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
featureGates:
InPlacePodVerticalScaling: true
UserNamespacesSupport: true
InPlacePodVerticalScalingAllocatedStatus: true
nodes:
- role: control-plane
image: kindest/node:v1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a
image: kindest/node:v1.36.1@sha256:3489c7674813ba5d8b1a9977baea8a6e553784dab7b84759d1014dbd78f7ebd5
- role: worker
image: kindest/node:v1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a
image: kindest/node:v1.36.1@sha256:3489c7674813ba5d8b1a9977baea8a6e553784dab7b84759d1014dbd78f7ebd5
labels:
zeropod.ctrox.dev/node: "true"
- role: worker
image: kindest/node:v1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a
image: kindest/node:v1.36.1@sha256:3489c7674813ba5d8b1a9977baea8a6e553784dab7b84759d1014dbd78f7ebd5
labels:
zeropod.ctrox.dev/node: "true"
6 changes: 3 additions & 3 deletions e2e/portforward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/util/httpstream"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/portforward"
"k8s.io/client-go/transport/spdy"
"k8s.io/streaming/pkg/httpstream"
)

// Used for creating a port forward into a Kubernetes pod
Expand Down Expand Up @@ -90,7 +90,7 @@ func (p *PortForward) Start() error {
}

discard := io.Discard
pf, err := portforward.New(dialer, ports, p.stopChan, readyChan, discard, discard)
pf, err := portforward.NewForStreaming(dialer, ports, p.stopChan, readyChan, discard, discard)
if err != nil {
return errors.Wrap(err, "Could not port forward into pod")
}
Expand Down Expand Up @@ -160,7 +160,7 @@ func (p *PortForward) dialer() (httpstream.Dialer, error) {
return nil, errors.Wrap(err, "Could not create round tripper")
}

dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", url)
dialer := spdy.NewDialerForStreaming(upgrader, &http.Client{Transport: transport}, "POST", url)
return dialer, nil
}

Expand Down
10 changes: 5 additions & 5 deletions e2e/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
Expand All @@ -48,7 +49,6 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/remotecommand"
"k8s.io/client-go/util/retry"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/kind/pkg/apis/config/v1alpha4"
Expand Down Expand Up @@ -478,7 +478,7 @@ func testPod(opts ...podOption) *corev1.Pod {
Labels: map[string]string{"app": "zeropod-e2e"},
},
Spec: corev1.PodSpec{
RuntimeClassName: ptr.To(v1.RuntimeClassName),
RuntimeClassName: new(v1.RuntimeClassName),
},
}

Expand Down Expand Up @@ -554,7 +554,7 @@ func freezerDeployment(name, namespace string, memoryMiB int, opts ...podOption)
"name": name,
},
},
Replicas: ptr.To(int32(1)),
Replicas: new(int32(1)),
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
Expand All @@ -563,7 +563,7 @@ func freezerDeployment(name, namespace string, memoryMiB int, opts ...podOption)
},
},
Spec: corev1.PodSpec{
RuntimeClassName: ptr.To(v1.RuntimeClassName),
RuntimeClassName: new(v1.RuntimeClassName),
Containers: []corev1.Container{{
Name: "freezer",
Image: "ghcr.io/ctrox/zeropod-freezer",
Expand Down Expand Up @@ -946,7 +946,7 @@ func getNodeMetrics(ctx context.Context, c client.Client, cfg *rest.Config) (map
return nil, err
}

var parser expfmt.TextParser
parser := expfmt.NewTextParser(model.UTF8Validation)
m, err := parser.TextToMetricFamilies(resp.Body)
if err != nil {
return nil, err
Expand Down
Loading
Loading