Skip to content

Commit

Permalink
Upgrade to Gateway v1.0.0
Browse files Browse the repository at this point in the history
This turned out to be a huge change since there are now CRDs in the
v1alpha2, v1beta1, and v1 spaces. I also had to upgrade a bunch of
other components since the Gateway folks bundle a bunch of code
together with the CRDs. Things I didn't think I would have to upgrade,
but ended up having to upgrade include the core k8s APIs, the
controller runtime, even golang itself! Luckily Debian has go 1.22 in
its backports repo so I don't need to fall back to an ad-hoc go.
  • Loading branch information
caboteria committed May 29, 2024
1 parent 800b863 commit 0fa9793
Show file tree
Hide file tree
Showing 42 changed files with 831 additions and 1,432 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with: {go-version: '=1.19.8'}
with: {go-version: '=1.22.0'}

- name: Decide what we're going to call this
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ before_script:

generate:
stage: check
image: golang:1.19-bullseye
image: golang:1.22-bookworm
before_script:
- *debian-setup
- *git-setup
Expand All @@ -59,7 +59,7 @@ build-image:

k8s-manifest:
stage: build
image: golang:1.19-bullseye
image: golang:1.22-bookworm
before_script:
- *debian-setup
- *tag-setup
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-bullseye as builder
FROM golang:1.22-bookworm as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ IMG ?= ${IMAGE_TAG_BASE}/pure-gateway:${VERSION}
ENVTEST_K8S_VERSION = 1.22

# Tools that we use.
CONTROLLER_GEN = go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0
CONTROLLER_GEN = go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
KUSTOMIZE = go run sigs.k8s.io/kustomize/kustomize/v4@v4.5.2
ENVTEST = go run sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20231206145619-1ea2be573f78

Expand Down
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ resources:
domain: networking.k8s.io
group: gateway
kind: Gateway
version: v1alpha2
version: v1
- controller: true
domain: discovery.k8s.io
group: discovery
Expand All @@ -36,7 +36,7 @@ resources:
domain: networking.k8s.io
group: gateway
kind: HTTPRoute
version: v1alpha2
version: v1
- api:
crdVersion: v1
namespaced: true
Expand All @@ -49,5 +49,5 @@ resources:
domain: networking.k8s.io
group: gateway
kind: GatewayClass
version: v1alpha2
version: v1
version: "3"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PureGW
======

Client implementation of the Kubernetes Gateway-SIG Gateway v1alpha2
Client implementation of the Kubernetes Gateway-SIG Gateway v1
API that works with the EPIC Gateway server.

https://gateway-api.sigs.k8s.io/
Expand All @@ -13,7 +13,7 @@ Before installing PureGW you need to install the k8s Gateway-SIG
custom resource definitions manually. Eventually they'll be bundled
into k8s but they aren't yet.

https://gateway-api.sigs.k8s.io/v1alpha2/guides/getting-started/#installing-gateway-api-crds-manually
https://gateway-api.sigs.k8s.io/guides/#install-experimental-channel

We haven't implemented Helm charts yet so installation uses
old-fashioned yaml manifests. To install PureGW, apply
Expand Down
4 changes: 2 additions & 2 deletions apis/puregw/v1/endpointsliceshadow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1"
)

// EndpointSliceShadowSpec defines the desired state of EndpointSliceShadow
Expand All @@ -20,7 +20,7 @@ type EndpointSliceShadowSpec struct {

// ParentRoutes provides an efficient way to link back to the
// HTTPRoutes that reference this slice.
ParentRoutes []gatewayv1a2.ParentReference `json:"parentRoutes"`
ParentRoutes []gatewayapi.ParentReference `json:"parentRoutes"`
}

// EndpointSliceShadowStatus defines the observed state of EndpointSliceShadow
Expand Down
6 changes: 3 additions & 3 deletions apis/puregw/v1/supported_kinds.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ Copyright 2022 Acnodal.
package v1

import (
gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1"
)

var (
// SupportedKinds contains the list of Kinds that EPIC currently
// supports.
SupportedKinds []gatewayv1a2.Kind = []gatewayv1a2.Kind{"HTTPRoute"}
SupportedKinds []gatewayapi.Kind = []gatewayapi.Kind{"HTTPRoute"}
)

// SupportedKind indicates whether the given Kind is supported by EPIC
// or not.
func SupportedKind(kind gatewayv1a2.Kind) bool {
func SupportedKind(kind gatewayapi.Kind) bool {
for _, valid := range SupportedKinds {
if kind == valid {
return true
Expand Down
12 changes: 8 additions & 4 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi_v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi_v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"

epicgwv1 "epic-gateway.org/puregw/apis/puregw/v1"
ti "epic-gateway.org/puregw/internal/trueingress"
Expand All @@ -38,7 +41,9 @@ var (

func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(gatewayv1a2.AddToScheme(scheme))
utilruntime.Must(gatewayapi.Install(scheme))
utilruntime.Must(gatewayapi_v1alpha2.Install(scheme))
utilruntime.Must(gatewayapi_v1beta1.Install(scheme))
utilruntime.Must(epicgwv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}
Expand Down Expand Up @@ -67,8 +72,7 @@ func main() {

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Metrics: metricsserver.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
LeaderElection: false,
})
Expand Down
12 changes: 8 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

gatewayv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi_v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapi_v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"

epicgwv1 "epic-gateway.org/puregw/apis/puregw/v1"
discoverycontrollers "epic-gateway.org/puregw/controllers/discovery"
Expand All @@ -36,7 +39,9 @@ var (

func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(gatewayv1a2.AddToScheme(scheme))
utilruntime.Must(gatewayapi.Install(scheme))
utilruntime.Must(gatewayapi_v1alpha2.Install(scheme))
utilruntime.Must(gatewayapi_v1beta1.Install(scheme))
utilruntime.Must(epicgwv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}
Expand All @@ -61,8 +66,7 @@ func main() {

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Metrics: metricsserver.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "3ea9bd30.epic-gateway.org",
Expand Down
Loading

0 comments on commit 0fa9793

Please sign in to comment.