Skip to content

Commit

Permalink
Updating hsm config name (#160)
Browse files Browse the repository at this point in the history
This PR addresses the renaming for the hsm configs

Signed-off-by: asararatnakar <[email protected]>
  • Loading branch information
asararatnakar authored Jan 12, 2024
1 parent cfac96b commit 3d81bc4
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions pkg/initializer/common/config/hsmconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ type Client interface {
Get(ctx context.Context, key client.ObjectKey, obj client.Object) error
}

// ReadHSMConfig reads hsm configuration from 'ibp-hsm-config', and key 'ibp-hsm-config.yaml'
// ReadHSMConfig reads hsm configuration from 'ibm-hlfsupport-hsm-config', and key 'ibm-hlfsupport-hsm-config.yaml'
// from data
func ReadHSMConfig(client Client, instance metav1.Object) (*HSMConfig, error) {
// NOTE: This is hard-coded because this name should never be different
name := "ibp-hsm-config"
name := "ibm-hlfsupport-hsm-config"

cm := &corev1.ConfigMap{}
err := client.Get(
Expand All @@ -55,11 +55,11 @@ func ReadHSMConfig(client Client, instance metav1.Object) (*HSMConfig, error) {
cm,
)
if err != nil {
return nil, errors.Wrap(err, "failed to get hsm config 'ibp-hsm-config'")
return nil, errors.Wrap(err, "failed to get hsm config 'ibm-hlfsupport-hsm-config'")
}

hsmConfig := &HSMConfig{}
err = yaml.Unmarshal([]byte(cm.Data["ibp-hsm-config.yaml"]), hsmConfig)
err = yaml.Unmarshal([]byte(cm.Data["ibm-hlfsupport-hsm-config.yaml"]), hsmConfig)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (ca *CA) Initialize(instance *current.IBPCA, update Update) error {
} else {
hsmConfig, err := commonconfig.ReadHSMConfig(ca.Client, instance)
if err != nil {
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibp-hsm-config'")
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibm-hlfsupport-hsm-config'")
}

if hsmConfig.Daemon != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/ca/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ var _ = Describe("Base CA", func() {
Expect(err).NotTo(HaveOccurred())

o.Data = map[string]string{
"ibp-hsm-config.yaml": string(bytes),
"ibm-hlfsupport-hsm-config.yaml": string(bytes),
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/ca/override/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ var _ = Describe("Deployment Overrides", func() {
return err
}
o := obj.(*corev1.ConfigMap)
o.Data = map[string]string{"ibp-hsm-config.yaml": string(configBytes)}
o.Data = map[string]string{"ibm-hlfsupport-hsm-config.yaml": string(configBytes)}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/orderer/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func (n *Node) Initialize(instance *current.IBPOrderer, update Update) error {

hsmConfig, err := commonconfig.ReadHSMConfig(n.Client, instance)
if err != nil {
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibp-hsm-config'")
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibm-hlfsupport-hsm-config'")
}

if hsmConfig.Daemon != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/orderer/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ var _ = Describe("Base Orderer Node", func() {
Expect(err).NotTo(HaveOccurred())

o.Data = map[string]string{
"ibp-hsm-config.yaml": string(bytes),
"ibm-hlfsupport-hsm-config.yaml": string(bytes),
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/orderer/override/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var _ = Describe("Base Orderer Deployment Overrides", func() {
return err
}
o := obj.(*corev1.ConfigMap)
o.Data = map[string]string{"ibp-hsm-config.yaml": string(configBytes)}
o.Data = map[string]string{"ibm-hlfsupport-hsm-config.yaml": string(configBytes)}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/peer/override/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var _ = Describe("Base Peer Deployment Overrides", func() {
return err
}
o := obj.(*corev1.ConfigMap)
o.Data = map[string]string{"ibp-hsm-config.yaml": string(configBytes)}
o.Data = map[string]string{"ibm-hlfsupport-hsm-config.yaml": string(configBytes)}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/offering/base/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (p *Peer) Initialize(instance *current.IBPPeer, update Update) error {
} else {
hsmConfig, err := commonconfig.ReadHSMConfig(p.Client, instance)
if err != nil {
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibp-hsm-config'")
return errors.New("using non-proxy HSM, but no HSM config defined as config map 'ibm-hlfsupport-hsm-config'")
}

if hsmConfig.Daemon != nil {
Expand Down

0 comments on commit 3d81bc4

Please sign in to comment.