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

Prepare to release 1.0.0 #134

Merged
merged 2 commits into from
Jan 26, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
## Unreleased

## 1.0.0 (January 25th, 2022)

CHANGES:

* `-write-secrets` flag removed. All secrets are now written to the filesystem by the CSI secrets store driver. [[GH-133](https://github.com/hashicorp/vault-csi-provider/pull/133)]
* **NOTE:** CSI secrets store driver v0.0.21+ is required.
* `-health_addr` flag removed, use `-health-addr` instead. [[GH-133](https://github.com/hashicorp/vault-csi-provider/pull/133)]
* Warning logs are no longer printed when deprecated SecretProviderClass fields `kubernetesServiceAccountPath` and `vaultCAPem` are used. [[GH-134](https://github.com/hashicorp/vault-csi-provider/pull/134)]

## 0.4.0 (January 12th, 2022)

Expand Down
2 changes: 1 addition & 1 deletion deployment/vault-csi-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
tolerations:
containers:
- name: provider-vault-installer
image: hashicorp/vault-csi-provider:0.4.0
image: hashicorp/vault-csi-provider:1.0.0
imagePullPolicy: Always
args:
- -endpoint=/provider/vault.sock
Expand Down
13 changes: 3 additions & 10 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"strconv"

"github.com/hashicorp/go-hclog"
"gopkg.in/yaml.v3"
"k8s.io/apimachinery/pkg/types"
)
Expand Down Expand Up @@ -64,13 +63,13 @@ type Secret struct {
SecretArgs map[string]interface{} `yaml:"secretArgs,omitempty"`
}

func Parse(logger hclog.Logger, parametersStr, targetPath, permissionStr string, defaultVaultAddr string, defaultVaultKubernetesMountPath string) (Config, error) {
func Parse(parametersStr, targetPath, permissionStr string, defaultVaultAddr string, defaultVaultKubernetesMountPath string) (Config, error) {
config := Config{
TargetPath: targetPath,
}

var err error
config.Parameters, err = parseParameters(logger, parametersStr, defaultVaultAddr, defaultVaultKubernetesMountPath)
config.Parameters, err = parseParameters(parametersStr, defaultVaultAddr, defaultVaultKubernetesMountPath)
if err != nil {
return Config{}, err
}
Expand All @@ -88,7 +87,7 @@ func Parse(logger hclog.Logger, parametersStr, targetPath, permissionStr string,
return config, nil
}

func parseParameters(logger hclog.Logger, parametersStr string, defaultVaultAddress string, defaultVaultKubernetesMountPath string) (Parameters, error) {
func parseParameters(parametersStr string, defaultVaultAddress string, defaultVaultKubernetesMountPath string) (Parameters, error) {
var params map[string]string
err := json.Unmarshal([]byte(parametersStr), &params)
if err != nil {
Expand Down Expand Up @@ -132,12 +131,6 @@ func parseParameters(logger hclog.Logger, parametersStr string, defaultVaultAddr
if parameters.VaultKubernetesMountPath == "" {
parameters.VaultKubernetesMountPath = defaultVaultKubernetesMountPath
}
if _, exists := params["kubernetesServiceAccountPath"]; exists {
logger.Warn("kubernetesServiceAccountPath set but will be ignored", "PodInfo", parameters.PodInfo)
}
if _, exists := params["vaultCAPem"]; exists {
logger.Warn("vaultCAPem set but will be ignored", "PodInfo", parameters.PodInfo)
}

return parameters, nil
}
Expand Down
9 changes: 4 additions & 5 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"path/filepath"
"testing"

"github.com/hashicorp/go-hclog"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -53,7 +52,7 @@ func TestParseParametersFromYaml(t *testing.T) {
require.NoError(t, err)

// This is now the form the provider receives the data in.
params, err := parseParameters(hclog.NewNullLogger(), string(paramsBytes), defaultVaultAddress, defaultVaultKubernetesMountPath)
params, err := parseParameters(string(paramsBytes), defaultVaultAddress, defaultVaultKubernetesMountPath)
require.NoError(t, err)

require.Equal(t, Parameters{
Expand Down Expand Up @@ -87,7 +86,7 @@ func TestParseParameters(t *testing.T) {
// This file's contents are copied directly from a driver mount request.
parametersStr, err := ioutil.ReadFile(filepath.Join("testdata", "example-parameters-string.txt"))
require.NoError(t, err)
actual, err := parseParameters(hclog.NewNullLogger(), string(parametersStr), defaultVaultAddress, defaultVaultKubernetesMountPath)
actual, err := parseParameters(string(parametersStr), defaultVaultAddress, defaultVaultKubernetesMountPath)
require.NoError(t, err)
expected := Parameters{
VaultRoleName: "example-role",
Expand Down Expand Up @@ -178,7 +177,7 @@ func TestParseConfig(t *testing.T) {
} {
parametersStr, err := json.Marshal(tc.parameters)
require.NoError(t, err)
cfg, err := Parse(hclog.NewNullLogger(), string(parametersStr), tc.targetPath, "420", defaultVaultAddress, defaultVaultKubernetesMountPath)
cfg, err := Parse(string(parametersStr), tc.targetPath, "420", defaultVaultAddress, defaultVaultKubernetesMountPath)
require.NoError(t, err, tc.name)
require.Equal(t, tc.expected, cfg)
}
Expand Down Expand Up @@ -208,7 +207,7 @@ func TestParseConfig_Errors(t *testing.T) {
} {
parametersStr, err := json.Marshal(tc.parameters)
require.NoError(t, err)
_, err = Parse(hclog.NewNullLogger(), string(parametersStr), "/some/path", "420", defaultVaultAddress, defaultVaultKubernetesMountPath)
_, err = Parse(string(parametersStr), "/some/path", "420", defaultVaultAddress, defaultVaultKubernetesMountPath)
require.Error(t, err, tc.name)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (p *Server) Version(context.Context, *pb.VersionRequest) (*pb.VersionRespon
}

func (p *Server) Mount(ctx context.Context, req *pb.MountRequest) (*pb.MountResponse, error) {
cfg, err := config.Parse(p.Logger.Named("config"), req.Attributes, req.TargetPath, req.Permission, p.VaultAddr, p.VaultMount)
cfg, err := config.Parse(req.Attributes, req.TargetPath, req.Permission, p.VaultAddr, p.VaultMount)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion manifest_staging/deployment/vault-csi-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
tolerations:
containers:
- name: provider-vault-installer
image: hashicorp/vault-csi-provider:0.4.0
image: hashicorp/vault-csi-provider:1.0.0
imagePullPolicy: Always
args:
- -endpoint=/provider/vault.sock
Expand Down