Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Sloka <slokas@vmware.com>
  • Loading branch information
stevesloka committed Nov 29, 2021
1 parent c6d20cd commit abfdf67
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 76 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/prbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Test Pull Request

# Trigger the workflow on push or pull request
on:
on:
push:
pull_request:
types: [opened, synchronize]
Expand Down Expand Up @@ -74,35 +74,35 @@ jobs:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#contour-ci-notifications'
if: ${{ failure() && github.ref == 'refs/heads/main' }}
if: ${{ failure() && github.ref == 'refs/heads/main' }}
build-image:
needs:
- lint
- codespell
- codegen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Build image
env:
TAG_LATEST: "false"
run: |
make multiarch-build
- name: Upload image
uses: actions/upload-artifact@v2
with:
name: image
path: image/contour-*.tar
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#contour-ci-notifications'
if: ${{ failure() && github.ref == 'refs/heads/main' }}
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Build image
env:
TAG_LATEST: "false"
run: |
make multiarch-build
- name: Upload image
uses: actions/upload-artifact@v2
with:
name: image
path: image/contour-*.tar
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#contour-ci-notifications'
if: ${{ failure() && github.ref == 'refs/heads/main' }}
e2e:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -320,4 +320,4 @@ jobs:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#contour-ci-notifications'
if: ${{ failure() && github.ref == 'refs/heads/main' }}
if: ${{ failure() && github.ref == 'refs/heads/main' }}
69 changes: 18 additions & 51 deletions test/e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,55 +541,21 @@ func (d *Deployment) EnsureResourcesForLocalContour() error {
}

if d.EnvoyDeploymentMode == DaemonsetMode {

// Add bootstrap ConfigMap as volume and add envoy admin volume on Envoy pods (also removes cert volume).
d.EnvoyDaemonSet.Spec.Template.Spec.Volumes = []v1.Volume{{
Name: "envoy-config",
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: v1.LocalObjectReference{
Name: "envoy-bootstrap",
},
},
},
}, {
Name: "envoy-admin",
VolumeSource: v1.VolumeSource{
EmptyDir: &v1.EmptyDirVolumeSource{},
},
}}

// Remove cert volume mount.
d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1].VolumeMounts = []v1.VolumeMount{
d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1].VolumeMounts[0], // Config mount
d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1].VolumeMounts[2], // Admin mount
}

d.EnvoyDaemonSet.Spec.Template.Spec.Volumes = append(d.EnvoyDaemonSet.Spec.Template.Spec.Volumes, d.EnvoyExtraVolumes...)
d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1].VolumeMounts = append(d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1].VolumeMounts, d.EnvoyExtraVolumeMounts...)

// Remove init container.
d.EnvoyDaemonSet.Spec.Template.Spec.InitContainers = nil

// Remove shutdown-manager container.
d.EnvoyDaemonSet.Spec.Template.Spec.Containers = d.EnvoyDaemonSet.Spec.Template.Spec.Containers[1:]

// Expose the metrics & admin interfaces via host port to test from outside the kind cluster.
d.EnvoyDaemonSet.Spec.Template.Spec.Containers[0].Ports = append(d.EnvoyDaemonSet.Spec.Template.Spec.Containers[0].Ports,
v1.ContainerPort{
Name: "metrics",
ContainerPort: 8002,
HostPort: 8002,
Protocol: v1.ProtocolTCP,
})
d.EnvoyDaemonSet.Spec.Template = d.mutatePodTemplate(d.EnvoyDaemonSet.Spec.Template)
return d.EnsureEnvoyDaemonSet()
}

d.EnvoyDeployment.Spec.Template = d.mutatePodTemplate(d.EnvoyDeployment.Spec.Template)

// Set the ReplicaCount=1
d.EnvoyDeployment.Spec.Replicas = pointer.Int32(1)

return d.EnsureEnvoyDeployment()
}

func (d *Deployment) mutatePodTemplate(pts v1.PodTemplateSpec) v1.PodTemplateSpec {
// Add bootstrap ConfigMap as volume and add envoy admin volume on Envoy pods (also removes cert volume).
d.EnvoyDeployment.Spec.Template.Spec.Volumes = []v1.Volume{{
pts.Spec.Volumes = []v1.Volume{{
Name: "envoy-config",
VolumeSource: v1.VolumeSource{
ConfigMap: &v1.ConfigMapVolumeSource{
Expand All @@ -606,29 +572,30 @@ func (d *Deployment) EnsureResourcesForLocalContour() error {
}}

// Remove cert volume mount.
d.EnvoyDeployment.Spec.Template.Spec.Containers[1].VolumeMounts = []v1.VolumeMount{
d.EnvoyDeployment.Spec.Template.Spec.Containers[1].VolumeMounts[0], // Config mount
d.EnvoyDeployment.Spec.Template.Spec.Containers[1].VolumeMounts[2], // Admin mount
pts.Spec.Containers[1].VolumeMounts = []v1.VolumeMount{
pts.Spec.Containers[1].VolumeMounts[0], // Config mount
pts.Spec.Containers[1].VolumeMounts[2], // Admin mount
}

d.EnvoyDeployment.Spec.Template.Spec.Volumes = append(d.EnvoyDeployment.Spec.Template.Spec.Volumes, d.EnvoyExtraVolumes...)
d.EnvoyDeployment.Spec.Template.Spec.Containers[1].VolumeMounts = append(d.EnvoyDeployment.Spec.Template.Spec.Containers[1].VolumeMounts, d.EnvoyExtraVolumeMounts...)
pts.Spec.Volumes = append(pts.Spec.Volumes, d.EnvoyExtraVolumes...)
pts.Spec.Containers[1].VolumeMounts = append(pts.Spec.Containers[1].VolumeMounts, d.EnvoyExtraVolumeMounts...)

// Remove init container.
d.EnvoyDeployment.Spec.Template.Spec.InitContainers = nil
pts.Spec.InitContainers = nil

// Remove shutdown-manager container.
d.EnvoyDeployment.Spec.Template.Spec.Containers = d.EnvoyDeployment.Spec.Template.Spec.Containers[1:]
pts.Spec.Containers = pts.Spec.Containers[1:]

// Expose the metrics & admin interfaces via host port to test from outside the kind cluster.
d.EnvoyDeployment.Spec.Template.Spec.Containers[0].Ports = append(d.EnvoyDeployment.Spec.Template.Spec.Containers[0].Ports,
pts.Spec.Containers[0].Ports = append(pts.Spec.Containers[0].Ports,
v1.ContainerPort{
Name: "metrics",
ContainerPort: 8002,
HostPort: 8002,
Protocol: v1.ProtocolTCP,
})
return d.EnsureEnvoyDeployment()

return pts
}

// DeleteResourcesForLocalContour ensures deletion of all resources
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
cleanup []func()
)

func TestInfra(t *testing.T) {
func TestDeployment(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Deployment tests")
}
Expand Down

0 comments on commit abfdf67

Please sign in to comment.