# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
  name: default
spec:
  role: "karpenter-nodes"

  amiFamily: Bottlerocket
  detailedMonitoring: true
  associatePublicIPAddress: true

  subnetSelectorTerms:
    - tags:
        karpenter.sh/discovery: "prow-build-cluster"
  securityGroupSelectorTerms:
    - tags:
        karpenter.sh/discovery: "prow-build-cluster"

  userData: |
    # Bootstrap the instance using our bootstrap script embeded in a Docker image
    [settings.bootstrap-containers.bootstrap]
    source = "public.ecr.aws/q4o2z4d8/k8s-prow-bottlerocket:v0.0.2"
    mode = "always"
    essential = true

    [settings.kernel.sysctl]
    "fs.inotify.max_user_watches" = "1048576"
    "fs.inotify.max_user_instances" = "8192"
    "vm.min_free_kbytes" = "540672"

  tags:
    Cluster: prow-build-cluster
