Allow cert-manager to be provisioned externally

This commit is contained in:
Alexander Block 2021-04-29 10:45:44 +02:00 committed by Ciprian Hacman
parent 94555de66a
commit 76b9ffa64b
8 changed files with 43 additions and 2 deletions

View File

@ -69,7 +69,23 @@ spec:
defaultIssuer: yourDefaultIssuer defaultIssuer: yourDefaultIssuer
``` ```
**Warning: cert-manager only supports one installation per cluster. If you are already running cert-manager, you need to remove this installation prior to enabling this addon. As long as you are using v1 versions of the cert-manager resources, it is safe to remove existing installs and replace it with this addon** **Warning: cert-manager only supports one installation per cluster. If you are already running cert-manager, you need to
either remove this installation prior to enabling this addon, or mark cert-manger as not being managed by kOps (see below).
As long as you are using v1 versions of the cert-manager resources, it is safe to remove existing installs and replace it with this addon**
##### Self-provisioned cert-manager
{{ kops_feature_table(kops_added_default='1.21', k8s_min='1.16') }}
The following cert-manager configuration allows provisioning cert-manager externally and allows all dependent plugins
to be deployed. Please note that addons might run into errors until cert-manager is deployed.
```yaml
spec:
certManager:
enabled: true
managed: false
```
Read more about cert-manager in the [official documentation](https://cert-manager.io/docs/) Read more about cert-manager in the [official documentation](https://cert-manager.io/docs/)

View File

@ -248,6 +248,11 @@ spec:
description: 'Image is the docker container used. Default: the description: 'Image is the docker container used. Default: the
latest supported image for the specified kubernetes version.' latest supported image for the specified kubernetes version.'
type: string type: string
managed:
description: Managed controls if cert-manager is manged and deployed
by kOps. The deployment of cert-manager is skipped if this is
set to false.
type: boolean
type: object type: object
channel: channel:
description: The Channel we are following description: The Channel we are following

View File

@ -924,6 +924,10 @@ type CertManagerConfig struct {
// Default: false // Default: false
Enabled *bool `json:"enabled,omitempty"` Enabled *bool `json:"enabled,omitempty"`
// Managed controls if cert-manager is manged and deployed by kOps.
// The deployment of cert-manager is skipped if this is set to false.
Managed *bool `json:"managed,omitempty"`
// Image is the docker container used. // Image is the docker container used.
// Default: the latest supported image for the specified kubernetes version. // Default: the latest supported image for the specified kubernetes version.
Image *string `json:"image,omitempty"` Image *string `json:"image,omitempty"`

View File

@ -923,6 +923,10 @@ type CertManagerConfig struct {
// Default: false // Default: false
Enabled *bool `json:"enabled,omitempty"` Enabled *bool `json:"enabled,omitempty"`
// Managed controls if cert-manager is manged and deployed by kOps.
// The deployment of cert-manager is skipped if this is set to false.
Managed *bool `json:"managed,omitempty"`
// Image is the docker container used. // Image is the docker container used.
// Default: the latest supported image for the specified kubernetes version. // Default: the latest supported image for the specified kubernetes version.
Image *string `json:"image,omitempty"` Image *string `json:"image,omitempty"`

View File

@ -1628,6 +1628,7 @@ func Convert_kops_CanalNetworkingSpec_To_v1alpha2_CanalNetworkingSpec(in *kops.C
func autoConvert_v1alpha2_CertManagerConfig_To_kops_CertManagerConfig(in *CertManagerConfig, out *kops.CertManagerConfig, s conversion.Scope) error { func autoConvert_v1alpha2_CertManagerConfig_To_kops_CertManagerConfig(in *CertManagerConfig, out *kops.CertManagerConfig, s conversion.Scope) error {
out.Enabled = in.Enabled out.Enabled = in.Enabled
out.Managed = in.Managed
out.Image = in.Image out.Image = in.Image
out.DefaultIssuer = in.DefaultIssuer out.DefaultIssuer = in.DefaultIssuer
return nil return nil
@ -1640,6 +1641,7 @@ func Convert_v1alpha2_CertManagerConfig_To_kops_CertManagerConfig(in *CertManage
func autoConvert_kops_CertManagerConfig_To_v1alpha2_CertManagerConfig(in *kops.CertManagerConfig, out *CertManagerConfig, s conversion.Scope) error { func autoConvert_kops_CertManagerConfig_To_v1alpha2_CertManagerConfig(in *kops.CertManagerConfig, out *CertManagerConfig, s conversion.Scope) error {
out.Enabled = in.Enabled out.Enabled = in.Enabled
out.Managed = in.Managed
out.Image = in.Image out.Image = in.Image
out.DefaultIssuer = in.DefaultIssuer out.DefaultIssuer = in.DefaultIssuer
return nil return nil

View File

@ -420,6 +420,11 @@ func (in *CertManagerConfig) DeepCopyInto(out *CertManagerConfig) {
*out = new(bool) *out = new(bool)
**out = **in **out = **in
} }
if in.Managed != nil {
in, out := &in.Managed, &out.Managed
*out = new(bool)
**out = **in
}
if in.Image != nil { if in.Image != nil {
in, out := &in.Image, &out.Image in, out := &in.Image, &out.Image
*out = new(string) *out = new(string)

View File

@ -436,6 +436,11 @@ func (in *CertManagerConfig) DeepCopyInto(out *CertManagerConfig) {
*out = new(bool) *out = new(bool)
**out = **in **out = **in
} }
if in.Managed != nil {
in, out := &in.Managed, &out.Managed
*out = new(bool)
**out = **in
}
if in.Image != nil { if in.Image != nil {
in, out := &in.Image, &out.Image in, out := &in.Image, &out.Image
*out = new(string) *out = new(string)

View File

@ -516,7 +516,7 @@ func (b *BootstrapChannelBuilder) buildAddons(c *fi.ModelBuilderContext) (*chann
} }
} }
if b.Cluster.Spec.CertManager != nil && fi.BoolValue(b.Cluster.Spec.CertManager.Enabled) { if b.Cluster.Spec.CertManager != nil && fi.BoolValue(b.Cluster.Spec.CertManager.Enabled) && (b.Cluster.Spec.CertManager.Managed == nil || fi.BoolValue(b.Cluster.Spec.CertManager.Managed)) {
{ {
key := "certmanager.io" key := "certmanager.io"
version := "1.1.0" version := "1.1.0"