Skip to content

Commit

Permalink
Merge pull request #164 from appuio/feat/schedule-on-master
Browse files Browse the repository at this point in the history
Support scheduling Cloud Agent on master nodes
  • Loading branch information
DebakelOrakel authored Jul 7, 2023
2 parents d7d1eba + 2e0a333 commit 8a60fa4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 11 deletions.
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

0 comments on commit 8a60fa4

Please sign in to comment.