devfile / devworkspace-operator

Apache License 2.0
67 stars 55 forks source link

Cannot install devworkspace-webhook-server on a specific node #1308

Closed huonguyenlt closed 3 months ago

huonguyenlt commented 3 months ago

Description

I deployed devworkspace-operator using this template https://github.com/devfile/devworkspace-operator/blob/v0.29.0/deploy/deployment/kubernetes/combined.yaml. After the devworkspace-controller-manager is deployed, it will deploy the devworkspace-webhook-server. The problem is I cannot tell the devworkspace-webhook-server to deploy on a specific node. Or maybe there is an option to do that, if there is, please show me. Thanks

AObuchow commented 3 months ago

Webhook deployment configuration was just added in DevWorkspaceOperator 0.30.0 so you'll need to deploy it with https://github.com/devfile/devworkspace-operator/blob/v0.30.0/deploy/deployment/kubernetes/combined.yaml.

This feature hasn't been document (yet), see https://github.com/devfile/devworkspace-operator/issues/1289.

For your use case, you'll probably want to use the nodeSelector. You can add a label to your desired node, and use a nodeSelector for the webhook server to have the webhook deployed to your desired node. For an example, see the "Verifying nodeSelector" section of this PR.

Here's a quick explanation of the webhook server deployment configuration options:

The devworkspace-webhook-server deployment configuration options are available in the global DevWorkspaceOperatorConfig (DWOC) including: replicas, pod tolerations and nodeSelector.

These configuration options exist in the global DWOC's config.webhook field:

apiVersion: controller.devfile.io/v1alpha1
kind: DevWorkspaceOperatorConfig
metadata:
  name: devworkspace-operator-config
  namespace: $OPERATOR_INSTALL_NAMESPACE
config:  
 routing:  
   clusterHostSuffix: 192.168.49.2.nip.io  
   defaultRoutingClass: basic  
 webhook:  
   nodeSelector:  <string, string>
   tolerations: <[]tolerations>
   replicas: <int32> 

Note: In order for the devworkspace-webhook-server configuration options to take effect:

If you have any further questions on configuring the webhook deployment, just ask :) Otherwise, feel free to close this issue.