-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.go
77 lines (67 loc) · 2.17 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package heat
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 KeystoneServices(instance *openstackv1beta1.Heat) []*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: "heat",
Type: "orchestration",
InternalURL: fmt.Sprintf("http://%s-api.%s.svc:8004/v1/$(project_id)s", instance.Name, instance.Namespace),
PublicURL: fmt.Sprintf("https://%s/v1/$(project_id)s", instance.Spec.API.Ingress.Host),
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: template.Combine(instance.Name, "cfn"),
Namespace: instance.Namespace,
Labels: labels,
},
Spec: openstackv1beta1.KeystoneServiceSpec{
Name: "heat-cfn",
Type: "cloudformation",
InternalURL: fmt.Sprintf("http://%s-cfn.%s.svc:8000/v1", instance.Name, instance.Namespace),
PublicURL: fmt.Sprintf("https://%s/v1", instance.Spec.CFN.Ingress.Host),
},
},
}
}
func KeystoneUser(instance *openstackv1beta1.Heat) *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",
},
}
}
func KeystoneStackUser(instance *openstackv1beta1.Heat) *openstackv1beta1.KeystoneUser {
labels := template.AppLabels(instance.Name, AppLabel)
name := template.Combine(instance.Name, "stack")
return &openstackv1beta1.KeystoneUser{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: instance.Namespace,
Labels: labels,
},
Spec: openstackv1beta1.KeystoneUserSpec{
Secret: template.Combine(name, "keystone"),
Domain: "heat",
},
}
}