From d50ec64e5c14ac50ecb87256a840d3fbd06c181f Mon Sep 17 00:00:00 2001 From: hiteshmakol1 Date: Wed, 8 Jan 2025 11:55:00 +0530 Subject: [PATCH 1/2] Karpenter 0.2.0 Modifications (#266) * Added Comment in Chart, Changed example.yaml file , Added comments in values file * Incorporated Review Comments --- charts/karpenter/Chart.yaml | 4 +- charts/karpenter/example/example.yaml | 106 +++++++++------- charts/karpenter/values.yaml | 174 ++++++++------------------ 3 files changed, 114 insertions(+), 170 deletions(-) diff --git a/charts/karpenter/Chart.yaml b/charts/karpenter/Chart.yaml index 3914ec0..5bc7e8b 100644 --- a/charts/karpenter/Chart.yaml +++ b/charts/karpenter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: ot-karpenter -version: 0.1.0 +version: 0.2.0 dependencies: - name: karpenter - version: 1.1.1 + version: 1.1.1 repository: oci://public.ecr.aws/karpenter diff --git a/charts/karpenter/example/example.yaml b/charts/karpenter/example/example.yaml index 9b9fec1..1274b13 100644 --- a/charts/karpenter/example/example.yaml +++ b/charts/karpenter/example/example.yaml @@ -1,67 +1,83 @@ -# Custom values for chart -clusterName: test-cluster -awsPartition: aws -awsAccountId: 384961113000 -karpenterVersion: 1.1.1 +#This example below has 2 nodepools for reference +# Custom values for your chart +clusterName: "" # Name of the EKS cluster (for identification in the chart and Karpenter) +awsPartition: "" # AWS partition, default is 'aws' (used in multi-region or partitioned environments) +awsAccountId: 3333 # AWS account ID where the resources will be provisioned # Karpenter chart overrides karpenter: settings: - clusterName: test-cluster + clusterName: "" # Cluster name for the Karpenter controller to identify and manage nodes in this cluster + serviceAccount: annotations: - eks.amazonaws.com/role-arn: arn:aws:iam::384961113000:role/KarpenterControllerRole-test-cluster + eks.amazonaws.com/role-arn: arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks # IAM role for Karpenter controller's access to AWS services + controller: resources: requests: - cpu: "1" - memory: "1Gi" - limits: - cpu: "1" - memory: "1Gi" + cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated) + memory: "1Gi" # Memory resource request for the Karpenter controller + limits: + cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume) + memory: "1Gi" # Memory resource limit for the Karpenter controller +# NodePools define groups of nodes with specific requirements nodePools: - - name: default - requirements: + - name: default # Name of the node pool, used for identification + limits: # Required Field + cpu: "1000" + memory: "1000Gi" + disruption: # Required Field + consolidationPolicy: WhenEmptyOrUnderutilized + consolidateAfter: 1m + requirements: # Node pool requirements for instance types and other properties - key: kubernetes.io/arch - operator: In + operator: In # Specifies the architecture for nodes values: - - "amd64" + - "amd64" - key: kubernetes.io/os - operator: In + operator: In # Specifies the OS type for nodes values: - - "linux" + - "linux" # The node pool requires Linux OS - key: karpenter.sh/capacity-type - operator: In + operator: In # Specifies the capacity type for nodes values: - - "on-demand" + - "on-demand" - key: karpenter.k8s.aws/instance-category - operator: In + operator: In # Specifies allowed EC2 instance categories + values: + - "t" # Instance category t (e.g., T2, T3) + - "m" + - "r" + minValues: 2 # Minimum number of instances of each category + + - key: karpenter.k8s.aws/instance-family + operator: Exists # Specifies that instances in the family must exist (e.g., m5, r5) + minValues: 5 # Minimum number of instances in the specified family + + - key: karpenter.k8s.aws/instance-family + operator: In # Specifies that the instance family must match one of the listed values values: - - "t" - - "m" - - "r" + - "m5" + - "m5d" + - "c5" + - "c5d" + - "c4" + - "r4" + minValues: 3 # Minimum number of instances from these families + + - key: node.kubernetes.io/instance-type + operator: Exists # Ensures that the node pool has specific instance types + minValues: 10 # Minimum number of instances of the specified types + - key: karpenter.k8s.aws/instance-generation - operator: Gt + operator: Gt # Specifies that the instance generation must be greater than a particular value values: - - "2" + - "2" # Instance generation must be greater than 2 (i.e., newer generation) + nodeClass: - group: karpenter.k8s.aws - kind: EC2NodeClass - name: default # Name of the ec2nodeclass - expireAfter: 720h - limits: - cpu: "1000" - disruption: - consolidationPolicy: WhenEmptyOrUnderutilized - consolidateAfter: 1m - annotations: - example.com/owner: "my-team" - example.com/maintainer: "admin@company.com" - # taints: - # - key: "example.com/special-taint" - # value: "special-value" - # effect: "NoExecute" - labels: - environment: production - team: "engineering" \ No newline at end of file + group: karpenter.k8s.aws # Node class group for Karpenter + kind: EC2NodeClass # Kind of node class, EC2NodeClass indicates AWS EC2 instances + name: default # The name of the node class (default for this pool) + \ No newline at end of file diff --git a/charts/karpenter/values.yaml b/charts/karpenter/values.yaml index 6c3b9dd..7598a5a 100644 --- a/charts/karpenter/values.yaml +++ b/charts/karpenter/values.yaml @@ -2,7 +2,6 @@ clusterName: "" # Name of the EKS cluster (for identification in the chart and Karpenter) awsPartition: "" # AWS partition, default is 'aws' (used in multi-region or partitioned environments) awsAccountId: 3333 # AWS account ID where the resources will be provisioned -karpenterVersion: 1.1.1 # Version of Karpenter to be installed # Karpenter chart overrides karpenter: @@ -11,136 +10,65 @@ karpenter: serviceAccount: annotations: - eks.amazonaws.com/role-arn: arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks # IAM role for Karpenter controller's access to AWS services + eks.amazonaws.com/role-arn: #arn:aws:iam::3333:role/KarpenterControllerRole-demo-eks # IAM role ARN for Karpenter controller's access to AWS services - controller: - resources: - requests: - cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated) - memory: "1Gi" # Memory resource request for the Karpenter controller - limits: - cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume) - memory: "1Gi" # Memory resource limit for the Karpenter controller + # Karpenter controller resources can be customized in this section below + # controller: + # resources: + # requests: + # cpu: "1" # CPU resource request for the Karpenter controller (minimum resources Karpenter will be allocated) + # memory: "1Gi" # Memory resource request for the Karpenter controller + # limits: + # cpu: "1" # CPU resource limit for the Karpenter controller (maximum resources Karpenter can consume) + # memory: "1Gi" # Memory resource limit for the Karpenter controller # NodePools define groups of nodes with specific requirements nodePools: - - name: default # Name of the node pool, used for identification - limits: # Required Field - cpu: "1000" - memory: "1000Gi" - disruption: # Required Field - consolidationPolicy: WhenEmptyOrUnderutilized - consolidateAfter: 1m - requirements: # Node pool requirements for instance types and other properties - - key: kubernetes.io/arch - operator: In # Specifies the architecture for nodes + - name: default # Name of the node pool, preset here is set to default nodepool + requirements: # List of node requirements for scheduling + - key: kubernetes.io/arch # Architecture requirement (e.g., amd64, arm64) + operator: In # Only nodes with the specified architecture will be selected values: - - "amd64" - - key: kubernetes.io/os - operator: In # Specifies the OS type for nodes + - "amd64" # Specifies that the node should have an amd64 architecture + - key: kubernetes.io/os # OS requirement (e.g., linux, windows) + operator: In # Only nodes with the specified OS will be selected values: - - "linux" # The node pool requires Linux OS - - key: karpenter.sh/capacity-type - operator: In # Specifies the capacity type for nodes + - "linux" # Specifies that the node should run Linux + - key: karpenter.sh/capacity-type # Defines the instance's capacity type + operator: In # Only nodes with the specified capacity type will be selected values: - - "on-demand" - - key: karpenter.k8s.aws/instance-category - operator: In # Specifies allowed EC2 instance categories + - "on-demand" # Specifies that the node should be an on-demand instance, can be "spot" as well + - key: karpenter.k8s.aws/instance-category # Defines the instance category (e.g., t, m, r) + operator: In # Only nodes with the specified instance category will be selected values: - - "t" # Instance category t (e.g., T2, T3) + - "t" # These can be customized as per need - "m" - "r" - minValues: 2 # Minimum number of instances of each category - - - key: karpenter.k8s.aws/instance-family - operator: Exists # Specifies that instances in the family must exist (e.g., m5, r5) - minValues: 5 # Minimum number of instances in the specified family - - - key: karpenter.k8s.aws/instance-family - operator: In # Specifies that the instance family must match one of the listed values - values: - - "m5" - - "m5d" - - "c5" - - "c5d" - - "c4" - - "r4" - minValues: 3 # Minimum number of instances from these families - - - key: node.kubernetes.io/instance-type - operator: Exists # Ensures that the node pool has specific instance types - minValues: 10 # Minimum number of instances of the specified types - - - key: karpenter.k8s.aws/instance-generation - operator: Gt # Specifies that the instance generation must be greater than a particular value - values: - - "2" # Instance generation must be greater than 2 (i.e., newer generation) - - nodeClass: - group: karpenter.k8s.aws # Node class group for Karpenter - kind: EC2NodeClass # Kind of node class, EC2NodeClass indicates AWS EC2 instances - name: default # The name of the node class (default for this pool) - - name: default1 - expireAfter: 720h - labels: - billing-team: my-team - environment: production - annotations: - example.com/owner: "my-team" - example.com/maintainer: "admin@company.com" - limits: - cpu: "1000" - memory: "1000Gi" - disruption: - consolidationPolicy: WhenEmptyOrUnderutilized - consolidateAfter: 1m - nodeClass: - group: karpenter.k8s.aws - kind: EC2NodeClass - name: default - taints: - - key: "example.com/special-taint" - value: "my-value" - effect: "NoSchedule" - - key: "example.com/another-taint" - effect: "NoExecute" - requirements: - - key: kubernetes.io/arch - operator: In - values: - - "amd64" - - key: kubernetes.io/os - operator: In - values: - - "linux" - - key: karpenter.sh/capacity-type - operator: In - values: - - "on-demand" - - key: karpenter.k8s.aws/instance-category - operator: In - values: - - "t" - - "m" - - "r" - minValues: 2 - - key: karpenter.k8s.aws/instance-family - operator: Exists - minValues: 5 - - key: karpenter.k8s.aws/instance-family - operator: In - values: - - "m5" - - "m5d" - - "c5" - - "c5d" - - "c4" - - "r4" - minValues: 3 - - key: node.kubernetes.io/instance-type - operator: Exists - minValues: 10 - - key: karpenter.k8s.aws/instance-generation - operator: Gt + - key: karpenter.k8s.aws/instance-generation # Instance generation requirement + operator: Gt # Greater than the specified value values: - - "2" + - "2" # Specifies that only instance generations greater than 2 are allowed + nodeClass: # Defines the node class, which is linked to EC2NodeClass + group: karpenter.k8s.aws # Group of the EC2NodeClass + kind: EC2NodeClass # Type of node class, which is EC2NodeClass in this case + name: default # Name of the EC2NodeClass to use for the node pool (name of the EC2 instance class) + expireAfter: 720h # Maximum lifetime of the node pool before it expires (720 hours = 30 days) + limits: # Resource limits for the node pool + cpu: "1000" # Maximum CPU limit for the node pool + #memory: "1Gi" + disruption: # Policy for handling disruption in the node pool + consolidationPolicy: WhenEmptyOrUnderutilized # Consolidate nodes when they are empty or underutilized + consolidateAfter: 1m # Time after which consolidation will occur, in this case, 1 minute + #Uncomment Below annotations key ( next 3 Lines ) if you want to use annotations + # annotations: # Annotations are key-value pairs that provide additional metadata for the node pool + # example.com/owner: "my-team" # An example annotation that associates the node pool with a team + # example.com/maintainer: "admin@company.com" # Example annotation for the maintainer's contact information + #Uncomment below taint key ( next 4 Lines ) if you want to use taints + # taints: # Taints are used to control which pods can be scheduled on the node pool + # - key: "example.com/special-taint" # Taint key that identifies the taint + # value: "special-value" # Value associated with the taint + # effect: "NoExecute" # Effect of the taint. In this case, NoExecute means pods won't be scheduled on tainted nodes + # Comment Labels Key below if you dont want to use Labels + labels: # Labels are key-value pairs used for categorizing the node pool + environment: production # Label indicating that this node pool is for production use + team: "engineering" # Label associating the node pool with the engineering team From 57fbc499a4a2c598ceba7a6ba34a2402ecb505cc Mon Sep 17 00:00:00 2001 From: Abhishek Dubey Date: Mon, 13 Jan 2025 12:31:44 +0530 Subject: [PATCH 2/2] Fixed CI steps for testing chart (#268) * Fixed CI steps for testing chart Signed-off-by: Abhishek Dubey * Fixed CI steps for testing chart Signed-off-by: Abhishek Dubey * Fixed CI steps for testing chart Signed-off-by: Abhishek Dubey --------- Signed-off-by: Abhishek Dubey --- .github/workflows/lint-test.yaml | 4 ++-- .github/workflows/linter.yaml | 1 + .github/workflows/test-charts.yaml | 32 +++++++++++++----------------- README.md | 8 -------- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 9af8708..741b203 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -8,14 +8,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Helm uses: azure/setup-helm@v3 with: - version: v3.5.4 + version: v3.16.2 - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index f303b51..f15e437 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -25,3 +25,4 @@ jobs: VALIDATE_YAML: false DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILTER_REGEX_EXCLUDE: .*(README\.md|NOTES.txt).* diff --git a/.github/workflows/test-charts.yaml b/.github/workflows/test-charts.yaml index 26dc13a..7af5a1a 100644 --- a/.github/workflows/test-charts.yaml +++ b/.github/workflows/test-charts.yaml @@ -8,7 +8,9 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Create k8s Kind Cluster uses: helm/kind-action@v1.5.0 @@ -18,24 +20,18 @@ jobs: - name: Install Helm uses: azure/setup-helm@v3 with: - version: v3.5.4 + version: v3.16.2 - - name: Install yq - run: | - sudo snap install yq + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.0 + + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + check-latest: true - - name: Install and test Redis Related Helm charts + - name: Install and test Helm charts run: | kubectl cluster-info --context kind-kind - chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel") - for dir in "${chart_dirs[@]}" - do - if [[ -f ./charts/$dir/Chart.yaml ]]; then - helm dependency update ./charts/$dir/ - fi - chart_version=$(yq e .version ./charts/$dir/Chart.yaml) - echo "Installing $dir chart with version $chart_version..." - helm install $dir ./charts/$dir/ - helm test $dir - done - echo "Listing installed Helm charts..." + changed=$(ct list-changed --config ct.yaml) + ct install --config ct.yaml diff --git a/README.md b/README.md index a268b64..9425882 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,6 @@ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts You can then run `helm search repo ot-helm` to see the charts. -### Helm Charts List - -Currently supported helm charts are:- - -- [Redis Operator](./charts/redis-operator) -- [Redis Standalone](./charts/redis) -- [Redis Cluster](./charts/redis-cluster) -- [K8s Vault Webhook](./charts/k8s-vault-webhook) ### Pre-Requisities