diff --git a/CHANGELOG.md b/CHANGELOG.md index f1168dd704..5a8bee7b7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.9.7 / 2020-05-24 + +* [BUGFIX] internal/store/mutatingwebhookconfiguration.go: Switch to v1 #1144 + ## v1.9.6 / 2020-05-06 * [BUGFIX] Fix VolumeAttachment API version mismatch: expected v1 but watching v1beta1 #1136 diff --git a/README.md b/README.md index 3127295e6a..0490580370 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ At most, 5 kube-state-metrics and 5 [kubernetes releases](https://github.com/kub | **v1.6.0** | ✓ | ✓ | - | - | - | | **v1.7.2** | ✓ | ✓ | ✓ | - | - | | **v1.8.0** | ✓ | ✓ | ✓ | ✓ | - | -| **v1.9.6** | ✓ | ✓ | ✓ | ✓ | ✓ | +| **v1.9.7** | ✓ | ✓ | ✓ | ✓ | ✓ | | **master** | ✓ | ✓ | ✓ | ✓ | ✓ | - `✓` Fully supported version range. - `-` The Kubernetes cluster has features the client-go library can't use (additional API objects, etc). @@ -79,8 +79,8 @@ release. #### Container Image The latest container image can be found at: -* `quay.io/coreos/kube-state-metrics:v1.9.6` -* `k8s.gcr.io/kube-state-metrics:v1.9.6` +* `quay.io/coreos/kube-state-metrics:v1.9.7` +* `k8s.gcr.io/kube-state-metrics:v1.9.7` **Note**: The recommended docker registry for kube-state-metrics is `quay.io`. kube-state-metrics on diff --git a/VERSION b/VERSION index 7bc1c40470..fee0a2788b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.6 +1.9.7 diff --git a/examples/autosharding/cluster-role-binding.yaml b/examples/autosharding/cluster-role-binding.yaml index 7e51592884..6e0ee41932 100644 --- a/examples/autosharding/cluster-role-binding.yaml +++ b/examples/autosharding/cluster-role-binding.yaml @@ -3,7 +3,7 @@ kind: ClusterRoleBinding metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/examples/autosharding/cluster-role.yaml b/examples/autosharding/cluster-role.yaml index 77e7b35605..c04db29000 100644 --- a/examples/autosharding/cluster-role.yaml +++ b/examples/autosharding/cluster-role.yaml @@ -3,7 +3,7 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics rules: - apiGroups: diff --git a/examples/autosharding/role-binding.yaml b/examples/autosharding/role-binding.yaml index d6319c20e3..0aa0dde3c0 100644 --- a/examples/autosharding/role-binding.yaml +++ b/examples/autosharding/role-binding.yaml @@ -3,7 +3,7 @@ kind: RoleBinding metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/examples/autosharding/role.yaml b/examples/autosharding/role.yaml index d57505142d..68986c4549 100644 --- a/examples/autosharding/role.yaml +++ b/examples/autosharding/role.yaml @@ -3,7 +3,7 @@ kind: Role metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system rules: diff --git a/examples/autosharding/service-account.yaml b/examples/autosharding/service-account.yaml index 8bc5e69d59..e0f9abf25b 100644 --- a/examples/autosharding/service-account.yaml +++ b/examples/autosharding/service-account.yaml @@ -3,6 +3,6 @@ kind: ServiceAccount metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system diff --git a/examples/autosharding/service.yaml b/examples/autosharding/service.yaml index 50fae3d2c3..f5b488f5ad 100644 --- a/examples/autosharding/service.yaml +++ b/examples/autosharding/service.yaml @@ -3,7 +3,7 @@ kind: Service metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system spec: diff --git a/examples/autosharding/statefulset.yaml b/examples/autosharding/statefulset.yaml index 72b398d579..c43f991e20 100644 --- a/examples/autosharding/statefulset.yaml +++ b/examples/autosharding/statefulset.yaml @@ -3,7 +3,7 @@ kind: StatefulSet metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system spec: @@ -16,7 +16,7 @@ spec: metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 spec: containers: - args: @@ -33,7 +33,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - image: quay.io/coreos/kube-state-metrics:v1.9.6 + image: quay.io/coreos/kube-state-metrics:v1.9.7 livenessProbe: httpGet: path: /healthz diff --git a/examples/standard/cluster-role-binding.yaml b/examples/standard/cluster-role-binding.yaml index 7e51592884..6e0ee41932 100644 --- a/examples/standard/cluster-role-binding.yaml +++ b/examples/standard/cluster-role-binding.yaml @@ -3,7 +3,7 @@ kind: ClusterRoleBinding metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/examples/standard/cluster-role.yaml b/examples/standard/cluster-role.yaml index 77e7b35605..c04db29000 100644 --- a/examples/standard/cluster-role.yaml +++ b/examples/standard/cluster-role.yaml @@ -3,7 +3,7 @@ kind: ClusterRole metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics rules: - apiGroups: diff --git a/examples/standard/deployment.yaml b/examples/standard/deployment.yaml index e5abb0578b..b6fa1fba96 100644 --- a/examples/standard/deployment.yaml +++ b/examples/standard/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system spec: @@ -15,10 +15,10 @@ spec: metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 spec: containers: - - image: quay.io/coreos/kube-state-metrics:v1.9.6 + - image: quay.io/coreos/kube-state-metrics:v1.9.7 livenessProbe: httpGet: path: /healthz diff --git a/examples/standard/service-account.yaml b/examples/standard/service-account.yaml index 8bc5e69d59..e0f9abf25b 100644 --- a/examples/standard/service-account.yaml +++ b/examples/standard/service-account.yaml @@ -3,6 +3,6 @@ kind: ServiceAccount metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system diff --git a/examples/standard/service.yaml b/examples/standard/service.yaml index 50fae3d2c3..f5b488f5ad 100644 --- a/examples/standard/service.yaml +++ b/examples/standard/service.yaml @@ -3,7 +3,7 @@ kind: Service metadata: labels: app.kubernetes.io/name: kube-state-metrics - app.kubernetes.io/version: v1.9.6 + app.kubernetes.io/version: v1.9.7 name: kube-state-metrics namespace: kube-system spec: diff --git a/internal/store/builder.go b/internal/store/builder.go index 70cb8c6e75..22383c122c 100644 --- a/internal/store/builder.go +++ b/internal/store/builder.go @@ -24,7 +24,7 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - admissionregistration "k8s.io/api/admissionregistration/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" appsv1 "k8s.io/api/apps/v1" autoscaling "k8s.io/api/autoscaling/v2beta1" batchv1 "k8s.io/api/batch/v1" @@ -229,7 +229,7 @@ func (b *Builder) buildLimitRangeStore() *metricsstore.MetricsStore { } func (b *Builder) buildMutatingWebhookConfigurationStore() *metricsstore.MetricsStore { - return b.buildStore(mutatingWebhookConfigurationMetricFamilies, &admissionregistration.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch) + return b.buildStore(mutatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.MutatingWebhookConfiguration{}, createMutatingWebhookConfigurationListWatch) } func (b *Builder) buildNamespaceStore() *metricsstore.MetricsStore { @@ -293,7 +293,7 @@ func (b *Builder) buildCsrStore() *metricsstore.MetricsStore { } func (b *Builder) buildValidatingWebhookConfigurationStore() *metricsstore.MetricsStore { - return b.buildStore(validatingWebhookConfigurationMetricFamilies, &admissionregistration.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch) + return b.buildStore(validatingWebhookConfigurationMetricFamilies, &admissionregistrationv1.ValidatingWebhookConfiguration{}, createValidatingWebhookConfigurationListWatch) } func (b *Builder) buildVolumeAttachmentStore() *metricsstore.MetricsStore { diff --git a/internal/store/mutatingwebhookconfiguration.go b/internal/store/mutatingwebhookconfiguration.go index 9adbb3e1c7..57a0d61504 100644 --- a/internal/store/mutatingwebhookconfiguration.go +++ b/internal/store/mutatingwebhookconfiguration.go @@ -17,7 +17,7 @@ limitations under the License. package store import ( - admissionregistration "k8s.io/api/admissionregistration/v1beta1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" @@ -36,7 +36,7 @@ var ( Name: "kube_mutatingwebhookconfiguration_info", Type: metric.Gauge, Help: "Information about the MutatingWebhookConfiguration.", - GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistration.MutatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistrationv1.MutatingWebhookConfiguration) *metric.Family { return &metric.Family{ Metrics: []*metric.Metric{ { @@ -50,7 +50,7 @@ var ( Name: "kube_mutatingwebhookconfiguration_created", Type: metric.Gauge, Help: "Unix creation timestamp.", - GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistration.MutatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistrationv1.MutatingWebhookConfiguration) *metric.Family { ms := []*metric.Metric{} if !mwc.CreationTimestamp.IsZero() { @@ -67,7 +67,7 @@ var ( Name: "kube_mutatingwebhookconfiguration_metadata_resource_version", Type: metric.Gauge, Help: "Resource version representing a specific version of the MutatingWebhookConfiguration.", - GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistration.MutatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapMutatingWebhookConfigurationFunc(func(mwc *admissionregistrationv1.MutatingWebhookConfiguration) *metric.Family { return &metric.Family{ Metrics: resourceVersionMetric(mwc.ObjectMeta.ResourceVersion), } @@ -79,17 +79,17 @@ var ( func createMutatingWebhookConfigurationListWatch(kubeClient clientset.Interface, ns string) cache.ListerWatcher { return &cache.ListWatch{ ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { - return kubeClient.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(opts) + return kubeClient.AdmissionregistrationV1().MutatingWebhookConfigurations().List(opts) }, WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { - return kubeClient.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(opts) + return kubeClient.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(opts) }, } } -func wrapMutatingWebhookConfigurationFunc(f func(*admissionregistration.MutatingWebhookConfiguration) *metric.Family) func(interface{}) *metric.Family { +func wrapMutatingWebhookConfigurationFunc(f func(*admissionregistrationv1.MutatingWebhookConfiguration) *metric.Family) func(interface{}) *metric.Family { return func(obj interface{}) *metric.Family { - mutatingWebhookConfiguration := obj.(*admissionregistration.MutatingWebhookConfiguration) + mutatingWebhookConfiguration := obj.(*admissionregistrationv1.MutatingWebhookConfiguration) metricFamily := f(mutatingWebhookConfiguration) diff --git a/internal/store/mutatingwebhookconfiguration_test.go b/internal/store/mutatingwebhookconfiguration_test.go index a387b34016..c78a0ab0fd 100644 --- a/internal/store/mutatingwebhookconfiguration_test.go +++ b/internal/store/mutatingwebhookconfiguration_test.go @@ -19,7 +19,7 @@ package store import ( "testing" - admissionregistration "k8s.io/api/admissionregistration/v1beta1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/kube-state-metrics/pkg/metric" @@ -31,7 +31,7 @@ func TestMutatingWebhookConfigurationStore(t *testing.T) { cases := []generateMetricsTestCase{ { - Obj: &admissionregistration.MutatingWebhookConfiguration{ + Obj: &admissionregistrationv1.MutatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "mutatingwebhookconfiguration1", Namespace: "ns1", @@ -49,7 +49,7 @@ func TestMutatingWebhookConfigurationStore(t *testing.T) { MetricNames: []string{"kube_mutatingwebhookconfiguration_info", "kube_mutatingwebhookconfiguration_metadata_resource_version"}, }, { - Obj: &admissionregistration.MutatingWebhookConfiguration{ + Obj: &admissionregistrationv1.MutatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "mutatingwebhookconfiguration2", Namespace: "ns2", diff --git a/internal/store/validatingwebhookconfiguration.go b/internal/store/validatingwebhookconfiguration.go index 4e0ae6610d..7742332c1f 100644 --- a/internal/store/validatingwebhookconfiguration.go +++ b/internal/store/validatingwebhookconfiguration.go @@ -17,7 +17,7 @@ limitations under the License. package store import ( - admissionregistration "k8s.io/api/admissionregistration/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" @@ -36,7 +36,7 @@ var ( Name: "kube_validatingwebhookconfiguration_info", Type: metric.Gauge, Help: "Information about the ValidatingWebhookConfiguration.", - GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistration.ValidatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistrationv1.ValidatingWebhookConfiguration) *metric.Family { return &metric.Family{ Metrics: []*metric.Metric{ { @@ -50,7 +50,7 @@ var ( Name: "kube_validatingwebhookconfiguration_created", Type: metric.Gauge, Help: "Unix creation timestamp.", - GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistration.ValidatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistrationv1.ValidatingWebhookConfiguration) *metric.Family { ms := []*metric.Metric{} if !vwc.CreationTimestamp.IsZero() { @@ -67,7 +67,7 @@ var ( Name: "kube_validatingwebhookconfiguration_metadata_resource_version", Type: metric.Gauge, Help: "Resource version representing a specific version of the ValidatingWebhookConfiguration.", - GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistration.ValidatingWebhookConfiguration) *metric.Family { + GenerateFunc: wrapValidatingWebhookConfigurationFunc(func(vwc *admissionregistrationv1.ValidatingWebhookConfiguration) *metric.Family { return &metric.Family{ Metrics: resourceVersionMetric(vwc.ObjectMeta.ResourceVersion), } @@ -87,9 +87,9 @@ func createValidatingWebhookConfigurationListWatch(kubeClient clientset.Interfac } } -func wrapValidatingWebhookConfigurationFunc(f func(*admissionregistration.ValidatingWebhookConfiguration) *metric.Family) func(interface{}) *metric.Family { +func wrapValidatingWebhookConfigurationFunc(f func(*admissionregistrationv1.ValidatingWebhookConfiguration) *metric.Family) func(interface{}) *metric.Family { return func(obj interface{}) *metric.Family { - mutatingWebhookConfiguration := obj.(*admissionregistration.ValidatingWebhookConfiguration) + mutatingWebhookConfiguration := obj.(*admissionregistrationv1.ValidatingWebhookConfiguration) metricFamily := f(mutatingWebhookConfiguration) diff --git a/internal/store/validatingwebhookconfiguration_test.go b/internal/store/validatingwebhookconfiguration_test.go index f69f1ddc56..e0ba7d3f51 100644 --- a/internal/store/validatingwebhookconfiguration_test.go +++ b/internal/store/validatingwebhookconfiguration_test.go @@ -19,7 +19,7 @@ package store import ( "testing" - admissionregistration "k8s.io/api/admissionregistration/v1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/kube-state-metrics/pkg/metric" @@ -31,7 +31,7 @@ func TestValidatingWebhookConfigurationStore(t *testing.T) { cases := []generateMetricsTestCase{ { - Obj: &admissionregistration.ValidatingWebhookConfiguration{ + Obj: &admissionregistrationv1.ValidatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "validatingwebhookconfiguration1", Namespace: "ns1", @@ -49,7 +49,7 @@ func TestValidatingWebhookConfigurationStore(t *testing.T) { MetricNames: []string{"kube_validatingwebhookconfiguration_info", "kube_validatingwebhookconfiguration_metadata_resource_version"}, }, { - Obj: &admissionregistration.ValidatingWebhookConfiguration{ + Obj: &admissionregistrationv1.ValidatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ Name: "validatingwebhookconfiguration2", Namespace: "ns2", diff --git a/tests/manifests/mutatingwebhookconfiguration.yaml b/tests/manifests/mutatingwebhookconfiguration.yaml index 82ce030e6e..8869db6225 100644 --- a/tests/manifests/mutatingwebhookconfiguration.yaml +++ b/tests/manifests/mutatingwebhookconfiguration.yaml @@ -1,4 +1,4 @@ -apiVersion: admissionregistration.k8s.io/v1beta1 +apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: example-mutatingwebhookconfiguration @@ -11,6 +11,9 @@ webhooks: namespace: apples path: /apple caBundle: "YXBwbGVz" + admissionReviewVersions: ["v1", "v1beta1"] + sideEffects: None + timeoutSeconds: 5 namespaceSelector: matchExpressions: - key: production