Adding initial version of Kubernetes backend (#552)

Co-authored-by: laszlocph <laszlo@laszlo.cloud>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Rynoxx <rynoxx@grid-servers.net>
This commit is contained in:
Anbraten
2022-09-05 06:01:14 +02:00
committed by GitHub
parent 7778f7dc64
commit 3b0263442a
18 changed files with 1084 additions and 206 deletions

View File

@@ -35,6 +35,7 @@ import (
"github.com/woodpecker-ci/woodpecker/agent"
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
"github.com/woodpecker-ci/woodpecker/pipeline/backend/types"
"github.com/woodpecker-ci/woodpecker/pipeline/rpc"
"github.com/woodpecker-ci/woodpecker/shared/utils"
"github.com/woodpecker-ci/woodpecker/version"
@@ -134,6 +135,8 @@ func loop(c *cli.Context) error {
sigterm.Set()
})
backend.Init(context.WithValue(ctx, types.CliContext, c))
var wg sync.WaitGroup
parallel := c.Int("max-procs")
wg.Add(parallel)

View File

@@ -106,4 +106,32 @@ var flags = []cli.Flag{
Usage: "backend engine to run pipelines on",
Value: "auto-detect",
},
// TODO: add flags of backends
// backend k8s
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_K8S_NAMESPACE"},
Name: "backend-k8s-namespace",
Usage: "backend k8s namespace",
Value: "woodpecker",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_K8S_VOLUME_SIZE"},
Name: "backend-k8s-volume-size",
Usage: "backend k8s volume size (default 10G)",
Value: "10G",
},
&cli.StringFlag{
EnvVars: []string{"WOODPECKER_BACKEND_K8S_STORAGE_CLASS"},
Name: "backend-k8s-storage-class",
Usage: "backend k8s storage class",
Value: "",
},
&cli.BoolFlag{
EnvVars: []string{"WOODPECKER_BACKEND_K8S_STORAGE_RWX"},
Name: "backend-k8s-storage-rwx",
Usage: "backend k8s storage access mode, should ReadWriteMany (RWX) instead of ReadWriteOnce (RWO) be used? (default: true)",
Value: true,
},
}