Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable injecting sidecar container via helm configuration. #749

Merged
merged 11 commits into from
Sep 29, 2021

Conversation

NicoletaPopoviciu
Copy link
Collaborator

@NicoletaPopoviciu NicoletaPopoviciu commented Sep 27, 2021

Changes proposed in this PR:

Enable injecting sidecar container via helm configuration.
Based off Vault implementation https://github.com/hashicorp/vault-helm/pull/87/files#

  • Add server.extraContainers and client.extraContainers to values.yaml
  • Change client-daemonset.yaml and server-statefulset.yaml to check for extraContainers
  • Add bats tests

How I've tested this PR:

  • ran bats tests locally
  • tested locally that the additional containers were created when extraContainers was specified
  • helm install -f config.yaml nicoleta charts/consul

Sample config.yaml file used:

server:
  replicas: 1
  extraContainers:
    - name: static-server
      image: docker.mirror.hashicorp.services/hashicorp/http-echo:latest
      args:
        - -text="hello world"
        - -listen=:8080
      ports:
        - containerPort: 8080
          name: http
client:
  extraContainers:
    - name: static-server
      image: docker.mirror.hashicorp.services/hashicorp/http-echo:latest
      args:
        - -text="hello world"
        - -listen=:8080
      ports:
        - containerPort: 8080
          name: http

How I expect reviewers to test this PR:

Checklist:

  • Tests added
  • CHANGELOG entry added

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me 🎉 I've added a couple of minor edits, but nothing blocking :shipit:

charts/consul/test/unit/client-daemonset.bats Outdated Show resolved Hide resolved
@@ -596,6 +596,19 @@ server:
# @type: array<map>
extraVolumes: []

# A list of sidecar containers.
# @type: array<string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an array of objects/maps

Suggested change
# @type: array<string>
# @type: array<map>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the @type line needs to be the last in the comment. For example:

  # Example:
  #
  # ```yaml
  # imagePullSecrets:
  #   - name: pull-secret-name
  #   - name: pull-secret-name-2
  # ```
  # @type: array<map>

@@ -925,6 +938,19 @@ client:
# @type: array<map>
extraVolumes: []

# A list of sidecar containers.
# @type: array<string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# @type: array<string>
# @type: array<map>

charts/consul/test/unit/server-statefulset.bats Outdated Show resolved Hide resolved
Copy link
Member

@lkysow lkysow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just some small nits.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -596,6 +596,19 @@ server:
# @type: array<map>
extraVolumes: []

# A list of sidecar containers.
# @type: array<string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the @type line needs to be the last in the comment. For example:

  # Example:
  #
  # ```yaml
  # imagePullSecrets:
  #   - name: pull-secret-name
  #   - name: pull-secret-name-2
  # ```
  # @type: array<map>

charts/consul/test/unit/client-daemonset.bats Outdated Show resolved Hide resolved
charts/consul/test/unit/client-daemonset.bats Outdated Show resolved Hide resolved

}

@test "client/DaemonSet: no extra client containers added" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test "client/DaemonSet: no extra client containers added" {
@test "client/DaemonSet: no extra containers added by default" {

charts/consul/test/unit/client-daemonset.bats Outdated Show resolved Hide resolved
Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants