Skip to content

Commit

Permalink
Merge pull request #1765 from paritytech/new-admission
Browse files Browse the repository at this point in the history
FEAT: updated the keys for scheduling
  • Loading branch information
emamihe authored Apr 9, 2024
2 parents bee483c + 879854c commit ce55fca
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 2 deletions.
33 changes: 33 additions & 0 deletions admissioncontroller/keys/server.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFqDCCA5CgAwIBAgIUY8xAGirtPjY9LJgXL2Z20fqq2sEwDQYJKoZIhvcNAQEL
BQAwQzFBMD8GA1UEAww4bGFyZ2UtdGVzdG5ldC1ob29rLmxhcmdlLXRlc3RuZXQt
YWRtaXNzaW9uY29udHJvbGxlci5zdmMwHhcNMjMxMDE3MTc1OTIwWhcNMjQxMDE2
MTc1OTIwWjBDMUEwPwYDVQQDDDhsYXJnZS10ZXN0bmV0LWhvb2subGFyZ2UtdGVz
dG5ldC1hZG1pc3Npb25jb250cm9sbGVyLnN2YzCCAiIwDQYJKoZIhvcNAQEBBQAD
ggIPADCCAgoCggIBALegwGmYWCODgd616xKc7zprID9Z7YieYm4lzy4IvQYSpyP5
ibMM+LJ6K5fZFYkLoTbUyp0CCUXmSJqbmKKIrvB84uuem1qhge75HHBWPeBPvTVY
trkKheTnSZJQemCF3MgTD31j7RJ15glgHp944uus9Q0tLf9csrVBw56TL3a53wyb
hvKphRYgkLOK+2F3cc19iekaYzmyXc9rXxHxYeYvO0D8roGjztNL6Ml88V9ggYCb
0ITa7Da8wfMEtyZZxuWvUSRymSTcxrN0gMdOtJlcrooMxv26lais46qYB3ybzqC0
E1XKXNj98SQbLRHVn8DxxocdHNyoTZ3bl4WmEdIn3tuq2AexlWDy8Ti8u+uGSYvP
Aw4TDTZkJUooRzkyrmW+l2sYbhMi9pxUQ24avQfDQ8djx0UgwL28P2Ea+yKysfQa
8qi1ppLVS5gSV3DPoixWVACtNoO0dZGdBJ+91W2w1Kh1bPjy+ZsiIg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XKoP620rOce33o7EQLpadG+kmxhCxOw9SFsmQGO
/eqbmMMT7BSW9hsH
-----END CERTIFICATE-----
52 changes: 52 additions & 0 deletions admissioncontroller/keys/server.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQC3oMBpmFgjg4He
tesSnO86ayA/We2InmJuJc8uCL0GEqcj+YmzDPiyeiuX2RWJC6E21MqdAglF5kia
m5iiiK7wfOLrnptaoYHu+RxwVj3gT701WLa5CoXk50mSUHpghdzIEw99Y+0SdeYJ
YB6feOLrrPUNLS3/XLK1QcOeky92ud8Mm4byqYUWIJCzivthd3HNfYnpGmM5sl3P
a18R8WHmLztA/K6Bo87TS+jJfPFfYIGAm9CE2uw2vMHzBLcmWcblr1Ekcpkk3Maz
dIDHTrSZXK6KDMb9upWorOOqmAd8m86gtBNVylzY/fEkGy0R1Z/A8caHHRzcqE2d
25eFphHSJ97bqtgHsZVg8vE4vLvrhkmLzwMOEw02ZCVKKEc5Mq5lvpdrGG4TIvac
VENuGr0Hw0PHY8dFIMC9vD9hGvsisrH0GvKotaaS1UuYEldwz6IsVlQArTaDtHWR
nQSfvdVtsNSodWz48vmbIiIBR0WmWNAhccjAz0EjYLOEmEeKwPPdGkUarjLGNhpl
UFz5w8oGnlEnMopNZVmPfGpp+/UgHSZaPmPPQlSECDx5Uz5cDVpcZ2k82T0KVCWN
OpGWDMpoQ/nalqdCHFpZSwjYC2qbtWj545MXpDd61m4wlBO8tKCbfM9VN/c5Qsiq
23Lz7Ac0OxmloUKojimbkX2uyNxHdwIDAQABAoICABZNmBE7R7lIh8WdIugn14ao
7EnFimxFkH8AaKGWvh62tUZRUMBGmw5SeGkBHPSATRxzzAg17xpmVfsxWuCi6Vyc
TpN/uC7R3w4/g4zBbNKJ3NlV5Rukg47B6NW0oKiImcBTUFZShMDxQPdyjUWhUS5+
22S2UBfsEmihjDj+d41cF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yxyn0thWwAS7V5RB8Zdf/nzoNh4IGfmqpOfuCW
JO2PCzZGMM3szgtchhWNjru8TDtRQ/vs8XEAyOS1DFW49+29tTVGB7ROShOK1OWh
NhYkB6YpGjwOqaxpE2b8eiqwFyLG9DrG
-----END PRIVATE KEY-----
10 changes: 8 additions & 2 deletions admissioncontroller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ def deployment_webhook_mutate():
if labels["x-infra-instance"]=="ondemand":
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"large-testnet"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"large-network"}}]))
else:
elif labels["x-infra-instance"]=="ondemand-iops":
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"large-testnet-iops"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"large-network-iops"}}]))
elif labels["x-infra-instance"]=="spot":
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"xlarge-testnet"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"xlarge-network"}}]))

else:
return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"effect":"NoExecute", "key":"workload-type",
"operator":"Equal", "value":"xlarge-testnet-iops"}]}, {"op":"add", "path":"/spec/nodeSelector", "value": {"nodetype":"xlarge-network-iops"}}]))

# return admission_response_patch(True, "Adding allow label", json_patch = jsonpatch.JsonPatch([{"op": "add", "path": "/spec/tolerations", "value": [{"operator":"Exists"}]}, {"op":"add", "path":"/spec/affinity", "value": {"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["xlarge-network"]}]}},{"weight":50,"preference":{"matchExpressions":[{"key":"nodetype","operator":"In","values":["large-network"]}]}}]}} }]))

elif namespace.startswith("zombie-") and not hasNodeSelector:
Expand Down

0 comments on commit ce55fca

Please sign in to comment.