Skip to content

Commit

Permalink
Merge pull request #1150 from kubernetes/pick-mwc-fix
Browse files Browse the repository at this point in the history
*: cut release-1.9.7
  • Loading branch information
k8s-ci-robot authored May 28, 2020
2 parents 3776bbf + f8e013c commit b3fa585
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.6
1.9.7
2 changes: 1 addition & 1 deletion examples/autosharding/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/autosharding/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/autosharding/role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/autosharding/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/autosharding/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/autosharding/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions examples/autosharding/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/standard/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/standard/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions examples/standard/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/standard/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion examples/standard/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions internal/store/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions internal/store/mutatingwebhookconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
{
Expand All @@ -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() {
Expand All @@ -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),
}
Expand All @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions internal/store/mutatingwebhookconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -31,7 +31,7 @@ func TestMutatingWebhookConfigurationStore(t *testing.T) {

cases := []generateMetricsTestCase{
{
Obj: &admissionregistration.MutatingWebhookConfiguration{
Obj: &admissionregistrationv1.MutatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "mutatingwebhookconfiguration1",
Namespace: "ns1",
Expand All @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions internal/store/validatingwebhookconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
{
Expand All @@ -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() {
Expand All @@ -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),
}
Expand All @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions internal/store/validatingwebhookconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -31,7 +31,7 @@ func TestValidatingWebhookConfigurationStore(t *testing.T) {

cases := []generateMetricsTestCase{
{
Obj: &admissionregistration.ValidatingWebhookConfiguration{
Obj: &admissionregistrationv1.ValidatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: "validatingwebhookconfiguration1",
Namespace: "ns1",
Expand All @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion tests/manifests/mutatingwebhookconfiguration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: admissionregistration.k8s.io/v1beta1
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: example-mutatingwebhookconfiguration
Expand All @@ -11,6 +11,9 @@ webhooks:
namespace: apples
path: /apple
caBundle: "YXBwbGVz"
admissionReviewVersions: ["v1", "v1beta1"]
sideEffects: None
timeoutSeconds: 5
namespaceSelector:
matchExpressions:
- key: production
Expand Down

0 comments on commit b3fa585

Please sign in to comment.