Skip to content

Instantly share code, notes, and snippets.

@ncdc
Last active December 19, 2019 16:03
Show Gist options
  • Save ncdc/3b9a3050dbc389d998cb17ec72dc204a to your computer and use it in GitHub Desktop.
Save ncdc/3b9a3050dbc389d998cb17ec72dc204a to your computer and use it in GitHub Desktop.
diff --git a/config/crd/patches/cainjection_in_clusters.yaml b/config/crd/patches/cainjection_in_clusters.yaml
index 81bb1e1bf..98bc35743 100644
--- a/config/crd/patches/cainjection_in_clusters.yaml
+++ b/config/crd/patches/cainjection_in_clusters.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/cainjection_in_kubeadmconfigs.yaml b/config/crd/patches/cainjection_in_kubeadmconfigs.yaml
index 4586b59f4..0e7d35ae8 100644
--- a/config/crd/patches/cainjection_in_kubeadmconfigs.yaml
+++ b/config/crd/patches/cainjection_in_kubeadmconfigs.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml b/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml
index ac54f554f..fe6b5adf6 100644
--- a/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml
+++ b/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/cainjection_in_machinedeployments.yaml b/config/crd/patches/cainjection_in_machinedeployments.yaml
index befb940f3..d8f3ebec8 100644
--- a/config/crd/patches/cainjection_in_machinedeployments.yaml
+++ b/config/crd/patches/cainjection_in_machinedeployments.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/cainjection_in_machines.yaml b/config/crd/patches/cainjection_in_machines.yaml
index 53d73e08a..d9ecf5042 100644
--- a/config/crd/patches/cainjection_in_machines.yaml
+++ b/config/crd/patches/cainjection_in_machines.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/cainjection_in_machinesets.yaml b/config/crd/patches/cainjection_in_machinesets.yaml
index db0ab2925..b9ed1d890 100644
--- a/config/crd/patches/cainjection_in_machinesets.yaml
+++ b/config/crd/patches/cainjection_in_machinesets.yaml
@@ -1,6 +1,6 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
diff --git a/config/crd/patches/webhook_in_clusters.yaml b/config/crd/patches/webhook_in_clusters.yaml
index 6af79a20e..c9a219007 100644
--- a/config/crd/patches/webhook_in_clusters.yaml
+++ b/config/crd/patches/webhook_in_clusters.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusters.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/config/crd/patches/webhook_in_kubeadmconfigs.yaml b/config/crd/patches/webhook_in_kubeadmconfigs.yaml
index 473c63500..408c4d10d 100644
--- a/config/crd/patches/webhook_in_kubeadmconfigs.yaml
+++ b/config/crd/patches/webhook_in_kubeadmconfigs.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kubeadmconfigs.bootstrap.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml b/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml
index 20c651947..aa107deb1 100644
--- a/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml
+++ b/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/config/crd/patches/webhook_in_machinedeployments.yaml b/config/crd/patches/webhook_in_machinedeployments.yaml
index 1b4743986..5bab0361f 100644
--- a/config/crd/patches/webhook_in_machinedeployments.yaml
+++ b/config/crd/patches/webhook_in_machinedeployments.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machinedeployments.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/config/crd/patches/webhook_in_machines.yaml b/config/crd/patches/webhook_in_machines.yaml
index 66dd96bd7..4df312021 100644
--- a/config/crd/patches/webhook_in_machines.yaml
+++ b/config/crd/patches/webhook_in_machines.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machines.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/config/crd/patches/webhook_in_machinesets.yaml b/config/crd/patches/webhook_in_machinesets.yaml
index 9748ec4dc..81ad16c9d 100644
--- a/config/crd/patches/webhook_in_machinesets.yaml
+++ b/config/crd/patches/webhook_in_machinesets.yaml
@@ -1,17 +1,19 @@
# The following patch enables conversion webhook for CRD
# CRD conversion requires k8s 1.13 or later.
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machinesets.cluster.x-k8s.io
spec:
conversion:
strategy: Webhook
- webhookClientConfig:
- # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
- # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
- caBundle: Cg==
- service:
- namespace: system
- name: webhook-service
- path: /convert
+ webhook:
+ conversionReviewVersions: ["v1","v1beta1"]
+ clientConfig:
+ # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank,
+ # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager)
+ caBundle: Cg==
+ service:
+ namespace: system
+ name: webhook-service
+ path: /convert
diff --git a/controllers/external/testing.go b/controllers/external/testing.go
index 049cc75ad..1aba9aec1 100644
--- a/controllers/external/testing.go
+++ b/controllers/external/testing.go
@@ -17,7 +17,7 @@ limitations under the License.
package external
import (
- apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
+ apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -33,15 +33,15 @@ var (
Kind: "InfrastructureMachine",
Plural: "genericmachines",
},
- Subresources: &apiextensionsv1beta1.CustomResourceSubresources{
- Status: &apiextensionsv1beta1.CustomResourceSubresourceStatus{},
- },
- Validation: &apiextensionsv1beta1.CustomResourceValidation{},
Versions: []apiextensionsv1beta1.CustomResourceDefinitionVersion{
{
Name: "v1alpha3",
Served: true,
Storage: true,
+ Subresources: &apiextensionsv1beta1.CustomResourceSubresources{
+ Status: &apiextensionsv1beta1.CustomResourceSubresourceStatus{},
+ },
+ Schema: &apiextensionsv1beta1.CustomResourceValidation{},
},
},
},
@@ -58,15 +58,15 @@ var (
Kind: "InfrastructureMachineTemplate",
Plural: "genericmachinetemplates",
},
- Subresources: &apiextensionsv1beta1.CustomResourceSubresources{
- Status: &apiextensionsv1beta1.CustomResourceSubresourceStatus{},
- },
- Validation: &apiextensionsv1beta1.CustomResourceValidation{},
Versions: []apiextensionsv1beta1.CustomResourceDefinitionVersion{
{
Name: "v1alpha3",
Served: true,
Storage: true,
+ Subresources: &apiextensionsv1beta1.CustomResourceSubresources{
+ Status: &apiextensionsv1beta1.CustomResourceSubresourceStatus{},
+ },
+ Schema: &apiextensionsv1beta1.CustomResourceValidation{},
},
},
},
diff --git a/controllers/suite_test.go b/controllers/suite_test.go
index 3c82ab5c7..8125b1833 100644
--- a/controllers/suite_test.go
+++ b/controllers/suite_test.go
@@ -24,7 +24,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
+ apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/klog"
diff --git a/go.mod b/go.mod
index bbfca9f83..6567b1284 100644
--- a/go.mod
+++ b/go.mod
@@ -37,3 +37,5 @@ require (
sigs.k8s.io/controller-runtime v0.4.0
sigs.k8s.io/yaml v1.1.0
)
+
+replace sigs.k8s.io/controller-runtime => ../../controller-runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment