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

Add support of sub_path_expr for container volume_mount #920

Closed
benjah1 opened this issue Jul 17, 2020 · 3 comments · May be fixed by #925
Closed

Add support of sub_path_expr for container volume_mount #920

benjah1 opened this issue Jul 17, 2020 · 3 comments · May be fixed by #925

Comments

@benjah1
Copy link

benjah1 commented Jul 17, 2020

Description

Add support of sub_path_expr for container volume_mount

subPathExpr was added the VolumeMount since 1.15 as beta. It because stable since 1.17.
https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volumemount-v1-core
https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath-with-expanded-environment-variables

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@benjah1
Copy link
Author

benjah1 commented Jul 19, 2020

I found a work around. by using kubectl patch.

in the sts.tf

resource "kubernetes_stateful_set" "prometheus" {
  ...
          volume_mount {
            name             = "data"
            mount_path       = "/data"
            //sub_path_expr  = "$(POD_NAME)"
          }
  ...
  provisioner "local-exec" {
    command = "kubectl -n ${var.namespace} patch sts prometheus --patch \"$(cat ${path.module}/patch/subpathexpr.yaml)\""
  }
}

in the patch/subpathexpr.yaml

spec:
  template:
    spec:
      containers:
        - name: prometheus
          volumeMounts:
            - mountPath: "/data"
              subPathExpr: $(POD_NAME)

@aareet aareet linked a pull request Jul 22, 2020 that will close this issue
2 tasks
@github-actions
Copy link

github-actions bot commented Dec 8, 2021

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

@github-actions github-actions bot added the stale label Dec 8, 2021
@github-actions github-actions bot closed this as completed Jan 7, 2022
@github-actions
Copy link

github-actions bot commented Feb 6, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant