Skip to content

Commit

Permalink
✨ Refactor bottlerocket settings templates into go structs
Browse files Browse the repository at this point in the history
  • Loading branch information
mitalipaygude committed Aug 6, 2024
1 parent 2be46b1 commit 918040b
Show file tree
Hide file tree
Showing 16 changed files with 527 additions and 646 deletions.
34 changes: 15 additions & 19 deletions bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ type BottlerocketKubernetesSettings struct {

// ContainerLogMaxFiles specifies the maximum number of container log
// files that can be present for a container
ContainerLogMaxFiles int `json:"containerLogMaxFiles,omitempty"`
ContainerLogMaxFiles *int `json:"containerLogMaxFiles,omitempty"`

// ContainerLogMaxSize is a quantity defining the maximum size of
// the container log file before it is rotated
Expand All @@ -246,17 +246,17 @@ type BottlerocketKubernetesSettings struct {
CPUManagerReconcilePeriod *v1.Duration `json:"cpuManagerReconcilePeriod,omitempty"`

// EventBurst is the maximum size of a burst of event creations.
EventBurst int `json:"eventBurst,omitempty"`
EventBurst *int `json:"eventBurst,omitempty"`

// EventRecordQPS is the maximum event creations per second.
EventRecordQPS int `json:"eventRecordQPS,omitempty"`
EventRecordQPS *int `json:"eventRecordQPS,omitempty"`

// EvictionHard is a map of signal names to quantities that defines hard eviction thresholds.
EvictionHard map[string]string `json:"evictionHard,omitempty"`

// EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use
// when terminating pods in response to a soft eviction threshold being met.
EvictionMaxPodGracePeriod int `json:"evictionMaxPodGracePeriod,omitempty"`
EvictionMaxPodGracePeriod *int `json:"evictionMaxPodGracePeriod,omitempty"`

// EvictionSoft is a map of signal names to quantities that defines soft eviction thresholds.
EvictionSoft map[string]string `json:"evictionSoft,omitempty"`
Expand All @@ -267,38 +267,35 @@ type BottlerocketKubernetesSettings struct {

// ImageGCHighThresholdPercent is the percent of disk usage after which image garbage
// collection is always run.
ImageGCHighThresholdPercent int `json:"imageGCHighThresholdPercent,omitempty"`
ImageGCHighThresholdPercent *int `json:"imageGCHighThresholdPercent,omitempty"`

// ImageGCLowThresholdPercent is the percent of disk usage before which image garbage collection is never run.
ImageGCLowThresholdPercent int `json:"imageGCLowThresholdPercent,omitempty"`
ImageGCLowThresholdPercent *int `json:"imageGCLowThresholdPercent,omitempty"`

// KubeAPIBurst is the burst to allow while talking with kubernetes API server.
KubeAPIBurst int `json:"kubeAPIBurst,omitempty"`
KubeAPIBurst *int `json:"kubeAPIBurst,omitempty"`

// KubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
KubeAPIQPS int `json:"kubeAPIQPS,omitempty"`
KubeAPIQPS *int `json:"kubeAPIQPS,omitempty"`

// KubeReserved is a set of ResourceName=ResourceQuantity pairs that describe resources
// reserved for kubernetes system components
KubeReserved map[string]string `json:"kubeReserved,omitempty"`

// MaxPods defines the maximum number of pods that can run on a node.
MaxPods int `json:"maxPods,omitempty"`
MaxPods *int `json:"maxPods,omitempty"`

// MemoryManagerPolicy is the name of the policy to use by memory manager.
MemoryManagerPolicy string `json:"memoryManagerPolicy,omitempty"`

// PodPidsLimit is the maximum number of PIDs in any pod.
PodPidsLimit int64 `json:"podPidsLimit,omitempty"`

// ProviderID sets the unique ID of the instance that an external provider.
ProviderID string `json:"providerID,omitempty"`
PodPidsLimit *int64 `json:"podPidsLimit,omitempty"`

// RegistryBurst is the maximum size of bursty pulls.
RegistryBurst int `json:"registryBurst,omitempty"`
RegistryBurst *int `json:"registryBurst,omitempty"`

// RegistryPullQPS is the limit of registry pulls per second.
RegistryPullQPS int `json:"registryPullQPS,omitempty"`
RegistryPullQPS *int `json:"registryPullQPS,omitempty"`

// ShutdownGracePeriod specifies the total duration that the node should delay
// the shutdown and total grace period for pod termination during a node shutdown.
Expand Down Expand Up @@ -470,7 +467,6 @@ type APIEndpoint struct {
// NodeRegistrationOptions holds fields that relate to registering a new control-plane or node to the cluster, either via "kubeadm init" or "kubeadm join".
// Note: The NodeRegistrationOptions struct has to be kept in sync with the structs in MarshalJSON.
type NodeRegistrationOptions struct {

// Name is the `.Metadata.Name` field of the Node API object that will be created in this `kubeadm init` or `kubeadm join` operation.
// This field is also used in the CommonName field of the kubelet's client certificate to the API server.
// Defaults to the hostname of the node if not provided.
Expand Down Expand Up @@ -750,12 +746,12 @@ type BottlerocketHostContainer struct {
Name string `json:"name"`
// Superpowered indicates if the container will be superpowered
// +kubebuilder:validation:Required
Superpowered bool `json:"superpowered"`
Superpowered bool `json:"superpowered" toml:"superpowered"`
// ImageMeta is the actual location of the container image
ImageMeta `json:"source"`
ImageMeta `json:"source" toml:"source"`
// UserData is the userdata that will be attached to the image.
// +optional
UserData string `json:"userData,omitempty"`
UserData string `json:"userData,omitempty" toml:"user-data"`
}

// BottlerocketBootstrapContainer holds the bootstrap container setting for Bottlerocket
Expand Down
60 changes: 60 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 918040b

Please sign in to comment.