-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.go
44 lines (37 loc) · 1.21 KB
/
keystone.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
38
39
40
41
42
43
44
package nova
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
openstackv1beta1 "github.com/ianunruh/openstack-operator/api/v1beta1"
"github.com/ianunruh/openstack-operator/pkg/template"
)
func KeystoneService(instance *openstackv1beta1.Nova) *openstackv1beta1.KeystoneService {
labels := template.AppLabels(instance.Name, AppLabel)
return &openstackv1beta1.KeystoneService{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name,
Namespace: instance.Namespace,
Labels: labels,
},
Spec: openstackv1beta1.KeystoneServiceSpec{
Name: "nova",
Type: "compute",
InternalURL: fmt.Sprintf("http://%s-api.%s.svc:8774/v2.1", instance.Name, instance.Namespace),
PublicURL: fmt.Sprintf("https://%s/v2.1", instance.Spec.API.Ingress.Host),
},
}
}
func KeystoneUser(instance *openstackv1beta1.Nova) *openstackv1beta1.KeystoneUser {
labels := template.AppLabels(instance.Name, AppLabel)
return &openstackv1beta1.KeystoneUser{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name,
Namespace: instance.Namespace,
Labels: labels,
},
Spec: openstackv1beta1.KeystoneUserSpec{
Secret: template.Combine(instance.Name, "keystone"),
Project: "service",
},
}
}