Skip to content

Commit

Permalink
Remove excessive key generation to decrease cpu load (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
eldondevat authored Aug 14, 2020
1 parent 62993fa commit 1e21f02
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions operator/pkg/reconciliation/reconcile_racks.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,34 +1561,6 @@ func (rc *ReconciliationContext) findStartedNotReadyNodes() (bool, error) {
return false, nil
}

func (rc *ReconciliationContext) copyPodCredentials(pod *corev1.Pod, jksBlob []byte) error {
_, err := rc.retrieveSecret(types.NamespacedName{
Name: fmt.Sprintf("%s-keystore", rc.Datacenter.Name),
Namespace: rc.Datacenter.Namespace,
})

if err == nil { // This secret already exists, nothing to do
return nil
}

secret := &corev1.Secret{

TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-keystore", rc.Datacenter.Name),
Namespace: rc.Datacenter.Namespace,
},
}
secret.Data = map[string][]byte{
"node-keystore.jks": jksBlob,
}

return rc.Client.Create(rc.Ctx, secret)
}

func (rc *ReconciliationContext) startCassandra(endpointData httphelper.CassMetadataEndpoints, pod *corev1.Pod) error {
dc := rc.Datacenter
mgmtClient := rc.NodeMgmtClient
Expand Down Expand Up @@ -1617,15 +1589,6 @@ func (rc *ReconciliationContext) startCassandra(endpointData httphelper.CassMeta
}

var err error
var internodeCA *corev1.Secret

if internodeCA, err = rc.retrieveInternodeCredentialSecretOrCreateDefault(); err != nil {
return err
}
jksBlob, err := utils.GenerateJKS(internodeCA, pod.ObjectMeta.Name, dc.Name)
if err = rc.copyPodCredentials(pod, jksBlob); err != nil {
return err
}

if shouldReplacePod && replaceAddress != "" {
// If we have a replace address that means the cassandra node did
Expand Down

0 comments on commit 1e21f02

Please sign in to comment.