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

ROX-15980 set resource requests and limits to the egress-proxy #991

Merged
merged 9 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ spec:
mountPath: /etc/squid/squid.conf
subPath: squid.conf
readOnly: true
resources:
limits:
cpu: {{ .Values.egressProxy.resources.limits.cpu | quote }}
memory: {{ .Values.egressProxy.resources.limits.memory | quote }}
requests:
cpu: {{ .Values.egressProxy.resources.requests.cpu | quote }}
memory: {{ .Values.egressProxy.resources.requests.memory | quote }}
volumes:
- name: config-volume
configMap:
Expand Down
11 changes: 8 additions & 3 deletions fleetshard/pkg/central/charts/data/tenant-resources/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

egressProxy:
image: ubuntu/squid:5.2-22.04_beta
replicas: 2

replicas: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't need to be fixed in this PR, but this does make me wonder if we should actually run two replicas in the cloud service for all the usual reasons.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even 3.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylape @porridge perhaps with a nodeAntiAffinity on other egress proxies (preferredDuringScheduling) ?

resources:
limits:
cpu: 100m
memory: 128Mi
requests:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you got the request and limit values backwards.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

cpu: 200m
memory: 256Mi
labels: {}
annotations: {}
16 changes: 8 additions & 8 deletions fleetshard/pkg/central/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,21 +933,21 @@ func (r *CentralReconciler) ensureRouteDeleted(ctx context.Context, routeSupplie
}

func (r *CentralReconciler) chartValues(remoteCentral private.ManagedCentral) (chartutil.Values, error) {
vals := chartutil.Values{
if r.resourcesChart == nil {
return nil, errors.New("resources chart is not set")
}
src := r.resourcesChart.Values
dst := map[string]interface{}{
"labels": map[string]interface{}{
k8s.ManagedByLabelKey: k8s.ManagedByFleetshardValue,
},
}
if r.egressProxyImage != "" {
override := chartutil.Values{
"egressProxy": chartutil.Values{
"image": r.egressProxyImage,
},
dst["egressProxy"] = map[string]interface{}{
"image": r.egressProxyImage,
}
vals = chartutil.CoalesceTables(vals, override)
}

return vals, nil
return chartutil.CoalesceTables(dst, src), nil
}

func (r *CentralReconciler) shouldSkipReadyCentral(remoteCentral private.ManagedCentral) bool {
Expand Down