Skip to content

Commit

Permalink
Merge pull request #14 from jwcesign/main
Browse files Browse the repository at this point in the history
feat: support ContainerOptimizedOS resolving
  • Loading branch information
jwcesign authored Mar 2, 2025
2 parents 9d34caa + 3b3fc04 commit 8f1df04
Show file tree
Hide file tree
Showing 249 changed files with 38,834 additions and 815 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ go.work.sum
.idea/
.vscode/
.DS_Store
demo
145 changes: 86 additions & 59 deletions charts/karpenter/crds/karpenter.k8s.gcp_gcenodeclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.2
name: gcenodeclasses.karpenter.k8s.gcp
spec:
group: karpenter.k8s.gcp
Expand Down Expand Up @@ -46,6 +46,48 @@ spec:
GCENodeClassSpec is the top level specification for the GCP Karpenter Provider.
This will contain the configuration necessary to launch instances in GCP.
properties:
imageSelectorTerms:
description: ImageSelectorTerms is a list of or image selector terms.
The terms are ORed.
items:
description: |-
ImageSelectorTerm defines selection logic for an image used by Karpenter to launch nodes.
If multiple fields are used for selection, the requirements are ANDed.
properties:
alias:
description: |-
Alias specifies which ACK image to select.
Each alias consists of a family and an image version, specified as "family@version".
Valid families include: ContainerOptimizedOS,Ubuntu
Setting the version to latest will result in drift when a new Image is released. This is **not** recommended for production environments.
maxLength: 30
type: string
x-kubernetes-validations:
- message: '''alias'' is improperly formatted, must match the
format ''family'''
rule: self.matches('^[a-zA-Z0-9]*$')
- message: 'family is not supported, must be one of the following:
''ContainerOptimizedOS,Ubuntu'''
rule: self.find('^[^@]+') in ['ContainerOptimizedOS', 'Ubuntu']
id:
description: ID is the image id in ECS
type: string
type: object
maxItems: 30
minItems: 1
type: array
x-kubernetes-validations:
- message: expected at least one, got none, ['id', 'alias']
rule: self.all(x, has(x.id) || has(x.alias))
- message: '''id'' is mutually exclusive, cannot be set with a combination
of other fields in imageSelectorTerms'
rule: '!self.exists(x, has(x.id) && (has(x.alias)))'
- message: '''alias'' is mutually exclusive, cannot be set with a
combination of other fields in imageSelectorTerms'
rule: '!self.exists(x, has(x.alias) && (has(x.id)))'
- message: '''alias'' is mutually exclusive, cannot be set with a
combination of other imageSelectorTerms'
rule: '!(self.exists(x, has(x.alias)) && self.size() != 1)'
kubeletConfiguration:
description: |-
KubeletConfiguration defines args to be used when configuring kubelet on provisioned nodes.
Expand Down Expand Up @@ -169,52 +211,6 @@ spec:
evictionSoft
rule: has(self.evictionSoftGracePeriod) ? self.evictionSoftGracePeriod.all(e,
(e in self.evictionSoft)):true
resourceGroupId:
description: ResourceGroupID is the resource group id in GCE
pattern: rg-[0-9a-z]+
type: string
securityGroupSelectorTerms:
description: SecurityGroupSelectorTerms is a list of or security group
selector terms. The terms are ORed.
items:
description: |-
SecurityGroupSelectorTerm defines selection logic for a security group used by Karpenter to launch nodes.
If multiple fields are used for selection, the requirements are ANDed.
properties:
id:
description: ID is the security group id in GCE
pattern: sg-[0-9a-z]+
type: string
name:
description: |-
Name is the security group name in GCE.
This value is the name field, which is different from the name tag.
type: string
tags:
additionalProperties:
type: string
description: |-
Tags is a map of key/value tags used to select vSwitches
Specifying '*' for a value selects all values for a given tag key.
maxProperties: 20
type: object
x-kubernetes-validations:
- message: empty tag keys aren't supported
rule: self.all(k, k != '')
type: object
maxItems: 30
type: array
x-kubernetes-validations:
- message: securityGroupSelectorTerms cannot be empty
rule: self.size() != 0
- message: expected at least one, got none, ['tags', 'id', 'name']
rule: self.all(x, has(x.tags) || has(x.id) || has(x.name))
- message: '''id'' is mutually exclusive, cannot be set with a combination
of other fields in securityGroupSelectorTerms'
rule: '!self.all(x, has(x.id) && (has(x.tags) || has(x.name)))'
- message: '''name'' is mutually exclusive, cannot be set with a combination
of other fields in securityGroupSelectorTerms'
rule: '!self.all(x, has(x.name) && (has(x.tags) || has(x.id)))'
tags:
additionalProperties:
type: string
Expand All @@ -235,7 +231,7 @@ spec:
- message: tag contains a restricted tag matching karpenter.k8s.gcp/gcenodeclass
rule: self.all(k, k !='karpenter.k8s.gcp/gcenodeclass')
required:
- securityGroupSelectorTerms
- imageSelectorTerms
type: object
status:
description: GCENodeClassStatus contains the resolved state of the GCENodeClass
Expand Down Expand Up @@ -297,22 +293,53 @@ spec:
- type
type: object
type: array
securityGroups:
images:
description: |-
SecurityGroups contains the current Security Groups values that are available to the
cluster under the SecurityGroups selectors.
Image contains the current image that are available to the
cluster under the Image selectors.
items:
description: SecurityGroup contains resolved SecurityGroup selector
values utilized for node launch
description: Image contains resolved image selector values utilized
for node launch
properties:
id:
description: ID of the security group
type: string
name:
description: Name of the security group
requirements:
description: Requirements of the Image to be utilized on an
instance type
items:
description: |-
A node selector requirement is a selector that contains values, a key, and an operator
that relates the key and values.
properties:
key:
description: The label key that the selector applies to.
type: string
operator:
description: |-
Represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
type: string
values:
description: |-
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. If the operator is Gt or Lt, the values
array must have a single element, which will be interpreted as an integer.
This array is replaced during a strategic merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
sourceImage:
description: SourceImage represents the source image, format
like projects/gke-node-images/global/images/gke-1309-gke1046000-cos-113-18244-291-9-c-pre
type: string
required:
- id
- requirements
- sourceImage
type: object
type: array
type: object
Expand Down
Loading

0 comments on commit 8f1df04

Please sign in to comment.