| 1 |
/* |
| 2 |
Copyright 2020 The Kubernetes Authors. |
| 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 |
|
| 17 |
package webhook |
| 18 |
|
| 19 |
import ( |
| 20 |
"k8s.io/component-base/metrics" |
| 21 |
"k8s.io/component-base/metrics/legacyregistry" |
| 22 |
) |
| 23 |
|
| 24 |
var x509MissingSANCounter = metrics.NewCounter( |
| 25 |
&metrics.CounterOpts{ |
| 26 |
Subsystem: "webhooks", |
| 27 |
Namespace: "apiserver", |
| 28 |
Name: "x509_missing_san_total", |
| 29 |
Help: "Counts the number of requests to servers missing SAN extension " + |
| 30 |
"in their serving certificate OR the number of connection failures " + |
| 31 |
"due to the lack of x509 certificate SAN extension missing " + |
| 32 |
"(either/or, based on the runtime environment)", |
| 33 |
StabilityLevel: metrics.ALPHA, |
| 34 |
}, |
| 35 |
) |
| 36 |
|
| 37 |
var x509InsecureSHA1Counter = metrics.NewCounter( |
| 38 |
&metrics.CounterOpts{ |
| 39 |
Subsystem: "webhooks", |
| 40 |
Namespace: "apiserver", |
| 41 |
Name: "x509_insecure_sha1_total", |
| 42 |
Help: "Counts the number of requests to servers with insecure SHA1 signatures " + |
| 43 |
"in their serving certificate OR the number of connection failures " + |
| 44 |
"due to the insecure SHA1 signatures (either/or, based on the runtime environment)", |
| 45 |
StabilityLevel: metrics.ALPHA, |
| 46 |
}, |
| 47 |
) |
| 48 |
|
| 49 |
func init() { |
| 50 |
legacyregistry.MustRegister(x509MissingSANCounter) |
| 51 |
legacyregistry.MustRegister(x509InsecureSHA1Counter) |
| 52 |
} |