From 7a0b3af0b7d3bad37956259cd2e8326848d99e2c Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Mon, 18 Jul 2016 22:16:27 +0900 Subject: [PATCH 1/2] config: validate Kubernetes role correctly. --- config/config.go | 4 ++-- config/config_test.go | 3 +++ config/testdata/kubernetes_role.bad.yml | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 config/testdata/kubernetes_role.bad.yml diff --git a/config/config.go b/config/config.go index c9074fd1b..2fd88fc68 100644 --- a/config/config.go +++ b/config/config.go @@ -781,7 +781,7 @@ func (c *MarathonSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro // KubernetesSDConfig is the configuration for Kubernetes service discovery. type KubernetesSDConfig struct { APIServers []URL `yaml:"api_servers"` - Role string `yaml:"role"` + Role KubernetesRole `yaml:"role"` InCluster bool `yaml:"in_cluster,omitempty"` BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"` BearerToken string `yaml:"bearer_token,omitempty"` @@ -813,7 +813,7 @@ func (c *KubernetesRole) UnmarshalYAML(unmarshal func(interface{}) error) error case KubernetesRoleNode, KubernetesRolePod, KubernetesRoleContainer, KubernetesRoleService, KubernetesRoleEndpoint, KubernetesRoleAPIServer: return nil default: - return fmt.Errorf("Unknown Kubernetes SD role %q", c) + return fmt.Errorf("Unknown Kubernetes SD role %q", *c) } } diff --git a/config/config_test.go b/config/config_test.go index ca9ab86a7..23d5d822e 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -385,6 +385,9 @@ var expectedErrors = []struct { }, { filename: "kubernetes_bearertoken.bad.yml", errMsg: "at most one of bearer_token & bearer_token_file must be configured", + }, { + filename: "kubernetes_role.bad.yml", + errMsg: "role", }, { filename: "kubernetes_bearertoken_basicauth.bad.yml", errMsg: "at most one of basic_auth, bearer_token & bearer_token_file must be configured", diff --git a/config/testdata/kubernetes_role.bad.yml b/config/testdata/kubernetes_role.bad.yml new file mode 100644 index 000000000..ae924d8f4 --- /dev/null +++ b/config/testdata/kubernetes_role.bad.yml @@ -0,0 +1,5 @@ +scrape_configs: +- kubernetes_sd_configs: + - api_server: kubernetes:443 + role: vacation + From e8679441725c83f5284e0d763b7b13fc14410014 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Mon, 18 Jul 2016 22:38:51 +0900 Subject: [PATCH 2/2] *: cut 1.0.0 --- CHANGELOG.md | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b933c37..9da95a28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.0.0-rc.0 / 2016-07-14 +## 1.0.0 / 2016-07-18 * [CHANGE] Remove deprecated query language keywords * [CHANGE] Change Kubernetes SD to require specifying Kubernetes role diff --git a/VERSION b/VERSION index 49cd32599..3eefcb9dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0-rc.0 +1.0.0