Skip to content

Commit

Permalink
v2.0.1: switch to int32 for JSON compat
Browse files Browse the repository at this point in the history
uint32 values did not properly serialize to/from json when using the
dynamic client. This is needed for testing in KNE.

Introduce a new major version number to accomidate this breaking
change.
  • Loading branch information
frasieroh committed Oct 30, 2022
1 parent 8c5a593 commit 87a18b7
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 1.1.0
VERSION ?= 2.0.1

# Image URL to use all building/pushing image targets
IMG ?= ghcr.io/aristanetworks/arista-ceoslab-operator
Expand Down
10 changes: 5 additions & 5 deletions api/v1alpha1/ceoslabdevice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ type CEosLabDeviceSpec struct {
// Init container image name. Default: networkop/init-wait:latest
InitContainerImage string `json:"initcontainerimage,omitempty"`
// Number of data interfaces to create. An additional interface (eth0) is created for pod connectivity. Default: 0 interfaces
NumInterfaces uint32 `json:"numinterfaces,omitempty"`
NumInterfaces int32 `json:"numinterfaces,omitempty"`
// Time (in seconds) to wait before starting the device. Default: 0 seconds
Sleep uint32 `json:"sleep,omitempty"`
Sleep int32 `json:"sleep,omitempty"`
// X.509 certificate configuration.
CertConfig CertConfig `json:"certconfig,omitempty"`
// Explicit interface mapping between kernel devices and interface names. If this is defined, any unmapped devices are ignored.
Expand All @@ -61,9 +61,9 @@ type ServiceConfig struct {

type PortConfig struct {
// Port inside the container.
In uint32 `json:"in,omitempty"`
In int32 `json:"in,omitempty"`
// Port outside the container. Defaults to the same as in.
Out uint32 `json:"out,omitempty"`
Out int32 `json:"out,omitempty"`
}

type CertConfig struct {
Expand All @@ -77,7 +77,7 @@ type SelfSignedCertConfig struct {
// Key name on the node.
KeyName string `json:"keyname,omitempty"`
// RSA keysize to use for key generation.
KeySize uint32 `json:"keysize,omitempty"`
KeySize int32 `json:"keysize,omitempty"`
// Common name to set in the cert.
CommonName string `json:"commonname,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/client/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package client
import (
"context"

"github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
"github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/clientset/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package clientset
import (
"context"

"github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
intf "github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1/client"
"github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
intf "github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1/client"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/dynamic/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"fmt"

"github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
intf "github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1/client"
"github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
intf "github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1/client"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/dynamic/fake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ limitations under the License.
package fake

import (
"github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
"github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1/dynamic"
"github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
"github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1/dynamic"
"k8s.io/apimachinery/pkg/runtime"
fakeclient "k8s.io/client-go/dynamic/fake"
"k8s.io/client-go/rest"
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&CEosLabDeviceList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
metav1.AddMetaToScheme(scheme)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion config/kustomized/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ spec:
- --leader-elect
command:
- /manager
image: ghcr.io/aristanetworks/arista-ceoslab-operator:v1.1.0
image: ghcr.io/aristanetworks/arista-ceoslab-operator:v2.0.1
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/aristanetworks/arista-ceoslab-operator
newTag: v1.1.0
newTag: v2.0.1
10 changes: 5 additions & 5 deletions controllers/ceoslabdevice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"strings"
"time"

ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -1077,8 +1077,8 @@ func getStartupProbeAPI(device *ceoslabv1alpha1.CEosLabDevice) *corev1.Probe {
},
},
// Try to boot for up to two minutes
TimeoutSeconds: 5,
PeriodSeconds: 5,
TimeoutSeconds: 5,
PeriodSeconds: 5,
FailureThreshold: 24,
}
}
Expand Down Expand Up @@ -1127,8 +1127,8 @@ func getServiceMapFromK8sAPI(service *corev1.Service) map[string]ceoslabv1alpha1
serviceMap[v.Name] = ceoslabv1alpha1.PortConfig{
// We always set TargetPort and Port (see getServiceMap) so we can pull
// out these values naively.
In: uint32(v.TargetPort.IntValue()),
Out: uint32(v.Port),
In: int32(v.TargetPort.IntValue()),
Out: int32(v.Port),
}
}
return serviceMap
Expand Down
2 changes: 1 addition & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
//+kubebuilder:scaffold:imports
)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/aristanetworks/arista-ceoslab-operator
module github.com/aristanetworks/arista-ceoslab-operator/v2

go 1.17

Expand Down
2 changes: 1 addition & 1 deletion kuttl-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ testDirs:
manifestDirs:
- config/kustomized
kindContainers:
- ghcr.io/aristanetworks/arista-ceoslab-operator:v1.1.0
- ghcr.io/aristanetworks/arista-ceoslab-operator:v2.0.1
- ceos:latest
- ceos-2:latest
- networkop/init-wait:latest
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/api/v1alpha1"
"github.com/aristanetworks/arista-ceoslab-operator/controllers"
ceoslabv1alpha1 "github.com/aristanetworks/arista-ceoslab-operator/v2/api/v1alpha1"
"github.com/aristanetworks/arista-ceoslab-operator/v2/controllers"
//+kubebuilder:scaffold:imports
)

Expand Down

0 comments on commit 87a18b7

Please sign in to comment.