@@ -27,17 +27,6 @@ import (
2727 "k8s.io/apimachinery/pkg/labels"
2828)
2929
30- /*
31- TODO
32- Think about HA?
33- HA
34- * clients connect to prefered master
35- * admin command knows all masters
36- * do we want leaderelection so only one syncs from git? Probably!
37- * how to ensure clients fetches from the current leader?
38-
39- */
40-
4130type websocketRequestResponse struct {
4231 list map [string ]chan * websocketRequest
4332 mutex * sync.RWMutex
@@ -264,13 +253,6 @@ func (m *Master) run(ctx context.Context) error {
264253 }
265254 }
266255
267- // if ref := obj.Spec.Reference; ref != nil {
268- // https://github.com/fluxcd/source-controller/blob/16fed8995d1f5ba818697220fd2020f78e2cc630/controllers/gitrepository_controller.go#L733
269- // cloneOpts.Branch = ref.Branch
270- // cloneOpts.Commit = ref.Commit
271- // cloneOpts.Tag = ref.Tag
272- // cloneOpts.SemVer = ref.SemVer
273- // }
274256}
275257
276258func (m * Master ) stateRunner (ctx context.Context , ch chan * types.Machine , websocketCh chan * websocketRequest , machineUpd chan machineUpdate ) {
@@ -474,7 +456,7 @@ func (m *Master) handleRequest(ctx context.Context, machines map[string]*types.M
474456 machineUpdateCh <- machineUpdate {Machine : machine , Source : protocol .ManualSource }
475457
476458 case "agent-aqure-lock" :
477- if admin , _ := sess .Get ("allowed" ); ! admin .(bool ) {
459+ if allowed , _ := sess .Get ("allowed" ); ! allowed .(bool ) {
478460 return fmt .Errorf ("agent-aqure-lock permission denied" )
479461 }
480462 l := & protocol.AgentLock {}
@@ -566,35 +548,6 @@ func sendIsLast(sess *melody.Session, reqID string) {
566548 }
567549}
568550
569- type Cloner interface {
570- Clone (ctx context.Context , url string , cloneOpts repository.CloneConfig ) (* git.Commit , error )
571- Close ()
572- }
573-
574- type testCloner struct {
575- dir string
576- }
577-
578- func (tc * testCloner ) Clone (ctx context.Context , URL string , cloneOpts repository.CloneConfig ) (* git.Commit , error ) {
579-
580- u , err := url .Parse (URL )
581- if err != nil {
582- return nil , err
583- }
584- cwd , err := os .Getwd ()
585- if err != nil {
586- return nil , err
587- }
588-
589- from := filepath .Join (cwd , u .Path )
590- logrus .Infof ("testCloner: copy %s to %s" , from , tc .dir )
591- err = os .CopyFS (tc .dir , os .DirFS (from ))
592- return nil , err
593- }
594- func (tc * testCloner ) Close () {
595-
596- }
597-
598551func (m * Master ) clone (ctx context.Context , authOpts * git.AuthOptions , cloneOpts repository.CloneConfig , manifestCh chan machineUpdate ) error {
599552 dir , err := os .MkdirTemp ("" , "gmc" )
600553 if err != nil {
0 commit comments