Skip to content

Switch to PodTemplate object in CRDs #815

Description

@yorugac

Background

We've added a .spec.podTemplate field to the PrivateLoadZone CRD in v1.3.0. It allows setting a few fields that will be applied to all TestRuns and pods started by that PrivateLoadZone.

The PrivateLoadZone CRD embeds an actual Kubernetes PodTemplate object, but the CRD itself is generated with a validation patch that allows only a limited set of fields.

What

This addition was the first step towards us adopting PodTemplate everywhere. We intend to gradually relax those validation restrictions in the patch, as we get ready to support more fields. The same goes for the TestRun CRD: the PrivateLoadZone CRD is built on top of TestRun and it cannot be fully "relaxed" without changing TestRun in turn.

Why

  • We observed a clear pattern of repetitive additions of fields to the TestRun CRD as people need greater flexibility to configure their workloads according to their use case.
    • The pace of additions tapered off a bit recently (for TestRun), but the Pod's definition changes with time as well.
    • Using PodTemplate allows us to unlock all configuration options at once and simplify the current process.
    • The PrivateLoadZone CRD supports only a subset of what is provided by the TestRun CRD, and we might need to go through the same repetitive process for it.
  • k6-operator needs to control only a small number of fields and does not "care" about other fields, so most such additions are simple pass-throughs.
    • Using PodTemplate will result in simpler code (once it's fully utilized in TestRun) and let Kubernetes-native validation do the rest.

There are some drawbacks to this decision too, for example, the need to find suitable workarounds for containers.

Scope

Of course, this is a rather large undertaking so it'll take some time and multiple steps. At least for the TestRun CRD, this will be a breaking change. This issue is meant to be an umbrella for the switch as a whole: additional issues and PRs can be added as needed.

If there are strong opinions on this topic, please do share in the comments!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CRDImplies changes to CRD definitions.PLZbreaking changeBreaking change can impact some existing workflows.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions