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

Updating hsm config name #160

Merged
merged 1 commit into from
Jan 12, 2024
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
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
Loading