• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubevirt / kubevirt / e107807c-996d-4f67-a45b-fcee30cbf691

13 Jan 2025 09:36PM UTC coverage: 71.4% (+0.007%) from 71.393%
e107807c-996d-4f67-a45b-fcee30cbf691

push

prow

web-flow
Merge pull request #13654 from ShellyKa13/separate-storage-admitters

Move storage related webhook admitters to pkg/storage [part1]

201 of 232 new or added lines in 5 files covered. (86.64%)

2 existing lines in 1 file now uncovered.

61527 of 86172 relevant lines covered (71.4%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/virt-api/webhooks/validating-webhook/validating-webhook.go
1
/*
2
 * This file is part of the KubeVirt project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 *
16
 * Copyright 2018 Red Hat, Inc.
17
 *
18
 */
19

20
package validating_webhook
21

22
import (
23
        "net/http"
24

25
        "kubevirt.io/client-go/kubecli"
26

27
        storageAdmitters "kubevirt.io/kubevirt/pkg/storage/admitters"
28
        validating_webhooks "kubevirt.io/kubevirt/pkg/util/webhooks/validating-webhooks"
29
        "kubevirt.io/kubevirt/pkg/virt-api/webhooks"
30
        "kubevirt.io/kubevirt/pkg/virt-api/webhooks/validating-webhook/admitters"
31
        virtconfig "kubevirt.io/kubevirt/pkg/virt-config"
32
)
33

34
func ServeVMICreate(
35
        resp http.ResponseWriter,
36
        req *http.Request,
37
        clusterConfig *virtconfig.ClusterConfig,
38
        kubeVirtServiceAccounts map[string]struct{},
39
        specValidators ...admitters.SpecValidator,
40
) {
×
41
        validating_webhooks.Serve(resp, req, &admitters.VMICreateAdmitter{
×
42
                ClusterConfig:           clusterConfig,
×
43
                KubeVirtServiceAccounts: kubeVirtServiceAccounts,
×
44
                SpecValidators:          specValidators,
×
45
        })
×
46
}
×
47

48
func ServeVMIUpdate(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, kubeVirtServiceAccounts map[string]struct{}) {
×
49
        validating_webhooks.Serve(resp, req, admitters.NewVMIUpdateAdmitter(clusterConfig, kubeVirtServiceAccounts))
×
50
}
×
51

52
func ServeVMs(
53
        resp http.ResponseWriter,
54
        req *http.Request,
55
        clusterConfig *virtconfig.ClusterConfig,
56
        virtCli kubecli.KubevirtClient,
57
        informers *webhooks.Informers,
58
        kubeVirtServiceAccounts map[string]struct{},
59
) {
×
60
        validating_webhooks.Serve(resp, req, admitters.NewVMsAdmitter(clusterConfig, virtCli, informers, kubeVirtServiceAccounts))
×
61
}
×
62

63
func ServeVMIRS(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig) {
×
64
        validating_webhooks.Serve(resp, req, &admitters.VMIRSAdmitter{ClusterConfig: clusterConfig})
×
65
}
×
66

67
func ServeVMPool(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, kubeVirtServiceAccounts map[string]struct{}) {
×
68
        validating_webhooks.Serve(resp, req, &admitters.VMPoolAdmitter{ClusterConfig: clusterConfig, KubeVirtServiceAccounts: kubeVirtServiceAccounts})
×
69
}
×
70

71
func ServeVMIPreset(resp http.ResponseWriter, req *http.Request) {
×
72
        validating_webhooks.Serve(resp, req, &admitters.VMIPresetAdmitter{})
×
73
}
×
74

75
func ServeMigrationCreate(resp http.ResponseWriter, req *http.Request, virtCli kubecli.KubevirtClient) {
×
76
        validating_webhooks.Serve(resp, req, admitters.NewMigrationCreateAdmitter(virtCli.GeneratedKubeVirtClient()))
×
77
}
×
78

79
func ServeMigrationUpdate(resp http.ResponseWriter, req *http.Request) {
×
80
        validating_webhooks.Serve(resp, req, &admitters.MigrationUpdateAdmitter{})
×
81
}
×
82

83
func ServeVMSnapshots(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, virtCli kubecli.KubevirtClient) {
×
NEW
84
        validating_webhooks.Serve(resp, req, storageAdmitters.NewVMSnapshotAdmitter(clusterConfig, virtCli))
×
85
}
×
86

87
func ServeVMRestores(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, virtCli kubecli.KubevirtClient, informers *webhooks.Informers) {
×
NEW
88
        validating_webhooks.Serve(resp, req, storageAdmitters.NewVMRestoreAdmitter(clusterConfig, virtCli, informers.VMRestoreInformer))
×
89
}
×
90

91
func ServeVMExports(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig) {
×
NEW
92
        validating_webhooks.Serve(resp, req, storageAdmitters.NewVMExportAdmitter(clusterConfig))
×
93
}
×
94

95
func ServeVmInstancetypes(resp http.ResponseWriter, req *http.Request) {
×
96
        validating_webhooks.Serve(resp, req, &admitters.InstancetypeAdmitter{})
×
97
}
×
98

99
func ServeVmClusterInstancetypes(resp http.ResponseWriter, req *http.Request) {
×
100
        validating_webhooks.Serve(resp, req, &admitters.ClusterInstancetypeAdmitter{})
×
101
}
×
102

103
func ServeVmPreferences(resp http.ResponseWriter, req *http.Request) {
×
104
        validating_webhooks.Serve(resp, req, &admitters.PreferenceAdmitter{})
×
105
}
×
106

107
func ServeVmClusterPreferences(resp http.ResponseWriter, req *http.Request) {
×
108
        validating_webhooks.Serve(resp, req, &admitters.ClusterPreferenceAdmitter{})
×
109
}
×
110

111
func ServeStatusValidation(resp http.ResponseWriter,
112
        req *http.Request,
113
        clusterConfig *virtconfig.ClusterConfig,
114
        virtCli kubecli.KubevirtClient,
115
        informers *webhooks.Informers,
116
        kubeVirtServiceAccounts map[string]struct{},
117
) {
×
118
        validating_webhooks.Serve(resp, req, &admitters.StatusAdmitter{
×
119
                VmsAdmitter: admitters.NewVMsAdmitter(clusterConfig, virtCli, informers, kubeVirtServiceAccounts),
×
120
        })
×
121
}
×
122

123
func ServePodEvictionInterceptor(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, virtCli kubecli.KubevirtClient) {
×
124
        validating_webhooks.Serve(resp, req, admitters.NewPodEvictionAdmitter(clusterConfig, virtCli, virtCli.GeneratedKubeVirtClient()))
×
125
}
×
126

127
func ServeMigrationPolicies(resp http.ResponseWriter, req *http.Request) {
×
128
        validating_webhooks.Serve(resp, req, admitters.NewMigrationPolicyAdmitter())
×
129
}
×
130

131
func ServeVirtualMachineClones(resp http.ResponseWriter, req *http.Request, clusterConfig *virtconfig.ClusterConfig, virtCli kubecli.KubevirtClient) {
×
132
        validating_webhooks.Serve(resp, req, admitters.NewVMCloneAdmitter(clusterConfig, virtCli))
×
133
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc