Skip to content

Commit

Permalink
create service,confimap and volumes for deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Troy Connor <troy0820@users.noreply.github.com>
  • Loading branch information
troy0820 committed Jun 25, 2024
1 parent 9fb8eae commit 2c48935
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions controllers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/ptr"
)

Expand Down Expand Up @@ -72,21 +73,63 @@ var GrpcDeployment = &appsv1.Deployment{
},
},
},
Volumes: []corev1.Volume{
{
Name: "porter-grpc-service-config-volume",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
Items: []corev1.KeyToPath{
{
Key: "config",
Path: "config.yaml",
},
},
},
},
},
},
},
},
},
}

var GrpcService = &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "",
Name: PorterGRPCName,
Namespace: PorterNamespace,
Labels: map[string]string{
"app": "porter-grpc-service",
},
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{
Protocol: corev1.ProtocolTCP,
TargetPort: intstr.FromString("3001"),
Port: int32(3001),
},
},
Selector: map[string]string{"app": "porter-grpc-service"},
Type: corev1.ServiceTypeClusterIP,
},
}

var GrpcConfigMap = &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "",
Name: "porter-grpc-service-config",
Namespace: PorterNamespace,
},
Data: map[string]string{
"config": ConfigmMapConfig,
},
}

var ConfigmMapConfig = `
default-secrets-plugin: "kubernetes.secrets"
default-storage: "mongodb"
storage:
- name: "mongodb"
plugin: "mongodb"
config:
url: "mongodb://root:demopasswd@porter-operator-mongodb.demo.svc.cluster.local"
`

0 comments on commit 2c48935

Please sign in to comment.