Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update monitoring fields failed #195

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const (
DefaultVectorCPURequest = "50m"

// DefaultVectorMemoryRequest is the default memory request for the vector.
DefaultVectorMemoryRequest = "128Mi"
DefaultVectorMemoryRequest = "64Mi"
)

// The following constants are the constant configuration for the GreptimeDBCluster and GreptimeDBStandalone.
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/defaulting.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (in *GreptimeDBCluster) defaultSpec() *GreptimeDBClusterSpec {
LogsCollection: &LogsCollectionSpec{},
Vector: &VectorSpec{
Image: DefaultVectorImage,
Resource: corev1.ResourceRequirements{
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse(DefaultVectorCPURequest),
corev1.ResourceMemory: resource.MustParse(DefaultVectorMemoryRequest),
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ type VectorSpec struct {

// The resources of the vector instance.
// +optional
Resource corev1.ResourceRequirements `json:"resource,omitempty"`
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

func (in *MonitoringSpec) IsEnabled() bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ spec:
version: latest
vector:
image: timberio/vector:nightly-alpine
resource:
resources:
limits:
cpu: 50m
memory: 128Mi
memory: 64Mi
requests:
cpu: 50m
memory: 128Mi
memory: 64Mi
2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17107,7 +17107,7 @@ spec:
properties:
image:
type: string
resource:
resources:
properties:
claims:
items:
Expand Down
3 changes: 2 additions & 1 deletion controllers/greptimedbcluster/deployers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ func (c *CommonBuilder) AddVectorSidecar(template *corev1.PodTemplateSpec, kind
Args: []string{
"--config", "/etc/vector/vector.yaml",
},
Env: c.env(kind),
Env: c.env(kind),
Resources: c.Cluster.Spec.Monitoring.Vector.Resources,
VolumeMounts: []corev1.VolumeMount{
{
Name: constant.DefaultLogsVolumeName,
Expand Down
2 changes: 1 addition & 1 deletion docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `image` _string_ | The image of the vector instance. | | |
| `resource` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#resourcerequirements-v1-core)_ | The resources of the vector instance. | | |
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#resourcerequirements-v1-core)_ | The resources of the vector instance. | | |


#### WALProviderSpec
Expand Down
2 changes: 1 addition & 1 deletion manifests/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17113,7 +17113,7 @@ spec:
properties:
image:
type: string
resource:
resources:
properties:
claims:
items:
Expand Down
2 changes: 1 addition & 1 deletion manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17106,7 +17106,7 @@ spec:
properties:
image:
type: string
resource:
resources:
properties:
claims:
items:
Expand Down
1 change: 1 addition & 0 deletions pkg/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (d *DefaultDeployer) Apply(ctx context.Context, _ client.Object, objects []

// If the spec is not equal, update the object.
if !equal {
newObject.SetResourceVersion(oldObject.GetResourceVersion())
if err := d.Client.Patch(ctx, newObject, client.MergeFrom(oldObject)); err != nil {
return err
}
Expand Down
Loading