Skip to content

Commit 83a3508

Browse files
tpoxaclaude
andcommitted
Declare RBAC requirements for secret reading
Use registry.SetRequirements to declare that distribution-module needs get access on secrets. The operator creates the ClusterRole automatically. registry_copy reads regcred secrets via K8s client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9ce1fd9 commit 83a3508

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cmd/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"github.com/spf13/cobra"
1212
"github.com/spf13/viper"
1313
"github.com/tiny-systems/module/cli"
14+
"github.com/tiny-systems/module/module"
15+
"github.com/tiny-systems/module/registry"
1416

1517
// Import components to register them
1618
_ "github.com/tiny-systems/distribution-module/components/registrycatalog"
@@ -33,6 +35,19 @@ func main() {
3335
zerolog.SetGlobalLevel(zerolog.DebugLevel)
3436
}
3537

38+
// Declare RBAC requirements - registry_copy needs to read docker-registry secrets
39+
registry.SetRequirements(module.Requirements{
40+
RBAC: module.RBACRequirements{
41+
ExtraRules: []module.RBACRule{
42+
{
43+
APIGroups: []string{""},
44+
Resources: []string{"secrets"},
45+
Verbs: []string{"get"},
46+
},
47+
},
48+
},
49+
})
50+
3651
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
3752
defer stop()
3853

0 commit comments

Comments
 (0)