Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop defaulting within the template blocks #704

Closed
EronWright opened this issue Oct 3, 2024 · 3 comments
Closed

Stop defaulting within the template blocks #704

EronWright opened this issue Oct 3, 2024 · 3 comments
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed

Comments

@EronWright
Copy link
Contributor

EronWright commented Oct 3, 2024

The type of the StackSpec.workspaceTemplate field should be an "apply" variant, similar to k8s.io/client-go/applyconfigurations; it should not set any default values. Otherwise it makes for noise in the higher-level APIs and overstates their intentions.

For example, when we apply a given stack:

kind: Stack
spec:
  workspaceTemplate:
    spec:
      image: pulumi/pulumi:3.134.1-nonroot

We get:

kind: Stack
spec:
  workspaceTemplate:
    metadata: {}
    spec:
      image: pulumi/pulumi:3.134.1-nonroot
      resources: {}
      securityProfile: restricted
      serviceAccountName: default
@EronWright EronWright self-assigned this Oct 3, 2024
@cleverguy25
Copy link

Added to epic #586

@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Oct 3, 2024
@blampe
Copy link
Contributor

blampe commented Oct 3, 2024

I think this is more to do with the WorkspaceSpec embedded in the Stack. We probably want an annotation to disable defaults on it (if there is such a thing) or create a separate Partial/Embedded type without defaults.

https://github.com/pulumi/pulumi-kubernetes-operator/blob/58b053960356ce484dee24a47f5aaed475ba9f7d/operator/config/crd/bases/pulumi.com_stacks.yaml#L9340-L9344

@blampe blampe removed the needs-triage Needs attention from the triage team label Oct 3, 2024
@mikhailshilkov mikhailshilkov added the kind/enhancement Improvements or new features label Oct 7, 2024
@EronWright
Copy link
Contributor Author

@blampe there's a code generator for just this purpose (applyconfigurations), to generate an EmbeddedWorkspaceSpec.

The same issue is present with PodTemplate in the WorkspaceSpec. IIRC there was a problem with DeepCopy being missing on the generated code, need to revisit it.

@EronWright EronWright assigned blampe and unassigned EronWright Oct 14, 2024
blampe added a commit that referenced this issue Oct 17, 2024
This adds `applyconfiguration-gen` to generate apply configurations for
our APIs. The workspace template is updated to use it.

It's a moderately uphill battle to get apply configurations working with
controllers due to various pieces not including built-in support for
them. In practice this means we need to cut a couple small corners -- in
particular implementing our own `DeepCopy` and tweaking the generated
`GroupVersion` code.

Fixes #704.
@EronWright EronWright added the resolution/fixed This issue was fixed label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
Status: Done
Development

No branches or pull requests

5 participants