Skip to content

Commit

Permalink
fix(prometheus): fix k8s 1.16 cannot install prometheus
Browse files Browse the repository at this point in the history
Signed-off-by: Feng Kun <[email protected]>
  • Loading branch information
kevinfeng authored and tke-robot committed Aug 18, 2020
1 parent 50f61d2 commit cc357e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/monitor/controller/prometheus/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (c *Controller) installPrometheus(ctx context.Context, prometheus *v1.Prome

crds := getCRDs()
for _, crd := range crds {
if apiclient.ClusterVersionIsBefore117(kubeClient) {
if apiclient.ClusterVersionIsBefore116(kubeClient) {
crdObj := apiextensionsv1beta1.CustomResourceDefinition{}
err := json.Unmarshal([]byte(crd), &crdObj)
if err != nil {
Expand Down Expand Up @@ -2336,7 +2336,7 @@ func (c *Controller) uninstallPrometheus(ctx context.Context, prometheus *v1.Pro

crds := getCRDs()
for _, crd := range crds {
if apiclient.ClusterVersionIsBefore117(kubeClient) {
if apiclient.ClusterVersionIsBefore116(kubeClient) {
crdObj := apiextensionsv1beta1.CustomResourceDefinition{}
err := json.Unmarshal([]byte(crd), &crdObj)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/controller/addon/prometheus/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ func (c *Controller) installPrometheus(ctx context.Context, prometheus *v1.Prome

crds := getCRDs()
for _, crd := range crds {
if apiclient.ClusterVersionIsBefore117(kubeClient) {
if apiclient.ClusterVersionIsBefore116(kubeClient) {
crdObj := apiextensionsv1beta1.CustomResourceDefinition{}
err := json.Unmarshal([]byte(crd), &crdObj)
if err != nil {
Expand Down Expand Up @@ -2327,7 +2327,7 @@ func (c *Controller) uninstallPrometheus(ctx context.Context, prometheus *v1.Pro

crds := getCRDs()
for _, crd := range crds {
if apiclient.ClusterVersionIsBefore117(kubeClient) {
if apiclient.ClusterVersionIsBefore116(kubeClient) {
crdObj := apiextensionsv1beta1.CustomResourceDefinition{}
err := json.Unmarshal([]byte(crd), &crdObj)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/apiclient/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func ClusterVersionIsBefore19(client kubernetes.Interface) bool {
return result
}

func ClusterVersionIsBefore117(client kubernetes.Interface) bool {
result, err := CheckClusterVersion(client, "< 1.17")
func ClusterVersionIsBefore116(client kubernetes.Interface) bool {
result, err := CheckClusterVersion(client, "< 1.16")
if err != nil {
return false
}
Expand Down

0 comments on commit cc357e7

Please sign in to comment.