From 3350799974ac7f8cea66f8ab59e053cf5901f349 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Tue, 28 Mar 2023 17:43:28 +0000 Subject: [PATCH 1/8] Removed old yaml --- batch/kueue-cohort/README.md | 5 +++ batch/kueue-cohort/create_jobs.sh | 20 ++++++++++++ batch/kueue-cohort/flavors.yaml | 31 +++++++++++++++++++ batch/kueue-cohort/spot-cq.yaml | 33 ++++++++++++++++++++ batch/kueue-cohort/team-a-cq.yaml | 49 ++++++++++++++++++++++++++++++ batch/kueue-cohort/team-a-job.yaml | 40 ++++++++++++++++++++++++ batch/kueue-cohort/team-b-cq.yaml | 49 ++++++++++++++++++++++++++++++ batch/kueue-cohort/team-b-job.yaml | 40 ++++++++++++++++++++++++ 8 files changed, 267 insertions(+) create mode 100644 batch/kueue-cohort/README.md create mode 100755 batch/kueue-cohort/create_jobs.sh create mode 100644 batch/kueue-cohort/flavors.yaml create mode 100644 batch/kueue-cohort/spot-cq.yaml create mode 100644 batch/kueue-cohort/team-a-cq.yaml create mode 100755 batch/kueue-cohort/team-a-job.yaml create mode 100644 batch/kueue-cohort/team-b-cq.yaml create mode 100755 batch/kueue-cohort/team-b-job.yaml diff --git a/batch/kueue-cohort/README.md b/batch/kueue-cohort/README.md new file mode 100644 index 0000000000..30834af559 --- /dev/null +++ b/batch/kueue-cohort/README.md @@ -0,0 +1,5 @@ +# Deploy Kueue with Cohorts and Resource Sharing + +[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/kubernetes-engine-samples&cloudshell_tutorial=README.md&cloudshell_workspace=guestbook/) + +Please follow the tutorial at https://cloud.google.com/kubernetes-engine/docs/tutorials/kueue-cohort. \ No newline at end of file diff --git a/batch/kueue-cohort/create_jobs.sh b/batch/kueue-cohort/create_jobs.sh new file mode 100755 index 0000000000..75750028f3 --- /dev/null +++ b/batch/kueue-cohort/create_jobs.sh @@ -0,0 +1,20 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash +while : +do + kubectl create -f ${1} + sleep ${2:-10} +done diff --git a/batch/kueue-cohort/flavors.yaml b/batch/kueue-cohort/flavors.yaml new file mode 100644 index 0000000000..6c1692e4da --- /dev/null +++ b/batch/kueue-cohort/flavors.yaml @@ -0,0 +1,31 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_flavors] +apiVersion: kueue.x-k8s.io/v1beta1 +kind: ResourceFlavor +metadata: + name: standard # This ResourceFlavor will be used for the CPU resource +spec: + nodeLabels: + cloud.google.com/gke-provisioning: standard +--- +apiVersion: kueue.x-k8s.io/v1beta1 +kind: ResourceFlavor +metadata: + name: spot # This ResourceFlavor will be used as added resource for the CPU resource + labels: + cloud.google.com/gke-provisioning: spot + +# [END gke_batch_kueue_cohort_flavors] diff --git a/batch/kueue-cohort/spot-cq.yaml b/batch/kueue-cohort/spot-cq.yaml new file mode 100644 index 0000000000..55a1f9c373 --- /dev/null +++ b/batch/kueue-cohort/spot-cq.yaml @@ -0,0 +1,33 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_spot_cq] +apiVersion: kueue.x-k8s.io/v1beta1 +kind: ClusterQueue +metadata: + name: spot-cq +spec: + cohort: all + namespaceSelector: {} + resourceGroups: + - coveredResources: ["cpu", "memory"] + flavors: + - name: spot + resources: + - name: "cpu" + nominalQuota: 40 + - name: "memory" + nominalQuota: 144Gi +# [END gke_batch_kueue_cohort_spot_cq] + diff --git a/batch/kueue-cohort/team-a-cq.yaml b/batch/kueue-cohort/team-a-cq.yaml new file mode 100644 index 0000000000..712718c248 --- /dev/null +++ b/batch/kueue-cohort/team-a-cq.yaml @@ -0,0 +1,49 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_team_a_cq] +apiVersion: kueue.x-k8s.io/v1beta1 +kind: ClusterQueue +metadata: + name: team-a-cq +spec: + cohort: all # team-a-cq and team-b-cq share the same cohort + namespaceSelector: {} + resourceGroups: + - resources: ["cpu", "memory"] + flavors: + - name: standard + resources: + - name: "cpu" + nominalQuota: 10 + borrowingLimit: 15 + - name: "memory" + nominalQuota: 10Gi + borrowingLimit: 15Gi + - name: spot # This ClusterQueue doesn't have nominalQuota for spot, but it can borrow from others + resources: + - name: "cpu" + nominalQuota: 0 + - name: "memory" + nominalQuota: 0 +--- +apiVersion: kueue.x-k8s.io/v1beta1 +kind: LocalQueue +metadata: + namespace: team-a # LocalQueue under team-a namespace + name: team-a-lq +spec: + clusterQueue: team-a-cq # Point to the ClusterQueue team-a-cq +# [END gke_batch_kueue_cohort_team_a_cq] + diff --git a/batch/kueue-cohort/team-a-job.yaml b/batch/kueue-cohort/team-a-job.yaml new file mode 100755 index 0000000000..dfab3e8f81 --- /dev/null +++ b/batch/kueue-cohort/team-a-job.yaml @@ -0,0 +1,40 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_team_a_job] +apiVersion: batch/v1 +kind: Job +metadata: + namespace: team-a # Job under team-a namespace + generateName: sample-team-a-job- + labels: + kueue.x-k8s.io/queue-name: team-a-lq # Point to the LocalQueue +spec: + ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds + parallelism: 3 # This Job will have 3 replicas running at the same time + completions: 3 # This Job requires 3 completions + suspend: true # Set to true and allow Kueue to control the Job + template: + spec: + containers: + - name: dummy-job + image: gcr.io/k8s-staging-perf-tests/sleep:latest + args: ["10s"] # Sleep for 10 seconds + resources: + requests: + cpu: "500m" + memory: "512Mi" + restartPolicy: Never +# [END gke_batch_kueue_cohort_team_a_job] + diff --git a/batch/kueue-cohort/team-b-cq.yaml b/batch/kueue-cohort/team-b-cq.yaml new file mode 100644 index 0000000000..4d2ae0f6c0 --- /dev/null +++ b/batch/kueue-cohort/team-b-cq.yaml @@ -0,0 +1,49 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_team_b_cq] +apiVersion: kueue.x-k8s.io/v1beta1 +kind: ClusterQueue +metadata: + name: team-b-cq +spec: + cohort: all # team-a-cq and team-b-cq share the same cohort + namespaceSelector: {} + resourceGroups: + - resources: ["cpu", "memory"] + flavors: + - name: standard + resources: + - name: "cpu" + nominalQuota: 10 + borrowingLimit: 15 + - name: "memory" + nominalQuota: 10Gi + borrowingLimit: 15Gi + - name: spot # This ClusterQueue doesn't have nominalQuota for spot, but it can borrow from others + resources: + - name: "cpu" + nominalQuota: 0 + - name: "memory" + nominalQuota: 0 +--- +apiVersion: kueue.x-k8s.io/v1beta1 +kind: LocalQueue +metadata: + namespace: team-b # LocalQueue under team-b namespace + name: team-b-lq +spec: + clusterQueue: team-b-cq # Point to the ClusterQueue team-b-cq +# [END gke_batch_kueue_cohort_team_b_cq] + diff --git a/batch/kueue-cohort/team-b-job.yaml b/batch/kueue-cohort/team-b-job.yaml new file mode 100755 index 0000000000..04437ee418 --- /dev/null +++ b/batch/kueue-cohort/team-b-job.yaml @@ -0,0 +1,40 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START gke_batch_kueue_cohort_team_b_job] +apiVersion: batch/v1 +kind: Job +metadata: + namespace: team-b # Job under team-a namespace + generateName: sample-team-b-job- + labels: + kueue.scheduling.k8s.io/queue-name: team-b-lq # Point to the LocalQueue +spec: + ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds + parallelism: 3 # This Job will have 3 replicas running at the same time + completions: 3 # This Job requires 3 completions + suspend: true # Set to true and allow Kueue to control the Job + template: + spec: + containers: + - name: dummy-job + image: gcr.io/k8s-staging-perf-tests/sleep:latest + args: ["10s"] # Sleep for 10 seconds + resources: + requests: + cpu: "500m" + memory: "512Mi" + restartPolicy: Never +# [END gke_batch_kueue_cohort_team_b_job] + From 6d031323d609a8ecbd8e46eeeaed4ec3742970f6 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Tue, 28 Mar 2023 19:24:03 +0000 Subject: [PATCH 2/8] Changed comment in jobs yaml --- batch/kueue-cohort/team-a-job.yaml | 2 +- batch/kueue-cohort/team-b-job.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/batch/kueue-cohort/team-a-job.yaml b/batch/kueue-cohort/team-a-job.yaml index dfab3e8f81..911eff5f52 100755 --- a/batch/kueue-cohort/team-a-job.yaml +++ b/batch/kueue-cohort/team-a-job.yaml @@ -24,7 +24,7 @@ spec: ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds parallelism: 3 # This Job will have 3 replicas running at the same time completions: 3 # This Job requires 3 completions - suspend: true # Set to true and allow Kueue to control the Job + suspend: true # Set to true to allow Kueue to control the Job when it starts template: spec: containers: diff --git a/batch/kueue-cohort/team-b-job.yaml b/batch/kueue-cohort/team-b-job.yaml index 04437ee418..47dab818d3 100755 --- a/batch/kueue-cohort/team-b-job.yaml +++ b/batch/kueue-cohort/team-b-job.yaml @@ -24,7 +24,7 @@ spec: ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds parallelism: 3 # This Job will have 3 replicas running at the same time completions: 3 # This Job requires 3 completions - suspend: true # Set to true and allow Kueue to control the Job + suspend: true # Set to true to allow Kueue to control the Job when it starts template: spec: containers: From 58cdb628ded2f31a00a8eacfbfd5523c749cd0b6 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:33:37 +0000 Subject: [PATCH 3/8] Added comments --- batch/kueue-cohort/flavors.yaml | 8 ++++---- batch/kueue-cohort/team-a-cq.yaml | 2 +- batch/kueue-cohort/team-b-cq.yaml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/batch/kueue-cohort/flavors.yaml b/batch/kueue-cohort/flavors.yaml index 6c1692e4da..44bf613717 100644 --- a/batch/kueue-cohort/flavors.yaml +++ b/batch/kueue-cohort/flavors.yaml @@ -19,13 +19,13 @@ metadata: name: standard # This ResourceFlavor will be used for the CPU resource spec: nodeLabels: - cloud.google.com/gke-provisioning: standard + spot: "false" # This label was applied when the cluster was created --- apiVersion: kueue.x-k8s.io/v1beta1 kind: ResourceFlavor metadata: name: spot # This ResourceFlavor will be used as added resource for the CPU resource - labels: - cloud.google.com/gke-provisioning: spot - +spec: + nodeLabels: + spot: "true" # This label was applied when the nodepool was created # [END gke_batch_kueue_cohort_flavors] diff --git a/batch/kueue-cohort/team-a-cq.yaml b/batch/kueue-cohort/team-a-cq.yaml index 712718c248..952e1e64ce 100644 --- a/batch/kueue-cohort/team-a-cq.yaml +++ b/batch/kueue-cohort/team-a-cq.yaml @@ -21,7 +21,7 @@ spec: cohort: all # team-a-cq and team-b-cq share the same cohort namespaceSelector: {} resourceGroups: - - resources: ["cpu", "memory"] + - coveredResources: ["cpu", "memory"] flavors: - name: standard resources: diff --git a/batch/kueue-cohort/team-b-cq.yaml b/batch/kueue-cohort/team-b-cq.yaml index 4d2ae0f6c0..5638d92c9b 100644 --- a/batch/kueue-cohort/team-b-cq.yaml +++ b/batch/kueue-cohort/team-b-cq.yaml @@ -21,7 +21,7 @@ spec: cohort: all # team-a-cq and team-b-cq share the same cohort namespaceSelector: {} resourceGroups: - - resources: ["cpu", "memory"] + - coveredResources: ["cpu", "memory"] flavors: - name: standard resources: From 7591f8c998dd934083df8919a01fd34b76171347 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Thu, 30 Mar 2023 20:32:12 +0000 Subject: [PATCH 4/8] Fixed node labels --- batch/kueue-cohort/create_jobs.sh | 4 ++++ batch/kueue-cohort/flavors.yaml | 2 +- batch/kueue-cohort/team-a-cq.yaml | 2 +- batch/kueue-cohort/team-b-cq.yaml | 2 +- batch/kueue-cohort/team-b-job.yaml | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/batch/kueue-cohort/create_jobs.sh b/batch/kueue-cohort/create_jobs.sh index 75750028f3..3c67f312e8 100755 --- a/batch/kueue-cohort/create_jobs.sh +++ b/batch/kueue-cohort/create_jobs.sh @@ -15,6 +15,10 @@ #!/bin/bash while : do + kubectl create -f ${1} + kubectl create -f ${1} + kubectl create -f ${1} + kubectl create -f ${1} kubectl create -f ${1} sleep ${2:-10} done diff --git a/batch/kueue-cohort/flavors.yaml b/batch/kueue-cohort/flavors.yaml index 44bf613717..9b842036d6 100644 --- a/batch/kueue-cohort/flavors.yaml +++ b/batch/kueue-cohort/flavors.yaml @@ -16,7 +16,7 @@ apiVersion: kueue.x-k8s.io/v1beta1 kind: ResourceFlavor metadata: - name: standard # This ResourceFlavor will be used for the CPU resource + name: on-demand # This ResourceFlavor will be used for the CPU resource spec: nodeLabels: spot: "false" # This label was applied when the cluster was created diff --git a/batch/kueue-cohort/team-a-cq.yaml b/batch/kueue-cohort/team-a-cq.yaml index 952e1e64ce..1dad94dc45 100644 --- a/batch/kueue-cohort/team-a-cq.yaml +++ b/batch/kueue-cohort/team-a-cq.yaml @@ -23,7 +23,7 @@ spec: resourceGroups: - coveredResources: ["cpu", "memory"] flavors: - - name: standard + - name: on-demand resources: - name: "cpu" nominalQuota: 10 diff --git a/batch/kueue-cohort/team-b-cq.yaml b/batch/kueue-cohort/team-b-cq.yaml index 5638d92c9b..bacf96ceaf 100644 --- a/batch/kueue-cohort/team-b-cq.yaml +++ b/batch/kueue-cohort/team-b-cq.yaml @@ -23,7 +23,7 @@ spec: resourceGroups: - coveredResources: ["cpu", "memory"] flavors: - - name: standard + - name: on-demand resources: - name: "cpu" nominalQuota: 10 diff --git a/batch/kueue-cohort/team-b-job.yaml b/batch/kueue-cohort/team-b-job.yaml index 47dab818d3..b8645ee4f8 100755 --- a/batch/kueue-cohort/team-b-job.yaml +++ b/batch/kueue-cohort/team-b-job.yaml @@ -19,7 +19,7 @@ metadata: namespace: team-b # Job under team-a namespace generateName: sample-team-b-job- labels: - kueue.scheduling.k8s.io/queue-name: team-b-lq # Point to the LocalQueue + kueue.x-k8s.io/queue-name: team-b-lq # Point to the LocalQueue spec: ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds parallelism: 3 # This Job will have 3 replicas running at the same time From f618611e771cadebf0e6e4bb2e86b5102750dfa3 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:10:15 +0000 Subject: [PATCH 5/8] Updated labels and namespaceSelectors --- batch/kueue-cohort/--machine-type | 0 batch/kueue-cohort/create_jobs.sh | 4 ---- batch/kueue-cohort/flavors.yaml | 4 ++-- batch/kueue-cohort/spot-cq.yaml | 1 - batch/kueue-cohort/team-a-cq.yaml | 4 +++- batch/kueue-cohort/team-b-cq.yaml | 4 +++- 6 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 batch/kueue-cohort/--machine-type diff --git a/batch/kueue-cohort/--machine-type b/batch/kueue-cohort/--machine-type new file mode 100644 index 0000000000..e69de29bb2 diff --git a/batch/kueue-cohort/create_jobs.sh b/batch/kueue-cohort/create_jobs.sh index 3c67f312e8..75750028f3 100755 --- a/batch/kueue-cohort/create_jobs.sh +++ b/batch/kueue-cohort/create_jobs.sh @@ -15,10 +15,6 @@ #!/bin/bash while : do - kubectl create -f ${1} - kubectl create -f ${1} - kubectl create -f ${1} - kubectl create -f ${1} kubectl create -f ${1} sleep ${2:-10} done diff --git a/batch/kueue-cohort/flavors.yaml b/batch/kueue-cohort/flavors.yaml index 9b842036d6..612c88163e 100644 --- a/batch/kueue-cohort/flavors.yaml +++ b/batch/kueue-cohort/flavors.yaml @@ -19,7 +19,7 @@ metadata: name: on-demand # This ResourceFlavor will be used for the CPU resource spec: nodeLabels: - spot: "false" # This label was applied when the cluster was created + cloud.google.com/gke-provisioning: standard # This label was applied automatically by GKE --- apiVersion: kueue.x-k8s.io/v1beta1 kind: ResourceFlavor @@ -27,5 +27,5 @@ metadata: name: spot # This ResourceFlavor will be used as added resource for the CPU resource spec: nodeLabels: - spot: "true" # This label was applied when the nodepool was created + cloud.google.com/gke-provisioning: spot # This label was applied automatically by GKE # [END gke_batch_kueue_cohort_flavors] diff --git a/batch/kueue-cohort/spot-cq.yaml b/batch/kueue-cohort/spot-cq.yaml index 55a1f9c373..84ea2f31a3 100644 --- a/batch/kueue-cohort/spot-cq.yaml +++ b/batch/kueue-cohort/spot-cq.yaml @@ -19,7 +19,6 @@ metadata: name: spot-cq spec: cohort: all - namespaceSelector: {} resourceGroups: - coveredResources: ["cpu", "memory"] flavors: diff --git a/batch/kueue-cohort/team-a-cq.yaml b/batch/kueue-cohort/team-a-cq.yaml index 1dad94dc45..c075cc44f8 100644 --- a/batch/kueue-cohort/team-a-cq.yaml +++ b/batch/kueue-cohort/team-a-cq.yaml @@ -19,7 +19,9 @@ metadata: name: team-a-cq spec: cohort: all # team-a-cq and team-b-cq share the same cohort - namespaceSelector: {} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: team-a #Only team-a can submit jobs direclty to this queue, but will be able to share it through the cohort resourceGroups: - coveredResources: ["cpu", "memory"] flavors: diff --git a/batch/kueue-cohort/team-b-cq.yaml b/batch/kueue-cohort/team-b-cq.yaml index bacf96ceaf..0a6989c859 100644 --- a/batch/kueue-cohort/team-b-cq.yaml +++ b/batch/kueue-cohort/team-b-cq.yaml @@ -19,7 +19,9 @@ metadata: name: team-b-cq spec: cohort: all # team-a-cq and team-b-cq share the same cohort - namespaceSelector: {} + namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: team-b #Only team-b can submit jobs direclty to this queue, but will be able to share it through the cohort resourceGroups: - coveredResources: ["cpu", "memory"] flavors: From 3cb40005c831fbb8885885c4cc61bf4d3ed51cad Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:14:48 +0000 Subject: [PATCH 6/8] Removed stray file --- batch/kueue-cohort/--machine-type | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 batch/kueue-cohort/--machine-type diff --git a/batch/kueue-cohort/--machine-type b/batch/kueue-cohort/--machine-type deleted file mode 100644 index e69de29bb2..0000000000 From a41386240aee73d0512ec1c7d895a7de9dc50057 Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Fri, 31 Mar 2023 17:32:55 +0000 Subject: [PATCH 7/8] Changed names to -team format --- batch/kueue-cohort/{spot-cq.yaml => cq-spot.yaml} | 2 +- batch/kueue-cohort/{team-a-cq.yaml => cq-team-a.yaml} | 8 ++++---- batch/kueue-cohort/{team-b-cq.yaml => cq-team-b.yaml} | 8 ++++---- batch/kueue-cohort/{team-a-job.yaml => job-team-a.yaml} | 4 ++-- batch/kueue-cohort/{team-b-job.yaml => job-team-b.yaml} | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) rename batch/kueue-cohort/{spot-cq.yaml => cq-spot.yaml} (97%) rename batch/kueue-cohort/{team-a-cq.yaml => cq-team-a.yaml} (90%) rename batch/kueue-cohort/{team-b-cq.yaml => cq-team-b.yaml} (90%) rename batch/kueue-cohort/{team-a-job.yaml => job-team-a.yaml} (93%) rename batch/kueue-cohort/{team-b-job.yaml => job-team-b.yaml} (93%) diff --git a/batch/kueue-cohort/spot-cq.yaml b/batch/kueue-cohort/cq-spot.yaml similarity index 97% rename from batch/kueue-cohort/spot-cq.yaml rename to batch/kueue-cohort/cq-spot.yaml index 84ea2f31a3..1e73ced3ed 100644 --- a/batch/kueue-cohort/spot-cq.yaml +++ b/batch/kueue-cohort/cq-spot.yaml @@ -18,7 +18,7 @@ kind: ClusterQueue metadata: name: spot-cq spec: - cohort: all + cohort: all-teams resourceGroups: - coveredResources: ["cpu", "memory"] flavors: diff --git a/batch/kueue-cohort/team-a-cq.yaml b/batch/kueue-cohort/cq-team-a.yaml similarity index 90% rename from batch/kueue-cohort/team-a-cq.yaml rename to batch/kueue-cohort/cq-team-a.yaml index c075cc44f8..9b5fad6dc8 100644 --- a/batch/kueue-cohort/team-a-cq.yaml +++ b/batch/kueue-cohort/cq-team-a.yaml @@ -16,9 +16,9 @@ apiVersion: kueue.x-k8s.io/v1beta1 kind: ClusterQueue metadata: - name: team-a-cq + name: cq-team-a spec: - cohort: all # team-a-cq and team-b-cq share the same cohort + cohort: all-teams # team-a-cq and team-b-cq share the same cohort namespaceSelector: matchLabels: kubernetes.io/metadata.name: team-a #Only team-a can submit jobs direclty to this queue, but will be able to share it through the cohort @@ -44,8 +44,8 @@ apiVersion: kueue.x-k8s.io/v1beta1 kind: LocalQueue metadata: namespace: team-a # LocalQueue under team-a namespace - name: team-a-lq + name: lq-team-a spec: - clusterQueue: team-a-cq # Point to the ClusterQueue team-a-cq + clusterQueue: cq-team-a # Point to the ClusterQueue team-a-cq # [END gke_batch_kueue_cohort_team_a_cq] diff --git a/batch/kueue-cohort/team-b-cq.yaml b/batch/kueue-cohort/cq-team-b.yaml similarity index 90% rename from batch/kueue-cohort/team-b-cq.yaml rename to batch/kueue-cohort/cq-team-b.yaml index 0a6989c859..b18433950b 100644 --- a/batch/kueue-cohort/team-b-cq.yaml +++ b/batch/kueue-cohort/cq-team-b.yaml @@ -16,9 +16,9 @@ apiVersion: kueue.x-k8s.io/v1beta1 kind: ClusterQueue metadata: - name: team-b-cq + name: cq-team-b spec: - cohort: all # team-a-cq and team-b-cq share the same cohort + cohort: all-teams # team-a-cq and team-b-cq share the same cohort namespaceSelector: matchLabels: kubernetes.io/metadata.name: team-b #Only team-b can submit jobs direclty to this queue, but will be able to share it through the cohort @@ -44,8 +44,8 @@ apiVersion: kueue.x-k8s.io/v1beta1 kind: LocalQueue metadata: namespace: team-b # LocalQueue under team-b namespace - name: team-b-lq + name: lq-team-b spec: - clusterQueue: team-b-cq # Point to the ClusterQueue team-b-cq + clusterQueue: cq-team-b # Point to the ClusterQueue team-b-cq # [END gke_batch_kueue_cohort_team_b_cq] diff --git a/batch/kueue-cohort/team-a-job.yaml b/batch/kueue-cohort/job-team-a.yaml similarity index 93% rename from batch/kueue-cohort/team-a-job.yaml rename to batch/kueue-cohort/job-team-a.yaml index 911eff5f52..ff663a36e0 100755 --- a/batch/kueue-cohort/team-a-job.yaml +++ b/batch/kueue-cohort/job-team-a.yaml @@ -17,9 +17,9 @@ apiVersion: batch/v1 kind: Job metadata: namespace: team-a # Job under team-a namespace - generateName: sample-team-a-job- + generateName: sample-job-team-a- labels: - kueue.x-k8s.io/queue-name: team-a-lq # Point to the LocalQueue + kueue.x-k8s.io/queue-name: lq-team-a # Point to the LocalQueue spec: ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds parallelism: 3 # This Job will have 3 replicas running at the same time diff --git a/batch/kueue-cohort/team-b-job.yaml b/batch/kueue-cohort/job-team-b.yaml similarity index 93% rename from batch/kueue-cohort/team-b-job.yaml rename to batch/kueue-cohort/job-team-b.yaml index b8645ee4f8..f10bc61eed 100755 --- a/batch/kueue-cohort/team-b-job.yaml +++ b/batch/kueue-cohort/job-team-b.yaml @@ -17,9 +17,9 @@ apiVersion: batch/v1 kind: Job metadata: namespace: team-b # Job under team-a namespace - generateName: sample-team-b-job- + generateName: sample-job-team-b- labels: - kueue.x-k8s.io/queue-name: team-b-lq # Point to the LocalQueue + kueue.x-k8s.io/queue-name: lq-team-b # Point to the LocalQueue spec: ttlSecondsAfterFinished: 60 # Job will be deleted after 60 seconds parallelism: 3 # This Job will have 3 replicas running at the same time From b2e041456c9aa39020d24e9f6aa96ad58fb6b1fc Mon Sep 17 00:00:00 2001 From: Roberto Barbero <18034094+rbarberop@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:19:09 +0000 Subject: [PATCH 8/8] Updated cq names in comments --- batch/kueue-cohort/cq-spot.yaml | 2 +- batch/kueue-cohort/cq-team-a.yaml | 2 +- batch/kueue-cohort/cq-team-b.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/batch/kueue-cohort/cq-spot.yaml b/batch/kueue-cohort/cq-spot.yaml index 1e73ced3ed..5e31928fb9 100644 --- a/batch/kueue-cohort/cq-spot.yaml +++ b/batch/kueue-cohort/cq-spot.yaml @@ -18,7 +18,7 @@ kind: ClusterQueue metadata: name: spot-cq spec: - cohort: all-teams + cohort: all-teams # Same cohort as cq-team-a and cq-team-b resourceGroups: - coveredResources: ["cpu", "memory"] flavors: diff --git a/batch/kueue-cohort/cq-team-a.yaml b/batch/kueue-cohort/cq-team-a.yaml index 9b5fad6dc8..bdd53c1eff 100644 --- a/batch/kueue-cohort/cq-team-a.yaml +++ b/batch/kueue-cohort/cq-team-a.yaml @@ -18,7 +18,7 @@ kind: ClusterQueue metadata: name: cq-team-a spec: - cohort: all-teams # team-a-cq and team-b-cq share the same cohort + cohort: all-teams # cq-team-a and cq-team-b share the same cohort namespaceSelector: matchLabels: kubernetes.io/metadata.name: team-a #Only team-a can submit jobs direclty to this queue, but will be able to share it through the cohort diff --git a/batch/kueue-cohort/cq-team-b.yaml b/batch/kueue-cohort/cq-team-b.yaml index b18433950b..2f18e879ba 100644 --- a/batch/kueue-cohort/cq-team-b.yaml +++ b/batch/kueue-cohort/cq-team-b.yaml @@ -18,7 +18,7 @@ kind: ClusterQueue metadata: name: cq-team-b spec: - cohort: all-teams # team-a-cq and team-b-cq share the same cohort + cohort: all-teams # cq-team-a and cq-team-b share the same cohort namespaceSelector: matchLabels: kubernetes.io/metadata.name: team-b #Only team-b can submit jobs direclty to this queue, but will be able to share it through the cohort