Skip to content

Commit c4160f4

Browse files
fix: add-cluster functionality for k8s 1.27 (#715)
## What In this PR, we are making a simple change to ensure that our CLI supports adding Kubernetes clusters with version 1.27. The change involves modifying the way we find the pod owned by a job using the label. ## Why These changes are being made to accommodate the changes introduced in Kubernetes version 1.27. In version 1.27, pods owned by a Job now use the labels `batch.kubernetes.io/job-name` and `batch.kubernetes.io/controller-uid`. This is a change from the previous labels `job-name` and `controller-uid`, which were used for compatibility. By making this adjustment, we ensure that our CLI is compatible with Kubernetes 1.27 and can correctly identify pods owned by a job. ## Notes Link to the changelog - https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.27.md#api-change-3
1 parent 8ddd021 commit c4160f4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.50
1+
VERSION=v0.1.51
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.42/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.51/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.42/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.51/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

pkg/util/kube/kube.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ func deleteJob(ctx context.Context, client kubernetes.Interface, job *batchv1.Jo
566566

567567
func getPodByJob(ctx context.Context, client kubernetes.Interface, job *batchv1.Job) (*v1.Pod, error) {
568568
pods, err := client.CoreV1().Pods(job.GetNamespace()).List(ctx, metav1.ListOptions{
569-
LabelSelector: "controller-uid=" + job.Spec.Selector.MatchLabels["controller-uid"],
569+
LabelSelector: "controller-uid=" + job.Labels["controller-uid"],
570570
})
571571
if err != nil {
572572
return nil, err

0 commit comments

Comments
 (0)