Initial upgrade flow for control-plane
This commit is contained in:
32
clitools/pkg/node/fs.go
Normal file
32
clitools/pkg/node/fs.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
monov1alpha1 "example.com/monok8s/pkg/apis/monok8s/v1alpha1"
|
||||
)
|
||||
|
||||
func EngageControlGate(ctx context.Context, nctx *NodeContext) error {
|
||||
gateFile := filepath.Join(monov1alpha1.EnvConfigDir, ".control-gate")
|
||||
|
||||
f, err := os.OpenFile(gateFile, os.O_CREATE|os.O_WRONLY, 0o644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("touch %s: %w", gateFile, err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReleaseControlGate(ctx context.Context, nctx *NodeContext) error {
|
||||
gateFile := filepath.Join(monov1alpha1.EnvConfigDir, ".control-gate")
|
||||
|
||||
if err := os.Remove(gateFile); err != nil {
|
||||
return fmt.Errorf("relate control gate: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user