-
Notifications
You must be signed in to change notification settings - Fork 12
/
certificate_server.go
37 lines (33 loc) · 1.14 KB
/
certificate_server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package generators
import (
"fmt"
operatorv1alpha1 "github.com/3scale-ops/marin3r/apis/operator.marin3r/v1alpha1"
"github.com/3scale-ops/marin3r/pkg/util/pointer"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (cfg *GeneratorOptions) ServerCertificate() *operatorv1alpha1.DiscoveryServiceCertificate {
return &operatorv1alpha1.DiscoveryServiceCertificate{
ObjectMeta: metav1.ObjectMeta{
Name: cfg.ServerCertName(),
Namespace: cfg.Namespace,
Labels: cfg.labels(),
},
Spec: operatorv1alpha1.DiscoveryServiceCertificateSpec{
CommonName: fmt.Sprintf("%s-%s", cfg.ServerCertificateCommonNamePrefix, cfg.InstanceName),
IsServerCertificate: pointer.New(true),
ValidFor: int64(cfg.ServerCertificateDuration.Seconds()),
Signer: operatorv1alpha1.DiscoveryServiceCertificateSigner{
CASigned: &operatorv1alpha1.CASignedConfig{
SecretRef: corev1.SecretReference{
Name: cfg.RootCertName(),
Namespace: cfg.Namespace,
}},
},
SecretRef: corev1.SecretReference{
Name: cfg.ServerCertName(),
Namespace: cfg.Namespace,
},
},
}
}