Open
Conversation
HT154
requested changes
Apr 7, 2026
Contributor
HT154
left a comment
There was a problem hiding this comment.
Apologies for the delay on this. We needed to discuss how we intend to support CRDs like this in pkl-pantry. Here's how we're approaching this:
- We will happily accept generated packages containing K8s CRD.
- We (the Pkl team) will rely on community contributions to keep these packages up to date with their upstream software.
Comment on lines
+2
to
+4
| set -euo pipefail | ||
|
|
||
| BASE_URL="https://raw.githubusercontent.com/cilium/cilium/refs/heads/main/pkg/k8s/apis/cilium.io/client/crds" |
Contributor
There was a problem hiding this comment.
This script must be run from the package root.
Suggested change
| set -euo pipefail | |
| BASE_URL="https://raw.githubusercontent.com/cilium/cilium/refs/heads/main/pkg/k8s/apis/cilium.io/client/crds" | |
| set -euo pipefail | |
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | |
| cd "$SCRIPT_DIR" | |
| BASE_URL="https://raw.githubusercontent.com/cilium/cilium/refs/heads/main/pkg/k8s/apis/cilium.io/client/crds" |
Comment on lines
+42
to
+44
| done | ||
|
|
||
| echo "Done!" |
Contributor
There was a problem hiding this comment.
Much nicer to format inline when generating code!
Suggested change
| done | |
| echo "Done!" | |
| done | |
| echo "Formatting..." | |
| cd ../.. | |
| ./gradlew spotlessApply | |
| echo "Done!" |
Comment on lines
+114
to
+141
| /// Selector is a label selector to select objects of the type specified by AdvertisementType. For the | ||
| /// PodCIDR AdvertisementType it is not applicable. For other advertisement types, if not specified, no | ||
| /// objects of the type specified by AdvertisementType are selected for advertisement. | ||
| class Selector { | ||
| /// matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||
| matchExpressions: Listing<MatchExpression>? | ||
|
|
||
| /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is | ||
| /// equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and | ||
| /// the values array contains only "value". The requirements are ANDed. | ||
| matchLabels: Mapping<String, String(length <= 63, matches(Regex("^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$")))>? | ||
| } | ||
|
|
||
| /// A label selector requirement is a selector that contains values, a key, and an operator that relates | ||
| /// the key and values. | ||
| class MatchExpression { | ||
| /// key is the label key that the selector applies to. | ||
| key: String | ||
|
|
||
| /// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists | ||
| /// and DoesNotExist. | ||
| operator: "In"|"NotIn"|"Exists"|"DoesNotExist" | ||
|
|
||
| /// values is an array of string values. If the operator is In or NotIn, the values array must be | ||
| /// non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is | ||
| /// replaced during a strategic merge patch. | ||
| values: Listing<String>? | ||
| } |
Contributor
There was a problem hiding this comment.
These classes (and others like NodeSelector) are repeated several times and are (largely) identical. It would be best to pull these out into a common file so that a Selector or MatchExpression from a CiliumBGPAdvertisement can be reused for CiliumEgressGatewayPolicy and others.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cilium is a widely used CNI for k8s clusters. We're trying to keep all our k8s configs in pkl, so we needed the pkl schemas. I used the k8s.contrib.crd generator to generate the CRDs. I also included some tests, similar to the k8s.networking.gateway CRDs.