Skip to content

Commit 2c48935

Browse files
committed
create service,confimap and volumes for deployment
Signed-off-by: Troy Connor <[email protected]>
1 parent 9fb8eae commit 2c48935

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

controllers/types.go

+45-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
corev1 "k8s.io/api/core/v1"
1010
"k8s.io/apimachinery/pkg/api/resource"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12+
"k8s.io/apimachinery/pkg/util/intstr"
1213
"k8s.io/utils/ptr"
1314
)
1415

@@ -72,21 +73,63 @@ var GrpcDeployment = &appsv1.Deployment{
7273
},
7374
},
7475
},
76+
Volumes: []corev1.Volume{
77+
{
78+
Name: "porter-grpc-service-config-volume",
79+
VolumeSource: corev1.VolumeSource{
80+
ConfigMap: &corev1.ConfigMapVolumeSource{
81+
Items: []corev1.KeyToPath{
82+
{
83+
Key: "config",
84+
Path: "config.yaml",
85+
},
86+
},
87+
},
88+
},
89+
},
90+
},
7591
},
7692
},
7793
},
7894
}
7995

8096
var GrpcService = &corev1.Service{
8197
ObjectMeta: metav1.ObjectMeta{
82-
Name: "",
98+
Name: PorterGRPCName,
8399
Namespace: PorterNamespace,
100+
Labels: map[string]string{
101+
"app": "porter-grpc-service",
102+
},
103+
},
104+
Spec: corev1.ServiceSpec{
105+
Ports: []corev1.ServicePort{
106+
{
107+
Protocol: corev1.ProtocolTCP,
108+
TargetPort: intstr.FromString("3001"),
109+
Port: int32(3001),
110+
},
111+
},
112+
Selector: map[string]string{"app": "porter-grpc-service"},
113+
Type: corev1.ServiceTypeClusterIP,
84114
},
85115
}
86116

87117
var GrpcConfigMap = &corev1.ConfigMap{
88118
ObjectMeta: metav1.ObjectMeta{
89-
Name: "",
119+
Name: "porter-grpc-service-config",
90120
Namespace: PorterNamespace,
91121
},
122+
Data: map[string]string{
123+
"config": ConfigmMapConfig,
124+
},
92125
}
126+
127+
var ConfigmMapConfig = `
128+
default-secrets-plugin: "kubernetes.secrets"
129+
default-storage: "mongodb"
130+
storage:
131+
- name: "mongodb"
132+
plugin: "mongodb"
133+
config:
134+
url: "mongodb://root:[email protected]"
135+
`

0 commit comments

Comments
 (0)