···22name: hsm-secrets-operator
33description: A Kubernetes operator that bridges Pico HSM binary data storage with Kubernetes Secrets
44type: application
55-version: 0.5.20
66-appVersion: v0.5.20
55+version: 0.5.21
66+appVersion: v0.5.21
77icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/kubernetes/icon/color/kubernetes-icon-color.svg
88home: https://github.com/evanjarrett/hsm-secrets-operator
99sources:
+8-20
internal/mirror/manager.go
···611611 return nil
612612}
613613614614-// getAvailableDevices gets list of available physical HSM devices from HSMPools in the operator namespace
614614+// getAvailableDevices gets list of available physical HSM device instances from HSMPools in the operator namespace
615615func (mm *MirrorManager) getAvailableDevices(ctx context.Context, operatorNamespace string) ([]string, error) {
616616 var hsmPoolList hsmv1alpha1.HSMPoolList
617617 // HSMPools are always in the operator namespace (where controller-manager runs)
···619619 return nil, fmt.Errorf("failed to list HSM pools in operator namespace %s: %w", operatorNamespace, err)
620620 }
621621622622- deviceNames := make(map[string]bool)
622622+ var devices = []string{}
623623624624 for _, pool := range hsmPoolList.Items {
625625 if pool.Status.Phase == hsmv1alpha1.HSMPoolPhaseReady && len(pool.Status.AggregatedDevices) > 0 {
626626- // Use the actual HSMDevice names from the pool spec
627627- // AgentManager will handle connecting to the appropriate agent instances
628628- for _, deviceRef := range pool.Spec.HSMDeviceRefs {
629629- // Only add if there are available devices in this pool
630630- hasAvailableDevice := false
631631- for _, aggregatedDevice := range pool.Status.AggregatedDevices {
632632- if aggregatedDevice.Available {
633633- hasAvailableDevice = true
634634- break
635635- }
636636- }
637637- if hasAvailableDevice {
638638- deviceNames[deviceRef] = true
626626+ for _, aggregatedDevice := range pool.Status.AggregatedDevices {
627627+ if aggregatedDevice.Available {
628628+ deviceName := &pool.OwnerReferences[0].Name
629629+ // Create device instance name: deviceRef-index (e.g., "pico-hsm-0", "pico-hsm-1")
630630+ deviceInstanceName := fmt.Sprintf("%s-%s", *deviceName, aggregatedDevice.SerialNumber)
631631+ devices = append(devices, deviceInstanceName)
639632 }
640633 }
641634 }
642642- }
643643-644644- devices := make([]string, 0, len(deviceNames))
645645- for deviceName := range deviceNames {
646646- devices = append(devices, deviceName)
647635 }
648636649637 sort.Strings(devices) // Ensure consistent ordering