From 43164b4dff417b867cfcc1d8000c2c51a8f7f4d7 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Sep 2024 13:34:38 +0200 Subject: [PATCH 1/2] eksctl: tag current cluster resources on upgrade, and future clusters created --- eksctl/2i2c-aws-us.jsonnet | 3 +++ eksctl/catalystproject-africa.jsonnet | 3 +++ eksctl/earthscope.jsonnet | 3 +++ eksctl/gridsst.jsonnet | 3 +++ eksctl/jupyter-health.jsonnet | 5 ++++- eksctl/jupyter-meets-the-earth.jsonnet | 3 +++ eksctl/kitware.jsonnet | 5 ++++- eksctl/libsonnet/nodegroup.jsonnet | 7 ++++++- eksctl/nasa-cryo.jsonnet | 3 +++ eksctl/nasa-esdis.jsonnet | 5 ++++- eksctl/nasa-ghg.jsonnet | 3 +++ eksctl/nasa-veda.jsonnet | 3 +++ eksctl/openscapes.jsonnet | 8 ++++---- eksctl/opensci.jsonnet | 5 ++++- eksctl/projectpythia.jsonnet | 5 ++++- eksctl/smithsonian.jsonnet | 3 +++ eksctl/template.jsonnet | 14 +++++--------- eksctl/ubc-eoas.jsonnet | 3 +++ eksctl/victor.jsonnet | 3 +++ 19 files changed, 68 insertions(+), 19 deletions(-) diff --git a/eksctl/2i2c-aws-us.jsonnet b/eksctl/2i2c-aws-us.jsonnet index 107f1232a3..2e636560fe 100644 --- a/eksctl/2i2c-aws-us.jsonnet +++ b/eksctl/2i2c-aws-us.jsonnet @@ -91,6 +91,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -151,4 +153,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/catalystproject-africa.jsonnet b/eksctl/catalystproject-africa.jsonnet index dbd5e5667e..d793fd5603 100644 --- a/eksctl/catalystproject-africa.jsonnet +++ b/eksctl/catalystproject-africa.jsonnet @@ -65,6 +65,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -125,4 +127,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/earthscope.jsonnet b/eksctl/earthscope.jsonnet index a658f2df40..4d2fbe9e5d 100644 --- a/eksctl/earthscope.jsonnet +++ b/eksctl/earthscope.jsonnet @@ -106,6 +106,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -177,4 +179,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/gridsst.jsonnet b/eksctl/gridsst.jsonnet index f5f0e1c31a..efa35edb23 100644 --- a/eksctl/gridsst.jsonnet +++ b/eksctl/gridsst.jsonnet @@ -100,6 +100,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -158,4 +160,5 @@ local daskNodes = [ }, } + n for n in daskNodes ] + ] } diff --git a/eksctl/jupyter-health.jsonnet b/eksctl/jupyter-health.jsonnet index 15c92f2622..3474a54f01 100644 --- a/eksctl/jupyter-health.jsonnet +++ b/eksctl/jupyter-health.jsonnet @@ -65,6 +65,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -125,4 +127,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) -} \ No newline at end of file + ] +} diff --git a/eksctl/jupyter-meets-the-earth.jsonnet b/eksctl/jupyter-meets-the-earth.jsonnet index 3fdabfb3bc..53bd577772 100644 --- a/eksctl/jupyter-meets-the-earth.jsonnet +++ b/eksctl/jupyter-meets-the-earth.jsonnet @@ -108,6 +108,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -168,4 +170,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/kitware.jsonnet b/eksctl/kitware.jsonnet index 6a12de2400..9dc288bad6 100644 --- a/eksctl/kitware.jsonnet +++ b/eksctl/kitware.jsonnet @@ -77,6 +77,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -137,4 +139,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) -} \ No newline at end of file + ] +} diff --git a/eksctl/libsonnet/nodegroup.jsonnet b/eksctl/libsonnet/nodegroup.jsonnet index fded775cca..e53b86eaf9 100644 --- a/eksctl/libsonnet/nodegroup.jsonnet +++ b/eksctl/libsonnet/nodegroup.jsonnet @@ -33,12 +33,17 @@ ['k8s.io/cluster-autoscaler/node-template/taint/%s' % key]: taints[key] for key in std.objectFields(taints) }, - local tags = caLabelTags(self.labels) + caTaintTags(self.taints), + local commonTags = { + "ManagedBy": "2i2c", + "2i2c.org/cluster-name": $.clusterName, + }, + local tags = caLabelTags(self.labels) + caTaintTags(self.taints) + commonTags, local nameParts = [self.namePrefix, self.nameBase, self.nameSuffix], // Hidden fields (due to ::) are used as inputs from merged objects to compute // output fields + clusterName:: "", namePrefix:: "", nameIncludeInstanceType:: true, nameBase:: if self.nameIncludeInstanceType then escapedInstanceType else "", diff --git a/eksctl/nasa-cryo.jsonnet b/eksctl/nasa-cryo.jsonnet index 19b61c344c..d9b44a9527 100644 --- a/eksctl/nasa-cryo.jsonnet +++ b/eksctl/nasa-cryo.jsonnet @@ -90,6 +90,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -149,4 +151,5 @@ local daskNodes = [ }, } + n for n in daskNodes ] + ] } diff --git a/eksctl/nasa-esdis.jsonnet b/eksctl/nasa-esdis.jsonnet index 7c94ed3bda..041c38f65a 100644 --- a/eksctl/nasa-esdis.jsonnet +++ b/eksctl/nasa-esdis.jsonnet @@ -65,6 +65,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -125,4 +127,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) -} \ No newline at end of file + ] +} diff --git a/eksctl/nasa-ghg.jsonnet b/eksctl/nasa-ghg.jsonnet index ffa23cf167..8392a44533 100644 --- a/eksctl/nasa-ghg.jsonnet +++ b/eksctl/nasa-ghg.jsonnet @@ -77,6 +77,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -137,4 +139,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/nasa-veda.jsonnet b/eksctl/nasa-veda.jsonnet index a62b379892..46e48fd900 100644 --- a/eksctl/nasa-veda.jsonnet +++ b/eksctl/nasa-veda.jsonnet @@ -130,6 +130,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -199,4 +201,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/openscapes.jsonnet b/eksctl/openscapes.jsonnet index 5d40c512e5..01f4b00fd1 100644 --- a/eksctl/openscapes.jsonnet +++ b/eksctl/openscapes.jsonnet @@ -144,7 +144,9 @@ local daskNodes = [ }, }, ], - nodeGroups: [n + {clusterName:: $.metadata.name} for n in [ + nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -213,6 +215,4 @@ local daskNodes = [ } + n for n in daskNodes ] ] - - -} \ No newline at end of file +} diff --git a/eksctl/opensci.jsonnet b/eksctl/opensci.jsonnet index 7154f1f0ed..4e9fbe7bb3 100644 --- a/eksctl/opensci.jsonnet +++ b/eksctl/opensci.jsonnet @@ -77,6 +77,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -137,4 +139,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) -} \ No newline at end of file + ] +} diff --git a/eksctl/projectpythia.jsonnet b/eksctl/projectpythia.jsonnet index 6f10634dd1..95f564e649 100644 --- a/eksctl/projectpythia.jsonnet +++ b/eksctl/projectpythia.jsonnet @@ -77,6 +77,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -137,4 +139,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) -} \ No newline at end of file + ] +} diff --git a/eksctl/smithsonian.jsonnet b/eksctl/smithsonian.jsonnet index a2516139c9..f083bca485 100644 --- a/eksctl/smithsonian.jsonnet +++ b/eksctl/smithsonian.jsonnet @@ -89,6 +89,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -149,4 +151,5 @@ local daskNodes = [ } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/template.jsonnet b/eksctl/template.jsonnet index 10e610e812..5bcfce4299 100644 --- a/eksctl/template.jsonnet +++ b/eksctl/template.jsonnet @@ -72,6 +72,7 @@ local daskNodes = []; version: "1.30", tags+: { "ManagedBy": "2i2c", + "2i2c.org/cluster-name": $.metadata.name, }, }, availabilityZones: masterAzs, @@ -98,10 +99,13 @@ local daskNodes = []; }, tags: { "ManagedBy": "2i2c", + "2i2c.org/cluster-name": $.metadata.name, }, }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'a', @@ -117,9 +121,6 @@ local daskNodes = []; "hub.jupyter.org/node-purpose": "core", "k8s.dask.org/node-purpose": "core", }, - tags+: { - "ManagedBy": "2i2c, - }, }, ] + [ ng + { @@ -135,9 +136,6 @@ local daskNodes = []; "hub.jupyter.org/node-purpose": "user", "k8s.dask.org/node-purpose": "scheduler" }, - tags+: { - "ManagedBy": "2i2c, - }, taints+: { "hub.jupyter.org_dedicated": "user:NoSchedule", "hub.jupyter.org/dedicated": "user:NoSchedule", @@ -156,9 +154,6 @@ local daskNodes = []; labels+: { "k8s.dask.org/node-purpose": "worker" }, - tags+: { - "ManagedBy": "2i2c, - }, taints+: { "k8s.dask.org_dedicated" : "worker:NoSchedule", "k8s.dask.org/dedicated" : "worker:NoSchedule", @@ -171,4 +166,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/ubc-eoas.jsonnet b/eksctl/ubc-eoas.jsonnet index 50d4b688de..839f2c1d1f 100644 --- a/eksctl/ubc-eoas.jsonnet +++ b/eksctl/ubc-eoas.jsonnet @@ -67,6 +67,8 @@ local daskNodes = []; }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -127,4 +129,5 @@ local daskNodes = []; } + n for n in daskNodes ] else [] ) + ] } diff --git a/eksctl/victor.jsonnet b/eksctl/victor.jsonnet index f5e6474c41..55de52dc02 100644 --- a/eksctl/victor.jsonnet +++ b/eksctl/victor.jsonnet @@ -82,6 +82,8 @@ local daskNodes = [ }, ], nodeGroups: [ + n + {clusterName: $.metadata.name} for n in + [ ng + { namePrefix: 'core', nameSuffix: 'b', @@ -141,4 +143,5 @@ local daskNodes = [ }, } + n for n in daskNodes ] + ] } From 4cd919bc8d0226a1b4ecf0c79742c2644c151177 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 6 Sep 2024 13:37:52 +0200 Subject: [PATCH 2/2] eksctl: fix broken link in template.jsonnet --- eksctl/template.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eksctl/template.jsonnet b/eksctl/template.jsonnet index 5bcfce4299..21461f7fb8 100644 --- a/eksctl/template.jsonnet +++ b/eksctl/template.jsonnet @@ -7,7 +7,7 @@ command as part of creating new clusters. References: - - https://infrastructure.2i2c.org/en/latest/hub-deployment-guide/new-cluster/aws.html#generate-cluster-files + - https://infrastructure.2i2c.org/hub-deployment-guide/new-cluster/new-cluster/#generate-cluster-files -#} /* This file is a jsonnet template of a eksctl's cluster configuration file,