From 20960d96de84a3aab72b3abf29748c3a5a6b6939 Mon Sep 17 00:00:00 2001
From: Mariano Cano <mariano@smallstep.com>
Date: Mon, 24 Feb 2020 15:45:48 -0800
Subject: [PATCH] Replace certmanager.k8s.io/v1alpha1 to
 cert-manager.io/v1alpha2

---
 config/certmanager/certificate.yaml           |  4 +--
 config/certmanager/kustomizeconfig.yaml       |  8 +++---
 .../certmanager.step.sm_stepissuers.yaml      | 26 ++++++++++++++-----
 .../patches/cainjection_in_stepissuers.yaml   |  2 +-
 config/default/kustomization.yaml             |  8 +++---
 config/default/manager_image_patch.yaml       |  2 +-
 config/default/webhookcainjection_patch.yaml  |  4 +--
 config/rbac/role.yaml                         |  4 +--
 config/samples/certificate.yaml               |  2 +-
 config/samples/certificaterequest.yaml        |  2 +-
 config/samples/deployment.yaml                |  4 +--
 11 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/config/certmanager/certificate.yaml b/config/certmanager/certificate.yaml
index 02bdc1b..82dfb53 100644
--- a/config/certmanager/certificate.yaml
+++ b/config/certmanager/certificate.yaml
@@ -1,6 +1,6 @@
 # The following manifests contain a self-signed issuer CR and a certificate CR.
 # More document can be found at https://docs.cert-manager.io
-apiVersion: certmanager.k8s.io/v1alpha1
+apiVersion: cert-manager.io/v1alpha2
 kind: Issuer
 metadata:
   name: selfsigned-issuer
@@ -8,7 +8,7 @@ metadata:
 spec:
   selfSigned: {}
 ---
-apiVersion: certmanager.k8s.io/v1alpha1
+apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: serving-cert  # this name should match the one appeared in kustomizeconfig.yaml
diff --git a/config/certmanager/kustomizeconfig.yaml b/config/certmanager/kustomizeconfig.yaml
index 49e0b1e..90d7c31 100644
--- a/config/certmanager/kustomizeconfig.yaml
+++ b/config/certmanager/kustomizeconfig.yaml
@@ -1,16 +1,16 @@
 # This configuration is for teaching kustomize how to update name ref and var substitution 
 nameReference:
 - kind: Issuer
-  group: certmanager.k8s.io
+  group: cert-manager.io
   fieldSpecs:
   - kind: Certificate
-    group: certmanager.k8s.io
+    group: cert-manager.io
     path: spec/issuerRef/name
 
 varReference:
 - kind: Certificate
-  group: certmanager.k8s.io
+  group: cert-manager.io
   path: spec/commonName
 - kind: Certificate
-  group: certmanager.k8s.io
+  group: cert-manager.io
   path: spec/dnsNames
diff --git a/config/crd/bases/certmanager.step.sm_stepissuers.yaml b/config/crd/bases/certmanager.step.sm_stepissuers.yaml
index 5afc93b..c4381e2 100644
--- a/config/crd/bases/certmanager.step.sm_stepissuers.yaml
+++ b/config/crd/bases/certmanager.step.sm_stepissuers.yaml
@@ -3,14 +3,20 @@
 apiVersion: apiextensions.k8s.io/v1beta1
 kind: CustomResourceDefinition
 metadata:
+  annotations:
+    controller-gen.kubebuilder.io/version: v0.2.5
   creationTimestamp: null
   name: stepissuers.certmanager.step.sm
 spec:
   group: certmanager.step.sm
   names:
     kind: StepIssuer
+    listKind: StepIssuerList
     plural: stepissuers
-  scope: ""
+    singular: stepissuer
+  scope: Namespaced
+  subresources:
+    status: {}
   validation:
     openAPIV3Schema:
       description: StepIssuer is the Schema for the stepissuers API
@@ -18,12 +24,12 @@ spec:
         apiVersion:
           description: 'APIVersion defines the versioned schema of this representation
             of an object. Servers should convert recognized schemas to the latest
-            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
           type: string
         kind:
           description: 'Kind is a string value representing the REST resource this
             object represents. Servers may infer this from the endpoint the client
-            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
           type: string
         metadata:
           type: object
@@ -95,12 +101,17 @@ spec:
                       the condition's last transition.
                     type: string
                   status:
+                    allOf:
+                    - enum:
+                      - "True"
+                      - "False"
+                      - Unknown
+                    - enum:
+                      - "True"
+                      - "False"
+                      - Unknown
                     description: Status of the condition, one of ('True', 'False',
                       'Unknown').
-                    enum:
-                    - "True"
-                    - "False"
-                    - Unknown
                     type: string
                   type:
                     description: Type of the condition, currently ('Ready').
