Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
  • Loading branch information
kschoche and ishustava authored Feb 24, 2021
1 parent 85bf08d commit c70fe2d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
## UNRELEASED

ENHANCEMENTS:
* Connect: the init container for connect injected pods has been split into two containers.

## 0.24.0 (February 16, 2021)

BREAKING CHANGES
Expand Down
5 changes: 2 additions & 3 deletions connect-inject/container_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

const (
InjectInitCopyContainerName = "consul-connect-inject-init-copy-container"
InjectInitCopyContainerName = "copy-consul-bin"
InjectInitContainerName = "consul-connect-inject-init"
MetaKeyPodName = "pod-name"
MetaKeyKubeNS = "k8s-namespace"
Expand Down Expand Up @@ -67,7 +67,7 @@ type initContainerCommandUpstreamData struct {
// containerInitCopyContainer returns the init container spec for the copy container which places
// the consul binary into the shared volume.
func (h *Handler) containerInitCopyContainer() (corev1.Container, error) {
// # Copy the Consul binary from the image to the shared volume
// Copy the Consul binary from the image to the shared volume.
cmd := "cp /bin/consul /consul/connect-inject/consul"
return corev1.Container{
Name: InjectInitCopyContainerName,
Expand All @@ -81,7 +81,6 @@ func (h *Handler) containerInitCopyContainer() (corev1.Container, error) {
},
Command: []string{"/bin/sh", "-ec", cmd},
}, nil

}

// containerInit returns the init container spec for registering the Consul
Expand Down
2 changes: 1 addition & 1 deletion connect-inject/container_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ func TestHandlerContainerInit_MeshGatewayModeErrors(t *testing.T) {

}

// Test that the init copy container has the correct command
// Test that the init copy container has the correct command.
func TestHandlerContainerInitCopyContainer(t *testing.T) {
require := require.New(t)
h := Handler{}
Expand Down
2 changes: 1 addition & 1 deletion connect-inject/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (h *Handler) Mutate(req *v1beta1.AdmissionRequest) *v1beta1.AdmissionRespon
fmt.Sprintf("/spec/containers/%d/env", i))...)
}

// Add the init container which copies the consul binary
// Add the init container which copies the consul binary.
initCopyContainer, err := h.containerInitCopyContainer()
if err != nil {
h.Log.Error("Error configuring injection init copy container", "err", err, "Request Name", req.Name)
Expand Down

0 comments on commit c70fe2d

Please sign in to comment.