Skip to content

Commit fc17c9f

Browse files
Update certmanager 0.11 group and version change
Matrix CI build to test multiple K8s versions
1 parent c9f4434 commit fc17c9f

23 files changed

+88
-44
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,23 @@ os:
1212
go:
1313
- "1.12"
1414

15+
# A build matix defines the K8s versions to use for e2e tests. Travis runs these in parrellel
1516
env:
17+
- KIND_K8S_VERSION="v1.16.2" GOPROXY=https://proxy.golang.org/
18+
- KIND_K8S_VERSION="v1.15.3" GOPROXY=https://proxy.golang.org/
19+
- KIND_K8S_VERSION="v1.14.1" GOPROXY=https://proxy.golang.org/
1620
- GOPROXY=https://proxy.golang.org/
21+
# As OSX isn't running KIND e2e tests exlude it from the matrix
22+
matrix:
23+
exclude:
24+
- os: osx
25+
env: KIND_K8S_VERSION="v1.16.2" GOPROXY=https://proxy.golang.org/
26+
- os: osx
27+
env: KIND_K8S_VERSION="v1.15.3" GOPROXY=https://proxy.golang.org/
28+
- os: osx
29+
env: KIND_K8S_VERSION="v1.14.1" GOPROXY=https://proxy.golang.org/
30+
- os: linux
31+
env: GOPROXY=https://proxy.golang.org/
1732

1833
git:
1934
depth: 3
@@ -26,7 +41,7 @@ services:
2641
before_install:
2742
# NOTE: The latest version of dep requires go 1.13
2843
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p /Users/travis/gopath/bin; fi
29-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GO111MODULE=on scripts/install_and_setup.sh; fi
44+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GO111MODULE=on scripts/install_and_setup.sh $KIND_K8S_VERSION; fi
3045
- GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/[email protected]
3146
- GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/[email protected]
3247

pkg/scaffold/v2/certmanager/certificate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,24 @@ func (p *CertManager) GetInput() (input.Input, error) {
3838

3939
var certManagerTemplate = `# The following manifests contain a self-signed issuer CR and a certificate CR.
4040
# More document can be found at https://docs.cert-manager.io
41-
apiVersion: certmanager.k8s.io/v1alpha1
41+
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for breaking changes
42+
apiVersion: cert-manager.io/v1alpha2
4243
kind: Issuer
4344
metadata:
4445
name: selfsigned-issuer
4546
namespace: system
4647
spec:
4748
selfSigned: {}
4849
---
49-
apiVersion: certmanager.k8s.io/v1alpha1
50+
apiVersion: cert-manager.io/v1alpha2
5051
kind: Certificate
5152
metadata:
5253
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
5354
namespace: system
5455
spec:
5556
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
56-
commonName: $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
5757
dnsNames:
58+
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
5859
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
5960
issuerRef:
6061
kind: Issuer

pkg/scaffold/v2/certmanager/kustomizeconfig.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ func (p *KustomizeConfig) GetInput() (input.Input, error) {
3939
var kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
4040
nameReference:
4141
- kind: Issuer
42-
group: certmanager.k8s.io
42+
group: cert-manager.io
4343
fieldSpecs:
4444
- kind: Certificate
45-
group: certmanager.k8s.io
45+
group: cert-manager.io
4646
path: spec/issuerRef/name
4747
4848
varReference:
4949
- kind: Certificate
50-
group: certmanager.k8s.io
50+
group: cert-manager.io
5151
path: spec/commonName
5252
- kind: Certificate
53-
group: certmanager.k8s.io
53+
group: cert-manager.io
5454
path: spec/dnsNames
5555
`

pkg/scaffold/v2/crd/enablecainjection_patch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ apiVersion: apiextensions.k8s.io/v1beta1
5757
kind: CustomResourceDefinition
5858
metadata:
5959
annotations:
60-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
60+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
6161
name: {{ .Resource.Resource }}.{{ .Resource.Group }}.{{ .Domain }}
6262
`

pkg/scaffold/v2/kustomize.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ vars:
102102
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
103103
# objref:
104104
# kind: Certificate
105-
# group: certmanager.k8s.io
106-
# version: v1alpha1
105+
# group: cert-manager.io
106+
# version: v1alpha2
107107
# name: serving-cert # this name should match the one in certificate.yaml
108108
# fieldref:
109109
# fieldpath: metadata.namespace
110110
#- name: CERTIFICATE_NAME
111111
# objref:
112112
# kind: Certificate
113-
# group: certmanager.k8s.io
114-
# version: v1alpha1
113+
# group: cert-manager.io
114+
# version: v1alpha2
115115
# name: serving-cert # this name should match the one in certificate.yaml
116116
#- name: SERVICE_NAMESPACE # namespace of the service
117117
# objref:

pkg/scaffold/v2/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ import (
6666
type {{.Resource.Kind}}Spec struct {
6767
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
6868
// Important: Run "make" to regenerate code after modifying this file
69+
70+
// Foo is an example field of {{.Resource.Kind}}. Edit {{.Resource.Kind}}_types.go to remove/update
71+
Foo string ` + "`" + `json:"foo,omitempty"` + "`" + `
6972
}
7073
7174
// {{.Resource.Kind}}Status defines the observed state of {{.Resource.Kind}}

pkg/scaffold/v2/webhook/enablecainection_patch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ kind: MutatingWebhookConfiguration
4646
metadata:
4747
name: mutating-webhook-configuration
4848
annotations:
49-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
49+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
5050
---
5151
apiVersion: admissionregistration.k8s.io/v1beta1
5252
kind: ValidatingWebhookConfiguration
5353
metadata:
5454
name: validating-webhook-configuration
5555
annotations:
56-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
56+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
5757
`

scripts/install_and_setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
K8S_VERSION=$1
18+
1719
export GO111MODULE=on
1820

1921
go get sigs.k8s.io/[email protected]
2022

2123
# You can use --image flag to specify the cluster version you want, e.g --image=kindest/node:v1.13.6, the supported version are listed at https://hub.docker.com/r/kindest/node/tags
22-
kind create cluster --config test/kind-config.yaml --image=kindest/node:v1.14.1
24+
kind create cluster --config test/kind-config.yaml --image=kindest/node:$K8S_VERSION

test/e2e/utils/test_context.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626
. "github.com/onsi/ginkgo"
2727
)
2828

