Skip to content

Commit

Permalink
GPE-1250: Created a mutating webhook to ensure daemonsets don't sched…
Browse files Browse the repository at this point in the history
…ule on fargate nodes (#2577)

* GPE-1250: Created a mutating webhook to ensure daemonsets don't schedule on fargate

* GPE-1250: Created a mutating webhook to ensure daemonsets don't schedule on fargate

* GPE-1250: Created a mutating webhook to ensure daemonsets don't schedule on fargate

* Created a mutating webhook to ensure daemonsets don't schedule on fargate

* Created a mutating webhook to ensure daemonsets don't schedule on fargate

* feat(node-affinity-webhook): Updated webhook to work with certmanager

* Moved image config

* Update README.md

---------

Co-authored-by: Edward Malinowski <edwardmalinowski@Eds-MacBook-Pro.attlocal.net>
  • Loading branch information
emalinowski and Edward Malinowski authored Oct 21, 2024
1 parent 5d5742b commit a25c5ee
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions files/squid_whitelist/web_wildcard_whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
.immport.org
.jenkins.io
.jenkins-ci.org
.jetstack.io
.k8s.io
.kegg.jp
.kidsfirstdrc.org
Expand Down
5 changes: 5 additions & 0 deletions kube/services/node-affinity-daemonset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prerequisites

This service needs certmanager to work. Please install certmanager before deploying this service. Once certmanager is installed, you can deploy this service by applying the manifests in this directory.

Code lives in https://github.com/uc-cdis/node-affinity-webhook/
28 changes: 28 additions & 0 deletions kube/services/node-affinity-daemonset/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-affinity-daemonset
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: node-affinity-daemonset
template:
metadata:
labels:
app: node-affinity-daemonset
spec:
containers:
- name: node-affinity-daemonset
image: quay.io/cdis/node-affinity-daemonset:master
ports:
- containerPort: 8443
volumeMounts:
- name: webhook-certs
mountPath: /etc/webhook/certs
readOnly: true
volumes:
- name: webhook-certs
secret:
secretName: webhook-certs #pragma: allowlist secret
11 changes: 11 additions & 0 deletions kube/services/node-affinity-daemonset/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: node-affinity-daemonset
namespace: kube-system
spec:
ports:
- port: 443
targetPort: 8443
selector:
app: node-affinity-daemonset
43 changes: 43 additions & 0 deletions kube/services/node-affinity-daemonset/webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: node-affinity-daemonset
cert-manager.io/inject-ca-from: kube-system/node-affinity-daemonset-cert
webhooks:
- name: node-affinity-daemonset.k8s.io
clientConfig:
service:
name: node-affinity-daemonset
namespace: kube-system
path: "/mutate"
rules:
- operations: ["CREATE"]
apiGroups: ["apps"]
apiVersions: ["v1"]
resources: ["daemonsets"]
admissionReviewVersions: ["v1"]
sideEffects: None

---

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: node-affinity-daemonset-cert
namespace: kube-system
spec:
secretName: webhook-certs #pragma: allowlist secret
dnsNames:
- node-affinity-daemonset.kube-system.svc
issuerRef:
name: selfsigned

---

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigned
namespace: kube-system
spec:
selfSigned: {}

0 comments on commit a25c5ee

Please sign in to comment.