mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-09 14:02:56 +09:00
The GPU admission webhooks need a Service, a serving certificate and webhook configurations, and the binder's metrics need a port a scrape can reach. All of it renders only with GPU enabled, which the platform sets where KubeVirt serves GPUs, so clusters without KubeVirt change nothing. The webhooks fail closed. The two mutating ones select only VMIs and virt-launcher pods carrying the device-reference label, the pod webhook also requiring the virt-launcher label, so of VMIs and pods a controller outage blocks only the start of VMs with device references; the GPUDevice webhook blocks new orders as well. The controller then runs two replicas behind a PDB, since a single fail-closed replica would block those starts on every rollout. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
/*
|
|
Copyright 2026 The Cozystack Authors.
|
|
|
|
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
|
|
|
|
http://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.
|
|
*/
|
|
|
|
package webhook
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// The chart's webhook configurations must call the paths the binary serves.
|
|
func TestChartCallsRegisteredPaths(t *testing.T) {
|
|
chart, err := os.ReadFile("../../../packages/system/cozystack-controller/templates/webhooks.yaml")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, path := range []string{PathValidateDevice, PathMutateVMI, PathPinPod} {
|
|
if !strings.Contains(string(chart), "path: "+path+"\n") {
|
|
t.Errorf("webhooks.yaml does not call %s", path)
|
|
}
|
|
}
|
|
}
|