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

Support scheduling Cloud Agent on master nodes #164

Merged
merged 1 commit into from
Jul 7, 2023
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
6 changes: 6 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ parameters:
extraEnv: {}
resourceRatio:
memoryPerCore: 4Gi
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:
- effect: "NoSchedule"
key: "node-role.kubernetes.io/master"
operator: "Exists"
webhook:
tls:
certSecretName: webhook-service-tls
Expand Down
2 changes: 2 additions & 0 deletions component/agent.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ local deployment = loadManifest('manager/manager.yaml') {
},
},
],
nodeSelector: params.agent.nodeSelector,
tolerations: params.agent.tolerations,
},
},
},
Expand Down
21 changes: 10 additions & 11 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ local inv = kap.inventory();
local params = inv.parameters.appuio_cloud;

local isOpenshift = std.startsWith(inv.parameters.facts.distribution, 'openshift');
local monitoringLabel =
if isOpenshift then
{
'openshift.io/cluster-monitoring': 'true',
}
else
{
SYNMonitoring: 'main',
};
local namespaceLabels = (
if isOpenshift then { 'openshift.io/cluster-monitoring': 'true' }
else { SYNMonitoring: 'main' }
) + params.namespaceLabels;
local namespaceAnnotations = (
if isOpenshift then { 'openshift.io/node-selector': '' }
else {}
) + params.namespaceAnnotations;

local secrets = com.generateResources(params.secrets, function(name) com.namespaced(params.namespace, kube.Secret(name) + common.DefaultLabels));

{
'00_namespace': kube.Namespace(params.namespace) {
metadata+: {
labels+: monitoringLabel + params.namespaceLabels,
annotations+: params.namespaceAnnotations,
labels+: namespaceLabels,
annotations+: namespaceAnnotations,
},
} + common.DefaultLabels,
'00_secrets': secrets,
Expand Down
32 changes: 32 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,38 @@ The "fair-use" limit of memory to CPU request.
That means, if a namespace requests less than `4Gi` of memory per requested CPU core, the APPUiO Cloud Agent will warn the user that they exceed the "fair-use" limit and will potentially generate additional costs.


== `agent.nodeSelector`

[horizontal]
type:: dict
default::
+
[source,yaml]
----
nodeSelector:
node-role.kubernetes.io/master: ""
----

The node selector (if applicable) for the agent deployment.


== `agent.tolerations`

[horizontal]
type:: list
default::
+
[source,yaml]
----
tolerations:
- effect: "NoSchedule"
key: "node-role.kubernetes.io/master"
operator: "Exists"
----

The tolerations (if applicable) for the agent deployment.


== `agent.webhook.tls`

This key configures encryption of traffic to the controller's admission webhook server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ spec:
- mountPath: /var/run/webhook-service-tls
name: webhook-service-tls
readOnly: true
nodeSelector:
node-role.kubernetes.io/master: ''
serviceAccountName: appuio-cloud-agent
terminationGracePeriodSeconds: 10
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
volumes:
- configMap:
name: appuio-cloud-agent-config
Expand Down