Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tls] fix neutron, octavia and ovn default cert duration, renwebefore #776

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/openstack/neutron.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro
certRequest := certmanager.CertificateRequest{
IssuerName: instance.GetOvnIssuer(),
CertName: fmt.Sprintf("%s-ovndbs", serviceName),
Duration: nil,
Hostnames: []string{
fmt.Sprintf("%s.%s.svc", serviceName, instance.Namespace),
fmt.Sprintf("%s.%s.svc.%s", serviceName, instance.Namespace, "cluster.local"),
Expand All @@ -79,6 +78,12 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro
certmgrv1.UsageClientAuth,
},
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.Duration != nil {
certRequest.Duration = &instance.Spec.TLS.PodLevel.Ovn.Cert.Duration.Duration
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore != nil {
certRequest.RenewBefore = &instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore.Duration
}
certSecret, ctrlResult, err := certmanager.EnsureCert(
ctx,
helper,
Expand Down
7 changes: 6 additions & 1 deletion pkg/openstack/octavia.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func ReconcileOctavia(ctx context.Context, instance *corev1beta1.OpenStackContro
certRequest := certmanager.CertificateRequest{
IssuerName: instance.GetOvnIssuer(),
CertName: fmt.Sprintf("%s-ovndbs", serviceName),
Duration: nil,
Hostnames: []string{
fmt.Sprintf("%s.%s.svc", serviceName, instance.Namespace),
fmt.Sprintf("%s.%s.svc.%s", serviceName, instance.Namespace, ClusterInternalDomain),
Expand All @@ -87,6 +86,12 @@ func ReconcileOctavia(ctx context.Context, instance *corev1beta1.OpenStackContro
certmgrv1.UsageClientAuth,
},
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.Duration != nil {
certRequest.Duration = &instance.Spec.TLS.PodLevel.Ovn.Cert.Duration.Duration
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore != nil {
certRequest.RenewBefore = &instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore.Duration
}
certSecret, ctrlResult, err := certmanager.EnsureCert(
ctx,
helper,
Expand Down
21 changes: 18 additions & 3 deletions pkg/openstack/ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func ReconcileOVNDbClusters(ctx context.Context, instance *corev1beta1.OpenStack
certRequest := certmanager.CertificateRequest{
IssuerName: instance.GetOvnIssuer(),
CertName: fmt.Sprintf("%s-ovndbs", name),
Duration: nil,
// Cert needs to be valid for the individual pods in the statefulset so make this a wildcard cert
Hostnames: []string{
fmt.Sprintf("*.%s.svc", instance.Namespace),
Expand All @@ -115,6 +114,12 @@ func ReconcileOVNDbClusters(ctx context.Context, instance *corev1beta1.OpenStack
certmgrv1.UsageClientAuth,
},
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.Duration != nil {
certRequest.Duration = &instance.Spec.TLS.PodLevel.Ovn.Cert.Duration.Duration
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore != nil {
certRequest.RenewBefore = &instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore.Duration
}
certSecret, ctrlResult, err := certmanager.EnsureCert(
ctx,
helper,
Expand Down Expand Up @@ -210,7 +215,6 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont
certRequest := certmanager.CertificateRequest{
IssuerName: instance.GetOvnIssuer(),
CertName: fmt.Sprintf("%s-ovndbs", "ovnnorthd"),
Duration: nil,
Hostnames: []string{
fmt.Sprintf("%s.%s.svc", serviceName, instance.Namespace),
fmt.Sprintf("%s.%s.svc.%s", serviceName, instance.Namespace, ovnv1.DNSSuffix),
Expand All @@ -223,6 +227,12 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont
certmgrv1.UsageClientAuth,
},
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.Duration != nil {
certRequest.Duration = &instance.Spec.TLS.PodLevel.Ovn.Cert.Duration.Duration
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore != nil {
certRequest.RenewBefore = &instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore.Duration
}
certSecret, ctrlResult, err := certmanager.EnsureCert(
ctx,
helper,
Expand Down Expand Up @@ -312,7 +322,6 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack
certRequest := certmanager.CertificateRequest{
IssuerName: instance.GetOvnIssuer(),
CertName: fmt.Sprintf("%s-ovndbs", "ovncontroller"),
Duration: nil,
Hostnames: []string{
fmt.Sprintf("%s.%s.svc", serviceName, instance.Namespace),
fmt.Sprintf("%s.%s.svc.%s", serviceName, instance.Namespace, ovnv1.DNSSuffix),
Expand All @@ -325,6 +334,12 @@ func ReconcileOVNController(ctx context.Context, instance *corev1beta1.OpenStack
certmgrv1.UsageClientAuth,
},
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.Duration != nil {
certRequest.Duration = &instance.Spec.TLS.PodLevel.Ovn.Cert.Duration.Duration
}
if instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore != nil {
certRequest.RenewBefore = &instance.Spec.TLS.PodLevel.Ovn.Cert.RenewBefore.Duration
}
certSecret, ctrlResult, err := certmanager.EnsureCert(
ctx,
helper,
Expand Down
Loading