29-
const certmanagerVersion = "v0.10.1"
30-
const prometheusOperatorVersion= "0.33"
29+
const certmanagerVersion = "v0.11.0"
30+
const prometheusOperatorVersion = "0.33"
3131

3232
// KBTestContext specified to run e2e tests
3333
type KBTestContext struct {
@@ -88,10 +88,7 @@ func (kc *KBTestContext) InstallCertManager() error {
8888
if _, err := kc.Kubectl.Command("create", "namespace", "cert-manager"); err != nil {
8989
return err
9090
}
91-
if _, err := kc.Kubectl.Command("label", "namespace", "cert-manager", "certmanager.k8s.io/disable-validation=true"); err != nil {
92-
return err
93-
}
94-
_, err := kc.Kubectl.Apply(false, "-f", fmt.Sprintf("https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml", certmanagerVersion))
91+
_, err := kc.Kubectl.Apply(false, "-f", fmt.Sprintf("https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml", certmanagerVersion), "--validate=false")
9592
return err
9693
}
9794

test/e2e/v2/e2e_suite.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import (
2020
"fmt"
2121
"io/ioutil"
2222
"path/filepath"
23-
"sigs.k8s.io/kubebuilder/test/e2e/utils"
2423
"strconv"
2524
"strings"
2625
"time"
2726

27+
"sigs.k8s.io/kubebuilder/test/e2e/utils"
28+
2829
. "github.com/onsi/ginkgo"
2930
. "github.com/onsi/gomega"
3031
)
@@ -123,16 +124,16 @@ var _ = Describe("kubebuilder", func() {
123124
`#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
124125
# objref:
125126
# kind: Certificate
126-
# group: certmanager.k8s.io
127-
# version: v1alpha1
127+
# group: cert-manager.io
128+
# version: v1alpha2
128129
# name: serving-cert # this name should match the one in certificate.yaml
129130
# fieldref:
130131
# fieldpath: metadata.namespace
131132
#- name: CERTIFICATE_NAME
132133
# objref:
133134
# kind: Certificate
134-
# group: certmanager.k8s.io
135-
# version: v1alpha1
135+
# group: cert-manager.io
136+
# version: v1alpha2
136137
# name: serving-cert # this name should match the one in certificate.yaml
137138
#- name: SERVICE_NAMESPACE # namespace of the service
138139
# objref:
@@ -211,7 +212,7 @@ var _ = Describe("kubebuilder", func() {
211212
true,
212213
"ServiceMonitor")
213214
Expect(err).NotTo(HaveOccurred())
214-
215+
215216
By("validate the mutating|validating webhooks have the CA injected")
216217
verifyCAInjection := func() error {
217218
mwhOutput, err := kbc.Kubectl.Get(

testdata/project-v2/api/v1/admiral_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
type AdmiralSpec struct {
2828
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2929
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of Admiral. Edit Admiral_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
3033
}
3134

3235
// AdmiralStatus defines the observed state of Admiral

testdata/project-v2/api/v1/captain_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
type CaptainSpec struct {
2828
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2929
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of Captain. Edit Captain_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
3033
}
3134

3235
// CaptainStatus defines the observed state of Captain

testdata/project-v2/api/v1/firstmate_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import (
2727
type FirstMateSpec struct {
2828
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2929
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of FirstMate. Edit FirstMate_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
3033
}
3134

3235
// FirstMateStatus defines the observed state of FirstMate

testdata/project-v2/config/certmanager/certificate.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# The following manifests contain a self-signed issuer CR and a certificate CR.
22
# More document can be found at https://docs.cert-manager.io
3-
apiVersion: certmanager.k8s.io/v1alpha1
3+
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for breaking changes
4+
apiVersion: cert-manager.io/v1alpha2
45
kind: Issuer
56
metadata:
67
name: selfsigned-issuer
78
namespace: system
89
spec:
910
selfSigned: {}
1011
---
11-
apiVersion: certmanager.k8s.io/v1alpha1
12+
apiVersion: cert-manager.io/v1alpha2
1213
kind: Certificate
1314
metadata:
1415
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
1516
namespace: system
1617
spec:
1718
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
18-
commonName: $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
1919
dnsNames:
20+
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc
2021
- $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local
2122
issuerRef:
2223
kind: Issuer
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# This configuration is for teaching kustomize how to update name ref and var substitution
22
nameReference:
33
- kind: Issuer
4-
group: certmanager.k8s.io
4+
group: cert-manager.io
55
fieldSpecs:
66
- kind: Certificate
7-
group: certmanager.k8s.io
7+
group: cert-manager.io
88
path: spec/issuerRef/name
99

1010
varReference:
1111
- kind: Certificate
12-
group: certmanager.k8s.io
12+
group: cert-manager.io
1313
path: spec/commonName
1414
- kind: Certificate
15-
group: certmanager.k8s.io
15+
group: cert-manager.io
1616
path: spec/dnsNames

testdata/project-v2/config/crd/bases/crew.testproject.org_admirals.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ spec:
3333
type: object
3434
spec:
3535
description: AdmiralSpec defines the desired state of Admiral
36+
properties:
37+
foo:
38+
description: Foo is an example field of Admiral. Edit Admiral_types.go
39+
to remove/update
40+
type: string
3641
type: object
3742
status:
3843
description: AdmiralStatus defines the observed state of Admiral

testdata/project-v2/config/crd/bases/crew.testproject.org_captains.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ spec:
3333
type: object
3434
spec:
3535
description: CaptainSpec defines the desired state of Captain
36+
properties:
37+
foo:
38+
description: Foo is an example field of Captain. Edit Captain_types.go
39+
to remove/update
40+
type: string
3641
type: object
3742
status:
3843
description: CaptainStatus defines the observed state of Captain

testdata/project-v2/config/crd/bases/crew.testproject.org_firstmates.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ spec:
3333
type: object
3434
spec:
3535
description: FirstMateSpec defines the desired state of FirstMate
36+
properties:
37+
foo:
38+
description: Foo is an example field of FirstMate. Edit FirstMate_types.go
39+
to remove/update
40+
type: string
3641
type: object
3742
status:
3843
description: FirstMateStatus defines the observed state of FirstMate

testdata/project-v2/config/crd/patches/cainjection_in_admirals.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
88
name: admirals.crew.testproject.org

testdata/project-v2/config/crd/patches/cainjection_in_captains.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
88
name: captains.crew.testproject.org

testdata/project-v2/config/crd/patches/cainjection_in_firstmates.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
88
name: firstmates.crew.testproject.org

testdata/project-v2/config/default/kustomization.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ vars:
4949
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
5050
# objref:
5151
# kind: Certificate
52-
# group: certmanager.k8s.io
53-
# version: v1alpha1
52+
# group: cert-manager.io
53+
# version: v1alpha2
5454
# name: serving-cert # this name should match the one in certificate.yaml
5555
# fieldref:
5656
# fieldpath: metadata.namespace
5757
#- name: CERTIFICATE_NAME
5858
# objref:
5959
# kind: Certificate
60-
# group: certmanager.k8s.io
61-
# version: v1alpha1
60+
# group: cert-manager.io
61+
# version: v1alpha2
6262
# name: serving-cert # this name should match the one in certificate.yaml
6363
#- name: SERVICE_NAMESPACE # namespace of the service
6464
# objref:

testdata/project-v2/config/default/webhookcainjection_patch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ kind: MutatingWebhookConfiguration
55
metadata:
66
name: mutating-webhook-configuration
77
annotations:
8-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
8+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
99
---
1010
apiVersion: admissionregistration.k8s.io/v1beta1
1111
kind: ValidatingWebhookConfiguration
1212
metadata:
1313
name: validating-webhook-configuration
1414
annotations:
15-
certmanager.k8s.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
15+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)

0 commit comments

Comments
 (0)