Skip to content

Commit

Permalink
Bump kubernetes to 1.27 operator and target allocator (#1653)
Browse files Browse the repository at this point in the history
* Bump kubernetes to 1.27 everywhere

* fix broken updates

* Fix dep order

* rename

* upgrade controller-gen and kustomize

* bump allocator deps

* unbump opamp bridge for now

* upgrade deprecations

* fix kuttl test

* bundle
  • Loading branch information
jaronoff97 authored May 31, 2023
1 parent e68ee34 commit d6d9f2f
Show file tree
Hide file tree
Showing 27 changed files with 531 additions and 519 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# should be compatible with them.
kube-version:
- "1.19"
- "1.26"
- "1.27"
group:
- e2e e2e-upgrade
- e2e-autoscale
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
matrix:
kube-version:
- "1.19"
- "1.26"
- "1.27"

steps:

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
CHLOGGEN ?= $(LOCALBIN)/chloggen

KUSTOMIZE_VERSION ?= v5.0.0
CONTROLLER_TOOLS_VERSION ?= v0.11.3
KUSTOMIZE_VERSION ?= v5.0.3
CONTROLLER_TOOLS_VERSION ?= v0.12.0


.PHONY: kustomize
Expand Down
13 changes: 7 additions & 6 deletions apis/v1alpha1/instrumentation_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

const (
Expand Down Expand Up @@ -177,21 +178,21 @@ func (r *Instrumentation) Default() {
var _ webhook.Validator = &Instrumentation{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *Instrumentation) ValidateCreate() error {
func (r *Instrumentation) ValidateCreate() (admission.Warnings, error) {
instrumentationlog.Info("validate create", "name", r.Name)
return r.validate()
return nil, r.validate()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *Instrumentation) ValidateUpdate(old runtime.Object) error {
func (r *Instrumentation) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
instrumentationlog.Info("validate update", "name", r.Name)
return r.validate()
return nil, r.validate()
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *Instrumentation) ValidateDelete() error {
func (r *Instrumentation) ValidateDelete() (admission.Warnings, error) {
instrumentationlog.Info("validate delete", "name", r.Name)
return nil
return nil, nil
}

func (r *Instrumentation) validate() error {
Expand Down
14 changes: 10 additions & 4 deletions apis/v1alpha1/instrumentation_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ func TestInstrumentationValidatingWebhook(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
if test.err == "" {
assert.Nil(t, test.inst.ValidateCreate())
assert.Nil(t, test.inst.ValidateUpdate(nil))
warnings, err := test.inst.ValidateCreate()
assert.Nil(t, warnings)
assert.Nil(t, err)
warnings, err = test.inst.ValidateUpdate(nil)
assert.Nil(t, warnings)
assert.Nil(t, err)
} else {
err := test.inst.ValidateCreate()
warnings, err := test.inst.ValidateCreate()
assert.Nil(t, warnings)
assert.Contains(t, err.Error(), test.err)
err = test.inst.ValidateUpdate(nil)
warnings, err = test.inst.ValidateUpdate(nil)
assert.Nil(t, warnings)
assert.Contains(t, err.Error(), test.err)
}
})
Expand Down
13 changes: 7 additions & 6 deletions apis/v1alpha1/opentelemetrycollector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
ta "github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator/adapters"
Expand Down Expand Up @@ -116,21 +117,21 @@ func (r *OpenTelemetryCollector) Default() {
var _ webhook.Validator = &OpenTelemetryCollector{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *OpenTelemetryCollector) ValidateCreate() error {
func (r *OpenTelemetryCollector) ValidateCreate() (admission.Warnings, error) {
opentelemetrycollectorlog.Info("validate create", "name", r.Name)
return r.validateCRDSpec()
return nil, r.validateCRDSpec()
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *OpenTelemetryCollector) ValidateUpdate(old runtime.Object) error {
func (r *OpenTelemetryCollector) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
opentelemetrycollectorlog.Info("validate update", "name", r.Name)
return r.validateCRDSpec()
return nil, r.validateCRDSpec()
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *OpenTelemetryCollector) ValidateDelete() error {
func (r *OpenTelemetryCollector) ValidateDelete() (admission.Warnings, error) {
opentelemetrycollectorlog.Info("validate delete", "name", r.Name)
return nil
return nil, nil
}

func (r *OpenTelemetryCollector) validateCRDSpec() error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata:
categories: Logging & Tracing
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
createdAt: "2023-05-24T11:54:55Z"
createdAt: "2023-05-31T15:42:55Z"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.27.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down
20 changes: 13 additions & 7 deletions bundle/manifests/opentelemetry.io_instrumentations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
controller-gen.kubebuilder.io/version: v0.12.0
creationTimestamp: null
labels:
app.kubernetes.io/name: opentelemetry-operator
Expand Down Expand Up @@ -343,7 +343,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
version:
Expand Down Expand Up @@ -520,7 +521,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
type: object
Expand Down Expand Up @@ -818,7 +820,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
type: object
Expand Down Expand Up @@ -992,7 +995,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
type: object
Expand Down Expand Up @@ -1165,7 +1169,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
type: object
Expand Down Expand Up @@ -1355,7 +1360,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
type: object
Expand Down
Loading

0 comments on commit d6d9f2f

Please sign in to comment.