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

dial: grpc naming is not compatible with windows unix socket #490

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkg/secrets-store/provider_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"net"
"os"
"regexp"
"sync"
Expand Down Expand Up @@ -109,10 +110,12 @@ func (p *PluginClientBuilder) Get(ctx context.Context, provider string) (v1alpha
return nil, fmt.Errorf("%w: provider %q", ErrProviderNotFound, provider)
}

conn, err := grpc.DialContext(
ctx,
fmt.Sprintf("unix://%s/%s.sock", p.socketPath, provider),
conn, err := grpc.Dial(
fmt.Sprintf("%s/%s.sock", p.socketPath, provider),
grpc.WithInsecure(), // the interface is only secured through filesystem ACLs
grpc.WithContextDialer(func(ctx context.Context, target string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "unix", target)
}),
grpc.WithDefaultServiceConfig(ServiceConfig),
)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion test/bats/azure.bats
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ setup() {
}

@test "CSI inline volume test with pod portability - read azure kv secret from pod" {
wait_for_process $WAIT_TIME $SLEEP_TIME "kubectl exec nginx-secrets-store-inline-crd -- $EXEC_COMMAND /mnt/secrets-store/$SECRET_NAME | grep '${SECRET_VALUE}'"

result=$(kubectl exec nginx-secrets-store-inline-crd -- $EXEC_COMMAND /mnt/secrets-store/$SECRET_NAME)
[[ "${result//$'\r'}" == "${SECRET_VALUE}" ]]
}
Expand Down Expand Up @@ -127,7 +129,7 @@ setup() {
result=$(kubectl get secret foosecret -o jsonpath="{.data.username}" | base64 -d)
[[ "${result//$'\r'}" == "${SECRET_VALUE}" ]]

result=$(kubectl exec $POD printenv | grep SECRET_USERNAME) | awk -F"=" '{ print $2}'
result=$(kubectl exec $POD -- printenv | grep SECRET_USERNAME) | awk -F"=" '{ print $2}'
[[ "${result//$'\r'}" == "${SECRET_VALUE}" ]]

result=$(kubectl get secret foosecret -o jsonpath="{.metadata.labels.environment}")
Expand Down