Documentation
¶
Index ¶
- type K8sRepository
- func (k *K8sRepository) ConfigureKey(ctx context.Context, deviceID string, opts repository.KeyOptions) error
- func (k *K8sRepository) ListAllDeviceIDs(ctx context.Context) ([]string, error)
- func (k *K8sRepository) LookupKey(ctx context.Context, deviceID string) (*repository.Key, error)
- func (k *K8sRepository) PublishKey(ctx context.Context, deviceID, publicKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type K8sRepository ¶
type K8sRepository struct {
// contains filtered or unexported fields
}
K8sRepository uses Kubernetes configmaps as public key backend for devices.
func NewK8sRepository ¶
func NewK8sRepository(ctx context.Context, kcl kubernetes.Interface, ns string) (*K8sRepository, error)
NewK8sRepository creates a new K8sRepository key repository.
Use `ns` to specify an existing namespace to use for the device configmaps. Provide either a k8s.io/client-go/kubernetes/fake.NewSimpleClientset() for `kcl` for testing, or a real Interface from kubernetes.NewForConfig(..).
func (*K8sRepository) ConfigureKey ¶
func (k *K8sRepository) ConfigureKey(ctx context.Context, deviceID string, opts repository.KeyOptions) error
func (*K8sRepository) ListAllDeviceIDs ¶
func (k *K8sRepository) ListAllDeviceIDs(ctx context.Context) ([]string, error)
ListAllDeviceIDs returns a slice of all device identifiers found in the namespace.
func (*K8sRepository) LookupKey ¶
func (k *K8sRepository) LookupKey(ctx context.Context, deviceID string) (*repository.Key, error)
LookupKey returns the public key for a given device identifier.
The public key is stored under a specific key in the configmap. Returns an error if the configmap is not found or is not valid.
func (*K8sRepository) PublishKey ¶
func (k *K8sRepository) PublishKey(ctx context.Context, deviceID, publicKey string) error
PublishKey sets or updates a public key for a given device identifier.
If the configmap for a device does not exist yet it is created. If it exists already the public key section of the configmap is updated.