Skip to content

Commit

Permalink
Add Container Ports (#497)
Browse files Browse the repository at this point in the history
* add containers ports

* add extra services and containers ports

* add containers ports

* fix whitespace

* remove json tags
  • Loading branch information
chunter0 authored Sep 6, 2023
1 parent b5121af commit c11138c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/v0.34.1/container-ports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
- type: NEW_FEATURE
issueLink: https://github.com/solo-io/skv2/issues/495
description: >
Allow users to configure container ports for the `container` and `sidecar`.
5 changes: 5 additions & 0 deletions codegen/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ var _ = Describe("Cmd", func() {
Repository: "gloo-mesh-mgmt-server",
Tag: "0.0.1",
},
ContainerPorts: []ContainerPort{{
Name: "stats",
Port: "{{ $Values.glooMgmtServer.statsPort }}",
}},
VolumeMounts: []v1.VolumeMount{{
Name: "license-keys",
MountPath: "/etc/gloo-mesh/license-keys",
Expand Down Expand Up @@ -149,6 +153,7 @@ var _ = Describe("Cmd", func() {
Expect(deployment).To(ContainSubstring(fmt.Sprintf("{{ if %s }}", "and ($.Values.glooAgent.enabled) (not $.Values.glooAgent.runAsSidecar)")))
Expect(deployment).To(ContainSubstring("name: agent-volume"))
Expect(deployment).To(ContainSubstring("{{ $glooAgent.ports.grpc }}"))
Expect(deployment).To(ContainSubstring("{{ $Values.glooMgmtServer.statsPort }}"))
})
It("generates controller code and manifests for a proto file", func() {
cmd := &Command{
Expand Down
6 changes: 6 additions & 0 deletions codegen/model/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ type Container struct {
Env []corev1.EnvVar
Resources *corev1.ResourceRequirements
SecurityContext *corev1.SecurityContext
ContainerPorts []ContainerPort
}

type ContainerPort struct {
Name string
Port string
}

type ReadinessProbe struct {
Expand Down
7 changes: 7 additions & 0 deletions codegen/templates/chart/operator-deployment.yamltmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ spec:
args:
[[ toYaml $container.Args | indent 8 ]]
[[- end ]]
[[- if $container.ContainerPorts ]]
ports:
[[- range $port := $container.ContainerPorts ]]
- name: [[ $port.Name ]]
containerPort: [[ $port.Port ]]
[[- end ]]
[[- end ]]
{{- if [[ $containerVar ]].env }}
env:
{{ toYaml [[ $containerVar ]].env | indent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ spec:
- name: gloo-mgmt-server
image: {{ $glooMgmtServerImage.registry }}/{{ $glooMgmtServerImage.repository }}:{{ $glooMgmtServerImage.tag }}
imagePullPolicy: {{ $glooMgmtServerImage.pullPolicy }}
ports:
- name: stats
containerPort: {{ $Values.glooMgmtServer.statsPort }}
{{- if $glooMgmtServer.env }}
env:
{{ toYaml $glooMgmtServer.env | indent 10 }}
Expand Down

0 comments on commit c11138c

Please sign in to comment.