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

Drop the use dprotaso/controller-tools fork #15664

Merged
merged 9 commits into from
Jan 9, 2025

Conversation

dprotaso
Copy link
Member

Keeping the fork up to date is not really tenable and it's fairly complex. We now simply manipulate the resulting CRD yaml after generation

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 27, 2024
@knative-prow knative-prow bot requested review from izabelacg and skonto December 27, 2024 16:50
@dprotaso
Copy link
Member Author

cc @skonto

I need to revisit some new attributes that were added so marking WIP for now

Copy link

codecov bot commented Dec 27, 2024

Codecov Report

Attention: Patch coverage is 4.36187% with 592 lines in your changes missing coverage. Please review.

Project coverage is 80.75%. Comparing base (79f8c3f) to head (b7673dd).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cmd/schema-tweak/overrides.go 0.00% 341 Missing ⚠️
cmd/schema-tweak/main.go 0.00% 162 Missing ⚠️
cmd/schema-tweak/yaml.go 0.00% 88 Missing ⚠️
pkg/apis/config/features.go 96.42% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15664      +/-   ##
==========================================
- Coverage   83.48%   80.75%   -2.74%     
==========================================
  Files         219      222       +3     
  Lines       17432    18024     +592     
==========================================
+ Hits        14553    14555       +2     
- Misses       2504     3096     +592     
+ Partials      375      373       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dprotaso dprotaso changed the title [wip] Drop the use dprotaso/controller-tools fork Drop the use dprotaso/controller-tools fork Dec 28, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 28, 2024
@dprotaso
Copy link
Member Author

/assign @skonto

This should unblock your k8s bump

@dprotaso
Copy link
Member Author

/retest

@skonto skonto added this to the v1.17.0 milestone Jan 7, 2025
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 7, 2025
@skonto
Copy link
Contributor

skonto commented Jan 7, 2025

@dprotaso hi, could you update the PR?

Keeping the fork up to date is not really tenable and it's
fairly complex. We now simply manipulate the resulting
CRD yaml after generation
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2025
@skonto
Copy link
Contributor

skonto commented Jan 8, 2025

  • Adding a new flag & attribute:
diff --git a/cmd/schema-tweak/overrides.go b/cmd/schema-tweak/overrides.go
index c111d0770..d4fd19bcb 100644
--- a/cmd/schema-tweak/overrides.go
+++ b/cmd/schema-tweak/overrides.go
@@ -243,6 +243,9 @@ func revSpecOverrides(prefixPath string) []entry {
                }, {
                        name: "hostPath",
                        flag: "kubernetes.podspec-hostpath",
+               }, {
+                       name: "csi",
+                       flag: "kubernetes.podspec-csi",
                }},
        }, {
                path: "volumes.secret",

works as expected generating the new field in all related resource files:

+++ b/config/core/300-resources/configuration.yaml
@@ -1163,6 +1163,10 @@ spec:
                                     description: optional specify whether the ConfigMap or its keys must be defined
                                     type: boolean
                                 x-kubernetes-map-type: atomic
+                              csi:
+                                description: This is accessible behind a feature flag - kubernetes.podspec-csi
+                                type: object
+                                x-kubernetes-preserve-unknown-fields: true
                               emptyDir:
                                 description: |-
                                   This is accessible behind a feature flag - kubernetes.podspec-emptydir
  • Adding a new attribute (not behind a flag):
+++ b/cmd/schema-tweak/overrides.go
@@ -120,6 +120,7 @@ func revSpecOverrides(prefixPath string) []entry {
                        "terminationMessagePolicy",
                        "volumeMounts",
                        "workingDir",
+                       "resizePolicy",
                ),
        }, {

generates the expected output:

+++ b/config/core/300-resources/configuration.yaml
@@ -624,6 +624,27 @@ spec:
                                       More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
                                     type: integer
                                     format: int32
+                              resizePolicy:
+                                description: Resources resize policy for the container.
+                                type: array
+                                items:
+                                  description: ContainerResizePolicy represents resource resize policy for the container.
+                                  type: object
+                                  required:
+                                    - resourceName
+                                    - restartPolicy
+                                  properties:
+                                    resourceName:
+                                      description: |-
+                                        Name of the resource to which this resource resize policy applies.
+                                        Supported values: cpu, memory.
+                                      type: string
+                                    restartPolicy:
+                                      description: |-
+                                        Restart policy to apply when specified resource is resized.
+                                        If not specified, it defaults to NotRequired.
+                                      type: string
+                                x-kubernetes-list-type: atomic
                               resources:
                                 description: |-
                                   Compute Resources required by this container.
@@ -1163,6 +1184,10 @@ spec:

Should we add tests in case we need to fix something, instead of doing it manually?

log.Fatalln("failed to read CRD directory", err)
}

for _, file := range files {
Copy link
Contributor

Choose a reason for hiding this comment

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

Although it is fast already could this be done concurrently? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's worth the complexity this would introduce - eg. right now I just log.Fatalf which quits the program.

Doing it concurrently would require changing it to return errors etc.

cmd/schema-tweak/main.go Outdated Show resolved Hide resolved
@dprotaso
Copy link
Member Author

dprotaso commented Jan 8, 2025

/retest

@dprotaso
Copy link
Member Author

dprotaso commented Jan 8, 2025

kourier-tls failure

/retest

@dprotaso
Copy link
Member Author

dprotaso commented Jan 9, 2025

again kourier-tls
/retest

}

func applyOverrideEntry(node *yaml.Node, entry entry) {
for _, segment := range strings.Split(entry.path, ".") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess there is no way to quickly reference a path (its node) so we have to iterate.

@skonto
Copy link
Contributor

skonto commented Jan 9, 2025

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 9, 2025
Copy link

knative-prow bot commented Jan 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, skonto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit 3216ab3 into knative:main Jan 9, 2025
68 checks passed
@dprotaso dprotaso deleted the schema-tweak branch January 9, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants