Skip to content

Commit 6df4d3b

Browse files
committed
Depreciate auth.key_passphrase
Fixes: #142
1 parent 2896e44 commit 6df4d3b

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

manifests/cloud-provider-example.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ auth:
88
<snip>
99
-----END RSA PRIVATE KEY-----
1010
# Omit if there is not a password for the key
11-
key_passphrase: supersecretpassword
11+
passphrase: supersecretpassword
1212
fingerprint: 8c:bf:17:7b:5f:e0:7d:13:75:11:d6:39:0d:e2:84:74
1313

1414
# vcn configures the Virtual Cloud Network (VCN) within which the cluster resides.

pkg/oci/ccm.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func NewCloudProvider(config *Config) (cloudprovider.Interface, error) {
7373
config.Auth.Region,
7474
config.Auth.Fingerprint,
7575
config.Auth.PrivateKey,
76-
&config.Auth.PrivateKeyPassphrase,
76+
&config.Auth.Passphrase,
7777
))
7878
if err != nil {
7979
return nil, err
@@ -109,6 +109,8 @@ func init() {
109109
if err != nil {
110110
return nil, err
111111
}
112+
cfg.Complete()
113+
112114
if err = cfg.Validate(); err != nil {
113115
return nil, err
114116
}

pkg/oci/config.go

+18-7
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ import (
1919
"io"
2020
"io/ioutil"
2121

22+
"github.com/golang/glog"
2223
"gopkg.in/yaml.v2"
2324
)
2425

2526
// AuthConfig holds the configuration required for communicating with the OCI
2627
// API.
2728
type AuthConfig struct {
28-
Region string `yaml:"region"`
29-
TenancyOCID string `yaml:"tenancy"`
30-
CompartmentOCID string `yaml:"compartment"`
31-
UserOCID string `yaml:"user"`
32-
PrivateKey string `yaml:"key"`
33-
Fingerprint string `yaml:"fingerprint"`
34-
PrivateKeyPassphrase string `yaml:"key_passphrase"` // TODO(apryde): the yaml should be keyPassphrase
29+
Region string `yaml:"region"`
30+
TenancyOCID string `yaml:"tenancy"`
31+
CompartmentOCID string `yaml:"compartment"`
32+
UserOCID string `yaml:"user"`
33+
PrivateKey string `yaml:"key"`
34+
Fingerprint string `yaml:"fingerprint"`
35+
// PrivateKeyPassphrase is DEPRECIATED in favour of Passphrase.
36+
PrivateKeyPassphrase string `yaml:"key_passphrase"`
37+
Passphrase string `yaml:"passphrase"`
3538
}
3639

3740
// LoadBalancerConfig holds the configuration options for OCI load balancers.
@@ -60,6 +63,14 @@ type Config struct {
6063
VCNID string `yaml:"vcn"`
6164
}
6265

66+
// Complete the config applying defaults / overrides.
67+
func (c *Config) Complete() {
68+
if c.Auth.Passphrase == "" && c.Auth.PrivateKeyPassphrase != "" {
69+
glog.Warning("cloud-provider config: \"auth.key_passphrase\" is DEPRECIATED and will be removed in a later release. Please set \"auth.passphrase\".")
70+
c.Auth.Passphrase = c.Auth.PrivateKeyPassphrase
71+
}
72+
}
73+
6374
// Validate validates the OCI cloud-provider config.
6475
func (c *Config) Validate() error {
6576
return ValidateConfig(c).ToAggregate()

0 commit comments

Comments
 (0)