@@ -114,6 +125,7 @@ spec:
               type: array
           type: object
       type: object
+  version: v1beta1
   versions:
   - name: v1beta1
     served: true
diff --git a/config/crd/patches/cainjection_in_stepissuers.yaml b/config/crd/patches/cainjection_in_stepissuers.yaml
index 9c89961..9e57437 100644
--- a/config/crd/patches/cainjection_in_stepissuers.yaml
+++ b/config/crd/patches/cainjection_in_stepissuers.yaml
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1beta1
 kind: CustomResourceDefinition
 metadata:
   annotations:
-    certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
+    cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
   name: stepissuers.certmanager.step.sm
diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml
index c7403c6..cb1819d 100644
--- a/config/default/kustomization.yaml
+++ b/config/default/kustomization.yaml
@@ -51,16 +51,16 @@ vars:
 #- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
 #  objref:
 #    kind: Certificate
-#    group: certmanager.k8s.io
-#    version: v1alpha1
+#    group: cert-manager.io
+#    version: v1alpha2
 #    name: serving-cert # this name should match the one in certificate.yaml
 #  fieldref:
 #    fieldpath: metadata.namespace
 #- name: CERTIFICATE_NAME
 #  objref:
 #    kind: Certificate
-#    group: certmanager.k8s.io
-#    version: v1alpha1
+#    group: cert-manager.io
+#    version: v1alpha2
 #    name: serving-cert # this name should match the one in certificate.yaml
 #- name: SERVICE_NAMESPACE # namespace of the service
 #  objref:
diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml
index 362e13b..4a371c5 100644
--- a/config/default/manager_image_patch.yaml
+++ b/config/default/manager_image_patch.yaml
@@ -8,5 +8,5 @@ spec:
     spec:
       containers:
       # Change the value of image field below to your controller image URL
-      - image: smallstep/step-issuer:0.1.0
+      - image: step-issuer:latest
         name: manager
diff --git a/config/default/webhookcainjection_patch.yaml b/config/default/webhookcainjection_patch.yaml
index 5e3e077..7e79bf9 100644
--- a/config/default/webhookcainjection_patch.yaml
+++ b/config/default/webhookcainjection_patch.yaml
@@ -5,11 +5,11 @@ kind: MutatingWebhookConfiguration
 metadata:
   name: mutating-webhook-configuration
   annotations:
-    certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
+    cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
 ---
 apiVersion: admissionregistration.k8s.io/v1beta1
 kind: ValidatingWebhookConfiguration
 metadata:
   name: validating-webhook-configuration
   annotations:
-    certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
+    cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml
index 67dd2d5..8fe1c63 100644
--- a/config/rbac/role.yaml
+++ b/config/rbac/role.yaml
@@ -15,7 +15,7 @@ rules:
   - list
   - watch
 - apiGroups:
-  - certmanager.k8s.io
+  - cert-manager.io
   resources:
   - certificaterequests
   verbs:
@@ -24,7 +24,7 @@ rules:
   - update
   - watch
 - apiGroups:
-  - certmanager.k8s.io
+  - cert-manager.io
   resources:
   - certificaterequests/status
   verbs:
diff --git a/config/samples/certificate.yaml b/config/samples/certificate.yaml
index 3540ed0..c1090e5 100644
--- a/config/samples/certificate.yaml
+++ b/config/samples/certificate.yaml
@@ -1,4 +1,4 @@
-apiVersion: certmanager.k8s.io/v1alpha1
+apiVersion: cert-manager.io/v1alpha2
 kind: Certificate
 metadata:
   name: backend-smallstep-com
diff --git a/config/samples/certificaterequest.yaml b/config/samples/certificaterequest.yaml
index 29eec1c..a938921 100644
--- a/config/samples/certificaterequest.yaml
+++ b/config/samples/certificaterequest.yaml
@@ -1,4 +1,4 @@
-apiVersion: certmanager.k8s.io/v1alpha1
+apiVersion: cert-manager.io/v1alpha2
 kind: CertificateRequest
 metadata:
   name: internal-smallstep-com
diff --git a/config/samples/deployment.yaml b/config/samples/deployment.yaml
index f9dcedc..542e60a 100644
--- a/config/samples/deployment.yaml
+++ b/config/samples/deployment.yaml
@@ -178,7 +178,7 @@ rules:
   - list
   - watch
 - apiGroups:
-  - certmanager.k8s.io
+  - cert-manager.io
   resources:
   - certificaterequests
   verbs:
@@ -187,7 +187,7 @@ rules:
   - update
   - watch
 - apiGroups:
-  - certmanager.k8s.io
+  - cert-manager.io
   resources:
   - certificaterequests/status
   verbs:
-- 
GitLab