Skip to content

Commit 09c9b0a

Browse files
committed
Merge branch 'slice-main' into evict_if_not_tolerated
2 parents 1998982 + b6bfa30 commit 09c9b0a

21 files changed

Lines changed: 31 additions & 561 deletions

slice/cmd/main.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727

2828
"k8s.io/apimachinery/pkg/runtime"
2929
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
30-
utilfeature "k8s.io/apiserver/pkg/util/feature"
3130
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3231
ctrl "sigs.k8s.io/controller-runtime"
3332
"sigs.k8s.io/controller-runtime/pkg/certwatcher"
@@ -78,7 +77,6 @@ func main() {
7877
var enableHTTP2 bool
7978
var sliceHealthNodeAffinityMode string
8079
var tlsOpts []func(*tls.Config)
81-
var featureGates string
8280
flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
8381
"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
8482
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
@@ -101,20 +99,12 @@ func main() {
10199
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
102100
flag.StringVar(&sliceHealthNodeAffinityMode, "default-slice-health-node-affinity", "HEALTHY",
103101
"Default slice health node affinity. Possible values are HEALTHY or HEALTHY_AND_DEGRADED.")
104-
flag.StringVar(&featureGates, "feature-gates", "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
105102
opts := zap.Options{
106103
Development: true,
107104
}
108105
opts.BindFlags(flag.CommandLine)
109106
flag.Parse()
110107

111-
if featureGates != "" {
112-
if err := utilfeature.DefaultMutableFeatureGate.Set(featureGates); err != nil {
113-
setupLog.Error(err, "Unable to set flag gates for known features")
114-
os.Exit(1)
115-
}
116-
}
117-
118108
var sliceHealthValues []string
119109
switch sliceHealthNodeAffinityMode {
120110
case "HEALTHY":
@@ -294,10 +284,6 @@ func setupControllers(mgr ctrl.Manager, certsReady chan struct{}, activationTime
294284
setupLog.Error(err, "Unable to create webhook", "webhook", "Job")
295285
os.Exit(1)
296286
}
297-
if err := webhooks.SetupPodWebhookWithManager(mgr); err != nil {
298-
setupLog.Error(err, "Unable to create webhook", "webhook", "Pod")
299-
os.Exit(1)
300-
}
301287

302288
if failedCtrl, err := controller.SetupControllers(mgr, controller.Options{
303289
ActivationTimeout: activationTimeout, RetryDelayOnSliceFailure: retryDelay}); err != nil {

slice/config/default/webhook_selector_patch.yaml

Whitespace-only changes.

slice/config/webhook/kustomization.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@ resources:
22
- manifests.yaml
33
- service.yaml
44

5-
patches:
6-
- path: webhook_selector_patch.yaml
7-
85
configurations:
96
- kustomizeconfig.yaml

slice/config/webhook/manifests.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,3 @@ webhooks:
4242
resources:
4343
- jobsets
4444
sideEffects: None
45-
- admissionReviewVersions:
46-
- v1
47-
clientConfig:
48-
service:
49-
name: webhook-service
50-
namespace: system
51-
path: /mutate--v1-pod
52-
failurePolicy: Fail
53-
name: mpod.accelerator.gke.io
54-
rules:
55-
- apiGroups:
56-
- ""
57-
apiVersions:
58-
- v1
59-
operations:
60-
- CREATE
61-
resources:
62-
- pods
63-
sideEffects: None

slice/config/webhook/webhook_selector_patch.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

slice/internal/controller/workload_controller.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import (
5050

5151
"tpu-slice-controller/api/v1beta1"
5252
"tpu-slice-controller/internal/core"
53-
"tpu-slice-controller/internal/features"
5453
"tpu-slice-controller/internal/topology"
5554
"tpu-slice-controller/internal/util/api"
5655
"tpu-slice-controller/internal/util/node"

slice/internal/controller/workload_controller_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,12 +1613,10 @@ func TestWorkloadReconciler(t *testing.T) {
16131613
[]kueue.PodSetUpdate{
16141614
{
16151615
Name: "ps1",
1616-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
16171616
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
16181617
},
16191618
{
16201619
Name: "ps2",
1621-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
16221620
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
16231621
},
16241622
})).
@@ -1661,12 +1659,10 @@ func TestWorkloadReconciler(t *testing.T) {
16611659
[]kueue.PodSetUpdate{
16621660
{
16631661
Name: "ps1",
1664-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
16651662
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
16661663
},
16671664
{
16681665
Name: "ps2",
1669-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
16701666
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
16711667
},
16721668
})).
@@ -1823,12 +1819,10 @@ func TestWorkloadReconciler(t *testing.T) {
18231819
[]kueue.PodSetUpdate{
18241820
{
18251821
Name: "ps1",
1826-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
18271822
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
18281823
},
18291824
{
18301825
Name: "ps2",
1831-
Labels: map[string]string{core.PodWebhookLabelKey: "true"},
18321826
NodeSelector: map[string]string{"cloud.google.com/gke-tpu-topology": "4x4x4"},
18331827
},
18341828
})).

slice/internal/core/constants.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ import (
2424

2525
const (
2626
TPUSliceTopologyAnnotation = "cloud.google.com/gke-tpu-slice-topology"
27-
TPUSliceNodeLabel = "cloud.google.com/gke-tpu-slice"
2827
TPUTopologyAnnotation = "cloud.google.com/gke-tpu-topology"
2928
TPUAcceleratorLabel = "cloud.google.com/gke-tpu-accelerator"
3029
TPUBlockLabel = "cloud.google.com/gce-topology-block"
3130
TPUSubBlockLabel = "cloud.google.com/gke-tpu-partition-4x4x4-id"
32-
PodWebhookLabelKey = "cloud.google.com/gke-tpu-slice-pod"
3331
TPUResourceName = "google.com/tpu"
3432
TPUsPerCube = 64
3533

slice/internal/core/jobset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func BaseSSAReplicatedJob(name string) jobset.ReplicatedJob {
5555
}
5656
}
5757

58-
func AddNodeAffinity(template *corev1.PodTemplateSpec, key string, operator corev1.NodeSelectorOperator, values []string) {
58+
func AddNodeAffinity(template *corev1.PodTemplateSpec, key string, values []string) {
5959
if template.Spec.Affinity == nil {
6060
template.Spec.Affinity = &corev1.Affinity{}
6161
}
@@ -69,7 +69,7 @@ func AddNodeAffinity(template *corev1.PodTemplateSpec, key string, operator core
6969
nodeSelector := template.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution
7070
requirement := corev1.NodeSelectorRequirement{
7171
Key: key,
72-
Operator: operator,
72+
Operator: corev1.NodeSelectorOpIn,
7373
Values: values,
7474
}
7575

slice/internal/util/testingjobs/job/wrappers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ func (j *JobWrapper) Args(args ...string) *JobWrapper {
129129
}
130130

131131
func (j *JobWrapper) NodeAffinity(key string, values []string) *JobWrapper {
132-
core.AddNodeAffinity(&j.Spec.Template, key, corev1.NodeSelectorOpIn, values)
132+
core.AddNodeAffinity(&j.Spec.Template, key, values)
133133
return j
134134
}

0 commit comments

Comments
 (0)