Skip to content

Conversation

@andriisoldatenko
Copy link
Contributor

@andriisoldatenko andriisoldatenko commented Jan 23, 2026

Description

Similar to #6053 but includes changes to fix CI.

Note

controller-runtime has breaking changes more details https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.23.0

DAQ-20001

How can this be tested?

unit-test/ e2e tests where we can check webhooks.

  • migration of new events API requires proper testing

@github-actions github-actions bot added the edgeconnect Changes related to EdgeConnect label Jan 23, 2026
@Incredible-O Incredible-O added dependencies Changes in our dependencies and removed edgeconnect Changes related to EdgeConnect labels Jan 23, 2026
@github-actions github-actions bot added the edgeconnect Changes related to EdgeConnect label Jan 26, 2026
@avorima
Copy link
Contributor

avorima commented Jan 26, 2026

I think we should slow down a bit here. This isn't the only thing that this release introduces and we should take a step back and evaluate. This can serve as a kick-off for more broader changes to the structure and layout of the project.

If the dependency update is this pressing, I'd prefer if we keep the changes minimal by continuing to use the CustomValidator.

@andriisoldatenko
Copy link
Contributor Author

andriisoldatenko commented Jan 26, 2026

I think we should slow down a bit here. This isn't the only thing that this release introduces and we should take a step back and evaluate. This can serve as a kick-off for more broader changes to the structure and layout of the project.

If the dependency update is this pressing, I'd prefer if we keep the changes minimal by continuing to use the CustomValidator.

Release introduces a few breaking changes:

  • Webhooks: Generic Validator and Defaulter by  in #3360

    • Existing code of the form builder.WebhookManagedBy(mgr).For(&corev1.Deployment{}) has to be changed to builder.WebhookManagedBy(mgr, &appsv1.Deployment{})
    • Existing webhook implementations have to be changed to take the concrete object rather than runtime.Object, for example from ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) to ValidateCreate(ctx context.Context, obj *appsv1.Deployment) (admission.Warnings, error)
  • Events: Migration to the new events API in #​3262
    Using the new GetEventRecorderFor requires updating your rbac for events to use the events.k8s.io apiGroup rather than the `` (core) apiGroup

This one I'm working on right now done in the latest commits.

@andriisoldatenko andriisoldatenko marked this pull request as ready for review January 26, 2026 10:43
@andriisoldatenko andriisoldatenko requested a review from a team as a code owner January 26, 2026 10:43
)

func missingDatabaseExecutorImage(_ context.Context, _ *Validator, dk *dynakube.DynaKube) string {
func missingDatabaseExecutorImage(_ context.Context, _ *validatorClient, dk *dynakube.DynaKube) string {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB (for reviwer):

we can also rename validator to validatorType or something similar

type validator[T DynaKubeType] struct {
	*validatorClient
}

and validatorClient back to Validator to reduce amount of changes in this PR

@andriisoldatenko andriisoldatenko removed the edgeconnect Changes related to EdgeConnect label Jan 26, 2026
@github-actions github-actions bot added the edgeconnect Changes related to EdgeConnect label Jan 27, 2026
@avorima avorima self-assigned this Jan 27, 2026
Copy link
Contributor

@avorima avorima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing RBAC for events.k8s.io

)

func invalidActiveGateProxyURL(ctx context.Context, dv *Validator, dk *dynakube.DynaKube) string {
func invalidActiveGateProxyURL(ctx context.Context, dv *validatorClient, dk *dynakube.DynaKube) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename variable to vc to stay consistent. also in

pkg/api/validation/dynakube/telemetryservice.go
pkg/api/validation/dynakube/validation.go
pkg/api/validation/edgeconnect/validation.go

)

type Validator struct {
type DynaKubeType interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was aleady mentioned in a previous discussion, but specialization doesn't really do much at the cost of having to be kept up-to-date. the getDynaKube function already checks the type at runtime and it's very obvious when you use a non-supported type

type validatorFunc func(ctx context.Context, dv *Validator, dk *dynakube.DynaKube) string
type updateValidatorFunc func(ctx context.Context, dv *Validator, oldDk *dynakube.DynaKube, newDk *dynakube.DynaKube) string
type validatorFunc func(ctx context.Context, dv *validatorClient, dk *dynakube.DynaKube) string
type updateValidatorFunc func(ctx context.Context, dv *validatorClient, oldDk *dynakube.DynaKube, newDk *dynakube.DynaKube) string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
type updateValidatorFunc func(ctx context.Context, dv *validatorClient, oldDk *dynakube.DynaKube, newDk *dynakube.DynaKube) string
type updateValidatorFunc func(ctx context.Context, dv *validatorClient, oldDk, newDk *dynakube.DynaKube) string

if err := v1beta5.SetupWebhookWithManager(mgr, validator); err != nil {
v1beta5Validator := newGenericValidator[*v1beta5.DynaKube](validatorImpl)
if err := ctrl.NewWebhookManagedBy(mgr, &v1beta5.DynaKube{}).
WithValidator(v1beta5Validator). // will create an endpoint at /validate-dynatrace-com-v1beta4-dynakube
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments don't reference the correct endpoint. i think it's a sign that they can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

func isModuleDisabled(_ context.Context, v *Validator, _ *edgeconnect.EdgeConnect) string {
func isModuleDisabled(_ context.Context, v *validatorClient, _ *edgeconnect.EdgeConnect) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vc to stay consistent


func SetupWebhookWithManager(mgr ctrl.Manager) error {
validator := New(mgr.GetAPIReader(), mgr.GetConfig())
validatorImpl := newClient(mgr.GetAPIReader(), mgr.GetConfig())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please align dynakube and edgeconnect validation packages. i prefer the way it's done in edgeconnect since it's more concise

  • validatorClient
  • newValidator instead of newGenericValidator and just call it inline in WithValidator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware of it - i'll fix it!

@andriisoldatenko
Copy link
Contributor Author

#6104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Changes in our dependencies edgeconnect Changes related to EdgeConnect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants