Skip to content

Commit

Permalink
add container resource (vesoft-inc#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaByte875 authored Sep 29, 2024
1 parent 8d04b70 commit 9a97ee8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
34 changes: 33 additions & 1 deletion apis/apps/v1alpha1/nebulacluster_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
kruisev1beta1 "github.com/openkruise/kruise-api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apiresource "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -421,6 +422,13 @@ func generateLogContainer(c NebulaClusterComponent) corev1.Container {
Name: LogSidecarContainerName,
Image: image,
Command: cmd,
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("50m"),
corev1.ResourceMemory: apiresource.MustParse("50Mi"),
},
Limits: corev1.ResourceList{},
},
}

logRotate := nc.Spec.LogRotate
Expand Down Expand Up @@ -580,6 +588,12 @@ cat /metadata/flags.json
Value: script,
},
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("30m"),
corev1.ResourceMemory: apiresource.MustParse("30Mi"),
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "flags",
Expand Down Expand Up @@ -640,6 +654,12 @@ echo "export NODE_ZONE=${NODE_ZONE}" > /node/zone
Value: script,
},
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("30m"),
corev1.ResourceMemory: apiresource.MustParse("30Mi"),
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "node-info",
Expand Down Expand Up @@ -683,6 +703,12 @@ echo "${MOUNT_PATH}/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern
Value: script,
},
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("30m"),
corev1.ResourceMemory: apiresource.MustParse("30Mi"),
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: coredumpVolume(componentType),
Expand Down Expand Up @@ -801,6 +827,12 @@ done
Value: timeToKeep,
},
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: apiresource.MustParse("50m"),
corev1.ResourceMemory: apiresource.MustParse("50Mi"),
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: coredumpVolume(componentType),
Expand Down Expand Up @@ -894,7 +926,7 @@ func generateNebulaContainers(c NebulaClusterComponent, cm *corev1.ConfigMap, dy
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/status",
Port: intstr.FromInt(int(ports[1].ContainerPort)),
Port: intstr.FromInt32(ports[1].ContainerPort),
Scheme: corev1.URISchemeHTTP,
},
},
Expand Down
5 changes: 4 additions & 1 deletion charts/nebula-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,7 @@ nodeSelector: { }

tolerations: [ ]

affinity: { }
affinity: { }

fullnameOverride: ""
nameOverride: ""

0 comments on commit 9a97ee8

Please sign in to comment.