Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e4d34958e | ||
|
|
9d6ee7f9b0 | ||
|
|
aa16e75b39 | ||
|
|
283a00bde2 | ||
|
|
0c78359832 | ||
|
|
ac7cefde39 | ||
|
|
4f7f81bfb0 | ||
|
|
64154cae38 | ||
|
|
1689a73809 | ||
|
|
e20ef0cfb8 | ||
|
|
e6dec7aa46 | ||
|
|
efae5f6ae2 | ||
|
|
988958f131 | ||
|
|
13844e10f8 | ||
|
|
87917e618c | ||
|
|
a2cde72347 | ||
|
|
b84b80742c | ||
|
|
dcab568ea7 | ||
|
|
4fdf9a1190 | ||
|
|
6c7bfe6514 | ||
|
|
419fa59923 | ||
|
|
73fe08cd81 | ||
|
|
b79c228890 | ||
|
|
d88146459a | ||
|
|
2e1e4e4e80 | ||
|
|
6f7c026e4c | ||
|
|
a6aa0f14c1 | ||
|
|
2377959628 | ||
|
|
e91ce7ebbb | ||
|
|
87416b1fee | ||
|
|
dd0b791d9d | ||
|
|
c31af8bb8c | ||
|
|
9b6d14c752 | ||
|
|
aa60ff9dd0 | ||
|
|
804e3b04ad | ||
|
|
bfedc14497 | ||
|
|
ff7c305345 | ||
|
|
2a6a6cab24 | ||
|
|
982ff0da5e | ||
|
|
63582de380 | ||
|
|
d8840cc810 | ||
|
|
27489d9a3d | ||
|
|
7bd6d73663 | ||
|
|
54dfcbd378 | ||
|
|
445c0be5b1 | ||
|
|
373d576e54 | ||
|
|
b19852a75a | ||
|
|
a0e4a62278 | ||
|
|
7ca7c8278b |
@@ -94,7 +94,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-ppc64le"
|
||||
use_buildx: true
|
||||
@@ -105,7 +105,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/ppc64le"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-s390x"
|
||||
use_buildx: true
|
||||
@@ -116,7 +116,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/s390x"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-arm64"
|
||||
use_buildx: true
|
||||
@@ -128,7 +128,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/arm64"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-amd64"
|
||||
use_buildx: true
|
||||
@@ -139,7 +139,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-ppc64le"
|
||||
use_buildx: true
|
||||
@@ -150,7 +150,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/ppc64le"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-s390x"
|
||||
use_buildx: true
|
||||
@@ -161,7 +161,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/s390x"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-arm64"
|
||||
use_buildx: true
|
||||
@@ -173,7 +173,7 @@ dockers:
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/arm64"
|
||||
- "--build-arg=RELEASE={{ .Tag }}"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
docker_manifests:
|
||||
- name_template: minio/console:{{ .Tag }}
|
||||
image_templates:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
|
||||
|
||||
ARG RELEASE
|
||||
ARG TAG
|
||||
|
||||
COPY CREDITS /licenses/CREDITS
|
||||
COPY LICENSE /licenses/LICENSE
|
||||
@@ -8,8 +8,8 @@ COPY LICENSE /licenses/LICENSE
|
||||
LABEL name="MinIO" \
|
||||
vendor="MinIO Inc <dev@min.io>" \
|
||||
maintainer="MinIO Inc <dev@min.io>" \
|
||||
version="${RELEASE}" \
|
||||
release="${RELEASE}" \
|
||||
version="${TAG}" \
|
||||
release="${TAG}" \
|
||||
summary="A graphical user interface for MinIO" \
|
||||
description="MinIO object storage is fundamentally different. Designed for performance and the S3 API, it is 100% open-source. MinIO is ideal for large, private cloud environments with stringent security requirements and delivers mission-critical availability across a diverse range of workloads."
|
||||
|
||||
|
||||
17
Makefile
17
Makefile
@@ -43,11 +43,22 @@ install: console
|
||||
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/console $(GOPATH)/bin/console
|
||||
@echo "Installation successful. To learn more, try \"console --help\"."
|
||||
|
||||
swagger-gen:
|
||||
@echo "Generating swagger server code from yaml"
|
||||
swagger-gen: clean-swagger swagger-console swagger-operator
|
||||
@echo "Done Generating swagger server code from yaml"
|
||||
|
||||
clean-swagger:
|
||||
@echo "cleaning"
|
||||
@rm -rf models
|
||||
@rm -rf restapi/operations
|
||||
@swagger generate server -A console --main-package=console --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
|
||||
@rm -rf operatorapi/operations
|
||||
|
||||
swagger-console:
|
||||
@echo "Generating swagger server code from yaml"
|
||||
@swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger-console.yml -r NOTICE
|
||||
|
||||
swagger-operator:
|
||||
@echo "Generating swagger server code from yaml"
|
||||
@swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE
|
||||
|
||||
assets:
|
||||
@(cd portal-ui; yarn install; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
|
||||
@@ -53,6 +53,7 @@ VERSION:
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
operatorCmd,
|
||||
}
|
||||
|
||||
func newApp(name string) *cli.App {
|
||||
|
||||
246
cmd/console/operator.go
Normal file
246
cmd/console/operator.go
Normal file
@@ -0,0 +1,246 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/restapi"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/operatorapi"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/pkg/certs"
|
||||
)
|
||||
|
||||
// starts the server
|
||||
var operatorCmd = cli.Command{
|
||||
Name: "operator",
|
||||
Aliases: []string{"opr"},
|
||||
Usage: "Start MinIO Operator UI server",
|
||||
Action: startOperatorServer,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "host",
|
||||
Value: restapi.GetHostname(),
|
||||
Usage: "bind to a specific HOST, HOST can be an IP or hostname",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "port",
|
||||
Value: restapi.GetPort(),
|
||||
Usage: "bind to specific HTTP port",
|
||||
},
|
||||
// This is kept here for backward compatibility,
|
||||
// hostname's do not have HTTP or HTTPs
|
||||
// hostnames are opaque so using --host
|
||||
// works for both HTTP and HTTPS setup.
|
||||
cli.StringFlag{
|
||||
Name: "tls-host",
|
||||
Value: restapi.GetHostname(),
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "certs-dir",
|
||||
Value: certs.GlobalCertsCADir.Get(),
|
||||
Usage: "path to certs directory",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "tls-port",
|
||||
Value: restapi.GetTLSPort(),
|
||||
Usage: "bind to specific HTTPS port",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-redirect",
|
||||
Value: restapi.GetTLSRedirect(),
|
||||
Usage: "toggle HTTP->HTTPS redirect",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-certificate",
|
||||
Value: "",
|
||||
Usage: "path to TLS public certificate",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-key",
|
||||
Value: "",
|
||||
Usage: "path to TLS private key",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-ca",
|
||||
Value: "",
|
||||
Usage: "path to TLS Certificate Authority",
|
||||
Hidden: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func buildOperatorServer() (*operatorapi.Server, error) {
|
||||
swaggerSpec, err := loads.Embedded(operatorapi.SwaggerJSON, operatorapi.FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
api := operations.NewOperatorAPI(swaggerSpec)
|
||||
api.Logger = operatorapi.LogInfo
|
||||
server := operatorapi.NewServer(api)
|
||||
|
||||
parser := flags.NewParser(server, flags.Default)
|
||||
parser.ShortDescription = "MinIO Console Server"
|
||||
parser.LongDescription = swaggerSpec.Spec().Info.Description
|
||||
|
||||
server.ConfigureFlags()
|
||||
|
||||
// register all APIs
|
||||
server.ConfigureAPI()
|
||||
|
||||
for _, optsGroup := range api.CommandLineOptionsGroups {
|
||||
_, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := parser.Parse(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
func loadOperatorAllCerts(ctx *cli.Context) error {
|
||||
var err error
|
||||
// Set all certs and CAs directories path
|
||||
certs.GlobalCertsDir, _, err = certs.NewConfigDirFromCtx(ctx, "certs-dir", certs.DefaultCertsDir.Get)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
certs.GlobalCertsCADir = &certs.ConfigDir{Path: filepath.Join(certs.GlobalCertsDir.Get(), certs.CertsCADir)}
|
||||
// check if certs and CAs directories exists or can be created
|
||||
if err = certs.MkdirAllIgnorePerm(certs.GlobalCertsCADir.Get()); err != nil {
|
||||
return fmt.Errorf("unable to create certs CA directory at %s: failed with %w", certs.GlobalCertsCADir.Get(), err)
|
||||
}
|
||||
|
||||
// load the certificates and the CAs
|
||||
operatorapi.GlobalRootCAs, operatorapi.GlobalPublicCerts, operatorapi.GlobalTLSCertsManager, err = certs.GetAllCertificatesAndCAs()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to load certificates at %s: failed with %w", certs.GlobalCertsDir.Get(), err)
|
||||
}
|
||||
|
||||
{
|
||||
// TLS flags from swagger server, used to support VMware vsphere operator version.
|
||||
swaggerServerCertificate := ctx.String("tls-certificate")
|
||||
swaggerServerCertificateKey := ctx.String("tls-key")
|
||||
swaggerServerCACertificate := ctx.String("tls-ca")
|
||||
// load tls cert and key from swagger server tls-certificate and tls-key flags
|
||||
if swaggerServerCertificate != "" && swaggerServerCertificateKey != "" {
|
||||
if err = operatorapi.GlobalTLSCertsManager.AddCertificate(swaggerServerCertificate, swaggerServerCertificateKey); err != nil {
|
||||
return err
|
||||
}
|
||||
x509Certs, err := certs.ParsePublicCertFile(swaggerServerCertificate)
|
||||
if err == nil {
|
||||
operatorapi.GlobalPublicCerts = append(operatorapi.GlobalPublicCerts, x509Certs...)
|
||||
}
|
||||
}
|
||||
|
||||
// load ca cert from swagger server tls-ca flag
|
||||
if swaggerServerCACertificate != "" {
|
||||
caCert, caCertErr := ioutil.ReadFile(swaggerServerCACertificate)
|
||||
if caCertErr == nil {
|
||||
operatorapi.GlobalRootCAs.AppendCertsFromPEM(caCert)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func startOperatorServer(ctx *cli.Context) error {
|
||||
if err := loadOperatorAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
operatorapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx operatorapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
operatorapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildOperatorServer()
|
||||
if err != nil {
|
||||
operatorapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
operatorapi.Port = strconv.Itoa(server.Port)
|
||||
operatorapi.Hostname = server.Host
|
||||
|
||||
if len(operatorapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
operatorapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
operatorapi.Hostname = rctx.Host
|
||||
operatorapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
// subnet license refresh process
|
||||
go func() {
|
||||
// start refreshing subnet license after 5 seconds..
|
||||
time.Sleep(time.Second * 5)
|
||||
|
||||
failedAttempts := 0
|
||||
for {
|
||||
if err := operatorapi.RefreshLicense(); err != nil {
|
||||
operatorapi.LogError("Refreshing subnet license failed: %v", err)
|
||||
failedAttempts++
|
||||
// end license refresh after 3 consecutive failed attempts
|
||||
if failedAttempts >= 3 {
|
||||
return
|
||||
}
|
||||
// wait 5 minutes and retry again
|
||||
time.Sleep(time.Minute * 5)
|
||||
continue
|
||||
}
|
||||
// if license refreshed successfully reset the counter
|
||||
failedAttempts = 0
|
||||
// try to refresh license every 24 hrs
|
||||
time.Sleep(time.Hour * 24)
|
||||
}
|
||||
}()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -156,7 +157,8 @@ func loadAllCerts(ctx *cli.Context) error {
|
||||
if err = restapi.GlobalTLSCertsManager.AddCertificate(swaggerServerCertificate, swaggerServerCertificateKey); err != nil {
|
||||
return err
|
||||
}
|
||||
if x509Certs, err := certs.ParsePublicCertFile(swaggerServerCertificate); err == nil {
|
||||
x509Certs, err := certs.ParsePublicCertFile(swaggerServerCertificate)
|
||||
if err == nil {
|
||||
restapi.GlobalPublicCerts = append(restapi.GlobalPublicCerts, x509Certs...)
|
||||
}
|
||||
}
|
||||
@@ -175,6 +177,10 @@ func loadAllCerts(ctx *cli.Context) error {
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
|
||||
return startOperatorServer(ctx)
|
||||
}
|
||||
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
@@ -194,6 +200,10 @@ func StartServer(ctx *cli.Context) error {
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
restapi.Port = strconv.Itoa(server.Port)
|
||||
restapi.Hostname = server.Host
|
||||
|
||||
@@ -210,30 +220,5 @@ func StartServer(ctx *cli.Context) error {
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
// subnet license refresh process
|
||||
go func() {
|
||||
// start refreshing subnet license after 5 seconds..
|
||||
time.Sleep(time.Second * 5)
|
||||
|
||||
failedAttempts := 0
|
||||
for {
|
||||
if err := restapi.RefreshLicense(); err != nil {
|
||||
restapi.LogError("Refreshing subnet license failed: %v", err)
|
||||
failedAttempts++
|
||||
// end license refresh after 3 consecutive failed attempts
|
||||
if failedAttempts >= 3 {
|
||||
return
|
||||
}
|
||||
// wait 5 minutes and retry again
|
||||
time.Sleep(time.Minute * 5)
|
||||
continue
|
||||
}
|
||||
// if license refreshed successfully reset the counter
|
||||
failedAttempts = 0
|
||||
// try to refresh license every 24 hrs
|
||||
time.Sleep(time.Hour * 24)
|
||||
}
|
||||
}()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
|
||||
61
compose/.env
61
compose/.env
@@ -1,61 +0,0 @@
|
||||
## PostgreSQL related variables
|
||||
|
||||
# Postgres Docker image
|
||||
POSTGRES_IMAGE=library/postgres
|
||||
|
||||
# Postgres user
|
||||
POSTGRES_USER=postgres
|
||||
|
||||
# Postgres password
|
||||
POSTGRES_PASSWORD=magical_password
|
||||
|
||||
# Postgres port number
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
# Postgres data directory
|
||||
PGDATA=/data/postgres
|
||||
|
||||
|
||||
## Logsearch related variables
|
||||
|
||||
# Logsearch Docker image
|
||||
LOGSEARCH_IMAGE=minio/logsearchapi:v4.0.2
|
||||
|
||||
# Logsearch storage max
|
||||
LOGSEARCH_DISK_CAPACITY_GB=5
|
||||
|
||||
# Logsearch port number
|
||||
LOGSEARCH_PORT=8080
|
||||
|
||||
# Log retention duration
|
||||
LOGSEARCH_MAX_RETENTION_MONTHS=1
|
||||
|
||||
# Logsearch audit authentication token
|
||||
LOGSEARCH_AUDIT_AUTH_TOKEN=c6rkqjZ03ElEUKQ7MtSeYBJ8q_p3GDFPBQAQJlcbBLA=
|
||||
|
||||
# Logsearch query authentication token
|
||||
LOGSEARCH_QUERY_AUTH_TOKEN=c6rkqjZ03ElEUKQ7MtSeYBJ8q_p3GDFPBQAQJlcbBLA=
|
||||
|
||||
|
||||
## Console related variables
|
||||
|
||||
# Console Docker image
|
||||
CONSOLE_IMAGE=minio/console:v0.6.2
|
||||
|
||||
# Salt to encrypt JWT payload
|
||||
CONSOLE_PBKDF_PASSPHRASE=top_secret
|
||||
|
||||
# Required to encrypt JWT payload
|
||||
CONSOLE_PBKDF_SALT=top_secret1
|
||||
|
||||
# MinIO Server URL
|
||||
CONSOLE_MINIO_SERVER=http://localhost:9000
|
||||
|
||||
|
||||
## Prometheus related variables
|
||||
|
||||
# Prometheus Docker image
|
||||
PROMETHEUS_IMAGE=prom/prometheus:latest
|
||||
|
||||
# Prometheus port number
|
||||
PROMETHEUS_PORT=9999
|
||||
@@ -1,64 +0,0 @@
|
||||
|
||||
## Console Docker Compose
|
||||
|
||||
This compose file allows users to quickly deploy MinIO Console, LogSearch & Prometheus in a baremetal (non Kubernetes) environment.
|
||||
|
||||
### Pre-requisites
|
||||
|
||||
1. [MinIO](https://docs.minio.io/docs/distributed-minio-quickstart-guide.html) cluster up and running.
|
||||
2. [mc](https://docs.minio.io/docs/minio-client-quickstart-guide.html) configured for this MinIO cluster.
|
||||
3. [Docker-Compose](https://docs.docker.com/compose/) installed on the server.
|
||||
|
||||
### Getting Started
|
||||
|
||||
- Download the contents of `compose` directory on your machine.
|
||||
|
||||
- Edit the `prometheus.yaml` file and fill in the correct target (MinIO Endpoint). Optionally setup the `bearer_token` as explained [here](https://github.com/minio/minio/tree/master/docs/metrics/prometheus#31-authenticated-prometheus-config).
|
||||
|
||||
- Setup a console admin policy.
|
||||
|
||||
```sh
|
||||
cat > admin.json << EOF
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [{
|
||||
"Action": [
|
||||
"admin:*"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"s3:*"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
],
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
Then create this policy on MinIO server: `mc admin policy add myminio consoleAdmin admin.json`.
|
||||
|
||||
- Setup user and policy for Console
|
||||
|
||||
```
|
||||
mc admin user add myminio console console123
|
||||
mc admin policy set myminio consoleAdmin user=console
|
||||
```
|
||||
|
||||
- Configure Webhook target on the MinIO server. Remember to change the `token` value in below URL to the actual token value as set in the `.env` file.
|
||||
|
||||
```
|
||||
mc admin config set myminio audit_webhook:1 endpoint=http://localhost:8080/api/ingest?token=c6rkqjZ03ElEUKQ7MtSeYBJ8q_p3GDFPBQAQJlcbBLA=
|
||||
mc admin service restart myminio
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
To configure the Console Compose file to custom setup, please take a look at the [`.env`](./.env) file.
|
||||
@@ -1,62 +0,0 @@
|
||||
version: '3.4'
|
||||
services:
|
||||
pg_database:
|
||||
image: ${POSTGRES_IMAGE}
|
||||
network_mode: host
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- PGDATA=${PGDATA}
|
||||
- POSTGRES_DB=minio_logs
|
||||
volumes:
|
||||
- database:${PGDATA}
|
||||
ports:
|
||||
- ${POSTGRES_PORT}:${POSTGRES_PORT}
|
||||
|
||||
log_search:
|
||||
image: ${LOGSEARCH_IMAGE}
|
||||
network_mode: host
|
||||
environment:
|
||||
- LOGSEARCH_AUDIT_AUTH_TOKEN=${LOGSEARCH_AUDIT_AUTH_TOKEN}
|
||||
- LOGSEARCH_QUERY_AUTH_TOKEN=${LOGSEARCH_QUERY_AUTH_TOKEN}
|
||||
- LOGSEARCH_DISK_CAPACITY_GB=${LOGSEARCH_DISK_CAPACITY_GB}
|
||||
- LOGSEARCH_MAX_RETENTION_MONTHS=${LOGSEARCH_MAX_RETENTION_MONTHS}
|
||||
- LOGSEARCH_PG_CONN_STR=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/minio_logs?sslmode=disable
|
||||
ports:
|
||||
- ${LOGSEARCH_PORT}:${LOGSEARCH_PORT}
|
||||
command: ["/usr/bin/wait-for-it.sh", "localhost:${POSTGRES_PORT}", "--", "/logsearchapi"]
|
||||
volumes:
|
||||
- ./wait-for-it.sh:/usr/bin/wait-for-it.sh
|
||||
depends_on:
|
||||
- pg_database
|
||||
|
||||
console:
|
||||
image: ${CONSOLE_IMAGE}
|
||||
network_mode: host
|
||||
environment:
|
||||
- CONSOLE_PBKDF_PASSPHRASE=${CONSOLE_PBKDF_PASSPHRASE}
|
||||
- CONSOLE_PBKDF_SALT=${CONSOLE_PBKDF_SALT}
|
||||
- LOGSEARCH_QUERY_AUTH_TOKEN=${LOGSEARCH_QUERY_AUTH_TOKEN}
|
||||
- CONSOLE_MINIO_SERVER=${CONSOLE_MINIO_SERVER}
|
||||
- CONSOLE_LOG_QUERY_URL=http://localhost:${LOGSEARCH_PORT}
|
||||
- CONSOLE_PROMETHEUS_URL=http://localhost:${PROMETHEUS_PORT}
|
||||
ports:
|
||||
- "9090:9090"
|
||||
command: server
|
||||
depends_on:
|
||||
- log_search
|
||||
- prometheus
|
||||
|
||||
prometheus:
|
||||
image: ${PROMETHEUS_IMAGE}
|
||||
network_mode: host
|
||||
ports:
|
||||
- ${PROMETHEUS_PORT}:${PROMETHEUS_PORT}
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --web.listen-address=:${PROMETHEUS_PORT}
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
|
||||
volumes:
|
||||
database:
|
||||
@@ -1,15 +0,0 @@
|
||||
global:
|
||||
scrape_interval: 10s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
evaluation_interval: 30s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
# Here it's Prometheus itself.
|
||||
scrape_configs:
|
||||
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||
- job_name: minio-node1
|
||||
metrics_path: /minio/v2/metrics/cluster
|
||||
scheme: http
|
||||
static_configs:
|
||||
- targets:
|
||||
- 'localhost:9000'
|
||||
@@ -1,182 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Use this script to test if a given TCP host/port are available
|
||||
|
||||
WAITFORIT_cmdname=${0##*/}
|
||||
|
||||
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
|
||||
-h HOST | --host=HOST Host or IP under test
|
||||
-p PORT | --port=PORT TCP port under test
|
||||
Alternatively, you specify the host and port as host:port
|
||||
-s | --strict Only execute subcommand if the test succeeds
|
||||
-q | --quiet Don't output any status messages
|
||||
-t TIMEOUT | --timeout=TIMEOUT
|
||||
Timeout in seconds, zero for no timeout
|
||||
-- COMMAND ARGS Execute command with args after the test finishes
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
wait_for()
|
||||
{
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
else
|
||||
echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
|
||||
fi
|
||||
WAITFORIT_start_ts=$(date +%s)
|
||||
while :
|
||||
do
|
||||
if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
|
||||
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
|
||||
WAITFORIT_result=$?
|
||||
else
|
||||
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
|
||||
WAITFORIT_result=$?
|
||||
fi
|
||||
if [[ $WAITFORIT_result -eq 0 ]]; then
|
||||
WAITFORIT_end_ts=$(date +%s)
|
||||
echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
return $WAITFORIT_result
|
||||
}
|
||||
|
||||
wait_for_wrapper()
|
||||
{
|
||||
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
|
||||
if [[ $WAITFORIT_QUIET -eq 1 ]]; then
|
||||
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
|
||||
else
|
||||
timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
|
||||
fi
|
||||
WAITFORIT_PID=$!
|
||||
trap "kill -INT -$WAITFORIT_PID" INT
|
||||
wait $WAITFORIT_PID
|
||||
WAITFORIT_RESULT=$?
|
||||
if [[ $WAITFORIT_RESULT -ne 0 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
|
||||
fi
|
||||
return $WAITFORIT_RESULT
|
||||
}
|
||||
|
||||
# process arguments
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
*:* )
|
||||
WAITFORIT_hostport=(${1//:/ })
|
||||
WAITFORIT_HOST=${WAITFORIT_hostport[0]}
|
||||
WAITFORIT_PORT=${WAITFORIT_hostport[1]}
|
||||
shift 1
|
||||
;;
|
||||
--child)
|
||||
WAITFORIT_CHILD=1
|
||||
shift 1
|
||||
;;
|
||||
-q | --quiet)
|
||||
WAITFORIT_QUIET=1
|
||||
shift 1
|
||||
;;
|
||||
-s | --strict)
|
||||
WAITFORIT_STRICT=1
|
||||
shift 1
|
||||
;;
|
||||
-h)
|
||||
WAITFORIT_HOST="$2"
|
||||
if [[ $WAITFORIT_HOST == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--host=*)
|
||||
WAITFORIT_HOST="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
-p)
|
||||
WAITFORIT_PORT="$2"
|
||||
if [[ $WAITFORIT_PORT == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--port=*)
|
||||
WAITFORIT_PORT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
-t)
|
||||
WAITFORIT_TIMEOUT="$2"
|
||||
if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--timeout=*)
|
||||
WAITFORIT_TIMEOUT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
WAITFORIT_CLI=("$@")
|
||||
break
|
||||
;;
|
||||
--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echoerr "Unknown argument: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
|
||||
echoerr "Error: you need to provide a host and port to test."
|
||||
usage
|
||||
fi
|
||||
|
||||
WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15}
|
||||
WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
|
||||
WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
|
||||
WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
|
||||
|
||||
# Check to see if timeout is from busybox?
|
||||
WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
|
||||
WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
|
||||
|
||||
WAITFORIT_BUSYTIMEFLAG=""
|
||||
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
|
||||
WAITFORIT_ISBUSY=1
|
||||
# Check if busybox timeout uses -t flag
|
||||
# (recent Alpine versions don't support -t anymore)
|
||||
if timeout &>/dev/stdout | grep -q -e '-t '; then
|
||||
WAITFORIT_BUSYTIMEFLAG="-t"
|
||||
fi
|
||||
else
|
||||
WAITFORIT_ISBUSY=0
|
||||
fi
|
||||
|
||||
if [[ $WAITFORIT_CHILD -gt 0 ]]; then
|
||||
wait_for
|
||||
WAITFORIT_RESULT=$?
|
||||
exit $WAITFORIT_RESULT
|
||||
else
|
||||
if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
|
||||
wait_for_wrapper
|
||||
WAITFORIT_RESULT=$?
|
||||
else
|
||||
wait_for
|
||||
WAITFORIT_RESULT=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $WAITFORIT_CLI != "" ]]; then
|
||||
if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
|
||||
echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
|
||||
exit $WAITFORIT_RESULT
|
||||
fi
|
||||
exec "${WAITFORIT_CLI[@]}"
|
||||
else
|
||||
exit $WAITFORIT_RESULT
|
||||
fi
|
||||
5
go.mod
5
go.mod
@@ -6,6 +6,7 @@ require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
github.com/cheggaaa/pb/v3 v3.0.6
|
||||
github.com/coreos/go-oidc v2.2.1+incompatible
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/go-openapi/errors v0.19.9
|
||||
github.com/go-openapi/loads v0.20.2
|
||||
github.com/go-openapi/runtime v0.19.24
|
||||
@@ -18,9 +19,9 @@ require (
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf
|
||||
github.com/minio/kes v0.11.0
|
||||
github.com/minio/madmin-go v1.0.12
|
||||
github.com/minio/madmin-go v1.0.17
|
||||
github.com/minio/mc v0.0.0-20210626002108-cebf3318546f
|
||||
github.com/minio/minio-go/v7 v7.0.12-0.20210617160455-b7103728fb87
|
||||
github.com/minio/minio-go/v7 v7.0.13-0.20210715203016-9e713532886e
|
||||
github.com/minio/operator v0.0.0-20210616045941-65f31f5f78ae
|
||||
github.com/minio/operator/logsearchapi v0.0.0-20210604224119-7e256f98cf90
|
||||
github.com/minio/pkg v1.0.8
|
||||
|
||||
13
go.sum
13
go.sum
@@ -877,8 +877,9 @@ github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEX
|
||||
github.com/minio/kes v0.11.0 h1:8ma6OCVSxKT50b1uYXLJro3m7PmZtCLxBaTddQexI5k=
|
||||
github.com/minio/kes v0.11.0/go.mod h1:mTF1Bv8YVEtQqF/B7Felp4tLee44Pp+dgI0rhCvgNg8=
|
||||
github.com/minio/madmin-go v1.0.6/go.mod h1:BK+z4XRx7Y1v8SFWXsuLNqQqnq5BO/axJ8IDJfgyvfs=
|
||||
github.com/minio/madmin-go v1.0.12 h1:5FjqXgPR6rK6QX+HS88u+FCAiFLKleAiMuRvdDhWNPc=
|
||||
github.com/minio/madmin-go v1.0.12/go.mod h1:BK+z4XRx7Y1v8SFWXsuLNqQqnq5BO/axJ8IDJfgyvfs=
|
||||
github.com/minio/madmin-go v1.0.17 h1:VMEn4nMKf0X3uNH0u+fZcn17KSwVkQGwyER/igG556E=
|
||||
github.com/minio/madmin-go v1.0.17/go.mod h1:4nl9hvLWFnwCjkLfZSsZXEHgDODa2XSG6xGlIZyQ2oA=
|
||||
github.com/minio/mc v0.0.0-20210626002108-cebf3318546f h1:hyFvo5hSFw2K417YvDr/vAKlgCG69uTuhZW/5LNdL0U=
|
||||
github.com/minio/mc v0.0.0-20210626002108-cebf3318546f/go.mod h1:tuaonkPjVApCXkbtKENHBtsqUf7YTV33qmFrC+Pgp5g=
|
||||
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
|
||||
@@ -886,8 +887,8 @@ github.com/minio/md5-simd v1.1.1 h1:9ojcLbuZ4gXbB2sX53MKn8JUZ0sB/2wfwsEcRw+I08U=
|
||||
github.com/minio/md5-simd v1.1.1/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
|
||||
github.com/minio/minio-go/v7 v7.0.11-0.20210302210017-6ae69c73ce78/go.mod h1:mTh2uJuAbEqdhMVl6CMIIZLUeiMiWtJR4JB8/5g2skw=
|
||||
github.com/minio/minio-go/v7 v7.0.11-0.20210607181445-e162fdb8e584/go.mod h1:WoyW+ySKAKjY98B9+7ZbI8z8S3jaxaisdcvj9TGlazA=
|
||||
github.com/minio/minio-go/v7 v7.0.12-0.20210617160455-b7103728fb87 h1:BnFzAooBfXMLroRcXEot1tHNa2s7Sa5avBcIG2q85+8=
|
||||
github.com/minio/minio-go/v7 v7.0.12-0.20210617160455-b7103728fb87/go.mod h1:S23iSP5/gbMwtxeY5FM71R+TkAYyzEdoNEDDwpt8yWs=
|
||||
github.com/minio/minio-go/v7 v7.0.13-0.20210715203016-9e713532886e h1:aVnxKPpUI1gVeEf9vC+QEt8OxMXiiNMeUWcrBM62oDU=
|
||||
github.com/minio/minio-go/v7 v7.0.13-0.20210715203016-9e713532886e/go.mod h1:S23iSP5/gbMwtxeY5FM71R+TkAYyzEdoNEDDwpt8yWs=
|
||||
github.com/minio/operator v0.0.0-20210616045941-65f31f5f78ae h1:GONmqbjCi/KTEc1CGujnS/m1qeJeghcQ8dUBLh19qQo=
|
||||
github.com/minio/operator v0.0.0-20210616045941-65f31f5f78ae/go.mod h1:8/mIXK+CFdL6VqyxRn1SwD+PEX0jsN8uqjoadaw/Np0=
|
||||
github.com/minio/operator/logsearchapi v0.0.0-20210604224119-7e256f98cf90 h1:Qu6j6oE7+QNuq7Kr2DLyVYq3fqMdqFd/T8NAeNp47og=
|
||||
@@ -1103,8 +1104,9 @@ github.com/securego/gosec/v2 v2.3.0/go.mod h1:UzeVyUXbxukhLeHKV3VVqo7HdoQR9MrRfF
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada h1:WokF3GuxBeL+n4Lk4Fa8v9mbdjlrl7bHuneF4N1bk2I=
|
||||
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
|
||||
github.com/shirou/gopsutil/v3 v3.21.4 h1:XB/+p+kVnyYLuPHCfa99lxz2aJyvVhnyd+FxZqH/k7M=
|
||||
github.com/shirou/gopsutil/v3 v3.21.4/go.mod h1:ghfMypLDrFSWN2c9cDYFLHyynQ+QUht0cv/18ZqVczw=
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 h1:vU7jrp1Ic/2sHB7w6UNs7MIkn7ebVtTb5D9j45o9VYE=
|
||||
github.com/shirou/gopsutil/v3 v3.21.6/go.mod h1:JfVbDpIBLVzT8oKbvMg9P3wEIMDDpVn+LwHTKj0ST88=
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
@@ -1190,8 +1192,9 @@ github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eN
|
||||
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
|
||||
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
|
||||
github.com/tklauser/go-sysconf v0.3.4/go.mod h1:Cl2c8ZRWfHD5IrfHo9VN+FX9kCFjIOyVklgXycLB6ek=
|
||||
github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4=
|
||||
github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
|
||||
github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4=
|
||||
github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
|
||||
github.com/tklauser/numcpus v0.2.1/go.mod h1:9aU+wOc6WjUIZEwWMP62PL/41d65P+iks1gBkr4QyP8=
|
||||
github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA=
|
||||
github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM=
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.7.5
|
||||
image: minio/console:v0.8.2
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
args:
|
||||
- server
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.7.5
|
||||
image: minio/console:v0.8.2
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_OPERATOR_MODE
|
||||
|
||||
@@ -55,6 +55,9 @@ type BucketObject struct {
|
||||
// legal hold status
|
||||
LegalHoldStatus string `json:"legal_hold_status,omitempty"`
|
||||
|
||||
// metadata
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
@@ -70,6 +73,9 @@ type BucketObject struct {
|
||||
// tags
|
||||
Tags map[string]string `json:"tags,omitempty"`
|
||||
|
||||
// user metadata
|
||||
UserMetadata map[string]string `json:"user_metadata,omitempty"`
|
||||
|
||||
// user tags
|
||||
UserTags map[string]string `json:"user_tags,omitempty"`
|
||||
|
||||
|
||||
73
models/delete_file.go
Normal file
73
models/delete_file.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// DeleteFile delete file
|
||||
//
|
||||
// swagger:model deleteFile
|
||||
type DeleteFile struct {
|
||||
|
||||
// path
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// recursive
|
||||
Recursive bool `json:"recursive,omitempty"`
|
||||
|
||||
// version ID
|
||||
VersionID string `json:"versionID,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this delete file
|
||||
func (m *DeleteFile) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this delete file based on context it is used
|
||||
func (m *DeleteFile) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DeleteFile) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DeleteFile) UnmarshalBinary(b []byte) error {
|
||||
var res DeleteFile
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -39,6 +39,10 @@ type Error struct {
|
||||
// code
|
||||
Code int32 `json:"code,omitempty"`
|
||||
|
||||
// detailed message
|
||||
// Required: true
|
||||
DetailedMessage *string `json:"detailedMessage"`
|
||||
|
||||
// message
|
||||
// Required: true
|
||||
Message *string `json:"message"`
|
||||
@@ -48,6 +52,10 @@ type Error struct {
|
||||
func (m *Error) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateDetailedMessage(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMessage(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -58,6 +66,15 @@ func (m *Error) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Error) validateDetailedMessage(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("detailedMessage", "body", m.DetailedMessage); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Error) validateMessage(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("message", "body", m.Message); err != nil {
|
||||
|
||||
@@ -39,7 +39,7 @@ type ListBucketsResponse struct {
|
||||
// list of resulting buckets
|
||||
Buckets []*Bucket `json:"buckets"`
|
||||
|
||||
// number of buckets accessible to tenant user
|
||||
// number of buckets accessible to the user
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
128
models/operator_session_response.go
Normal file
128
models/operator_session_response.go
Normal file
@@ -0,0 +1,128 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// OperatorSessionResponse operator session response
|
||||
//
|
||||
// swagger:model operatorSessionResponse
|
||||
type OperatorSessionResponse struct {
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
// operator
|
||||
Operator bool `json:"operator,omitempty"`
|
||||
|
||||
// pages
|
||||
Pages []string `json:"pages"`
|
||||
|
||||
// status
|
||||
// Enum: [ok]
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator session response
|
||||
func (m *OperatorSessionResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateStatus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var operatorSessionResponseTypeStatusPropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["ok"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
operatorSessionResponseTypeStatusPropEnum = append(operatorSessionResponseTypeStatusPropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// OperatorSessionResponseStatusOk captures enum value "ok"
|
||||
OperatorSessionResponseStatusOk string = "ok"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *OperatorSessionResponse) validateStatusEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, operatorSessionResponseTypeStatusPropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSessionResponse) validateStatus(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Status) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateStatusEnum("status", "body", m.Status); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator session response based on context it is used
|
||||
func (m *OperatorSessionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSessionResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSessionResponse) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSessionResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -52,6 +52,9 @@ type PvcsListResponse struct {
|
||||
// storage class
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
|
||||
// tenant
|
||||
Tenant string `json:"tenant,omitempty"`
|
||||
|
||||
// volume
|
||||
Volume string `json:"volume,omitempty"`
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ import (
|
||||
// swagger:model sessionResponse
|
||||
type SessionResponse struct {
|
||||
|
||||
// distributed mode
|
||||
DistributedMode bool `json:"distributedMode,omitempty"`
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
|
||||
76
operatorapi/config.go
Normal file
76
operatorapi/config.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"crypto/x509"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
xcerts "github.com/minio/pkg/certs"
|
||||
|
||||
"github.com/minio/pkg/env"
|
||||
)
|
||||
|
||||
var (
|
||||
// Port console default port
|
||||
Port = "9090"
|
||||
|
||||
// Hostname console hostname
|
||||
// avoid listening on 0.0.0.0 by default
|
||||
// instead listen on all IPv4 and IPv6
|
||||
// - Hostname should be empty.
|
||||
Hostname = ""
|
||||
|
||||
// TLSPort console tls port
|
||||
TLSPort = "9443"
|
||||
|
||||
// TLSRedirect console tls redirect rule
|
||||
TLSRedirect = "on"
|
||||
|
||||
// SessionDuration cookie validity duration
|
||||
SessionDuration = 45 * time.Minute
|
||||
|
||||
// LicenseKey in memory license key used by console ui
|
||||
LicenseKey = ""
|
||||
|
||||
// GlobalRootCAs is CA root certificates, a nil value means system certs pool will be used
|
||||
GlobalRootCAs *x509.CertPool
|
||||
// GlobalPublicCerts has certificates Console will use to serve clients
|
||||
GlobalPublicCerts []*x509.Certificate
|
||||
// GlobalTLSCertsManager custom TLS Manager for SNI support
|
||||
GlobalTLSCertsManager *xcerts.Manager
|
||||
)
|
||||
|
||||
var consoleImage string
|
||||
|
||||
func init() {
|
||||
consoleImage = env.Get(ConsoleOperatorConsoleImage, ConsoleImageDefaultVersion)
|
||||
}
|
||||
|
||||
// getK8sSAToken assumes the plugin is running inside a k8s pod and extract the current service account from the
|
||||
// /var/run/secrets/kubernetes.io/serviceaccount/token file
|
||||
func getK8sSAToken() string {
|
||||
dat, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token")
|
||||
if err != nil {
|
||||
return env.Get(ConsoleOperatorSAToken, "")
|
||||
}
|
||||
return string(dat)
|
||||
}
|
||||
func getConsoleImage() string {
|
||||
return consoleImage
|
||||
}
|
||||
189
operatorapi/configure_operator.go
Normal file
189
operatorapi/configure_operator.go
Normal file
@@ -0,0 +1,189 @@
|
||||
// This file is safe to edit. Once it exists it will not be overwritten
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/console/restapi"
|
||||
"github.com/unrolled/secure"
|
||||
|
||||
"github.com/minio/console/pkg/auth"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
)
|
||||
|
||||
//go:generate swagger generate server --target ../../console --name Operator --spec ../swagger-operator.yml --server-package operatorapi --principal models.Principal --exclude-main
|
||||
|
||||
var additionalServerFlags = struct {
|
||||
CertsDir string `long:"certs-dir" description:"path to certs directory" env:"CONSOLE_CERTS_DIR"`
|
||||
}{}
|
||||
|
||||
func configureFlags(api *operations.OperatorAPI) {
|
||||
api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{
|
||||
{
|
||||
ShortDescription: "additional server flags",
|
||||
Options: &additionalServerFlags,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureAPI(api *operations.OperatorAPI) http.Handler {
|
||||
|
||||
// Applies when the "x-token" header is set
|
||||
api.KeyAuth = func(token string, scopes []string) (*models.Principal, error) {
|
||||
// we are validating the session token by decrypting the claims inside, if the operation succeed that means the jwt
|
||||
// was generated and signed by us in the first place
|
||||
claims, err := auth.SessionTokenAuthenticate(token)
|
||||
if err != nil {
|
||||
api.Logger("Unable to validate the session token %s: %v", token, err)
|
||||
return nil, errors.New(401, "incorrect api key auth")
|
||||
}
|
||||
return &models.Principal{
|
||||
STSAccessKeyID: claims.STSAccessKeyID,
|
||||
Actions: claims.Actions,
|
||||
STSSecretAccessKey: claims.STSSecretAccessKey,
|
||||
STSSessionToken: claims.STSSessionToken,
|
||||
AccountAccessKey: claims.AccountAccessKey,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Register login handlers
|
||||
registerLoginHandlers(api)
|
||||
registerSessionHandlers(api)
|
||||
|
||||
// Operator Console
|
||||
// Register tenant handlers
|
||||
registerTenantHandlers(api)
|
||||
// Register ResourceQuota handlers
|
||||
registerResourceQuotaHandlers(api)
|
||||
// Register Nodes' handlers
|
||||
registerNodesHandlers(api)
|
||||
// Register Parity' handlers
|
||||
registerParityHandlers(api)
|
||||
|
||||
// Direct CSI handlers
|
||||
registerDirectCSIHandlers(api)
|
||||
// Volumes handlers
|
||||
registerVolumesHandlers(api)
|
||||
// Namespaces handlers
|
||||
registerNamespaceHandlers(api)
|
||||
// Subscription handlers
|
||||
registerOperatorSubscriptionHandlers(api)
|
||||
|
||||
api.PreServerShutdown = func() {}
|
||||
|
||||
api.ServerShutdown = func() {}
|
||||
|
||||
return setupGlobalMiddleware(api.Serve(setupMiddlewares))
|
||||
}
|
||||
|
||||
// The TLS configuration before HTTPS server starts.
|
||||
func configureTLS(tlsConfig *tls.Config) {
|
||||
tlsConfig.RootCAs = GlobalRootCAs
|
||||
tlsConfig.GetCertificate = GlobalTLSCertsManager.GetCertificate
|
||||
}
|
||||
|
||||
// As soon as server is initialized but not run yet, this function will be called.
|
||||
// If you need to modify a config, store server instance to stop it individually later, this is the place.
|
||||
// This function can be called multiple times, depending on the number of serving schemes.
|
||||
// scheme value will be set accordingly: "http", "https" or "unix".
|
||||
func configureServer(s *http.Server, scheme, addr string) {
|
||||
}
|
||||
|
||||
// The middleware configuration is for the handler executors. These do not apply to the swagger.json document.
|
||||
// The middleware executes after routing but before authentication, binding and validation.
|
||||
func setupMiddlewares(handler http.Handler) http.Handler {
|
||||
return handler
|
||||
}
|
||||
|
||||
func AuthenticationMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
token, err := auth.GetTokenFromRequest(r)
|
||||
if err != nil && err != auth.ErrNoAuthToken {
|
||||
http.Error(w, err.Error(), http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
// All handlers handle appropriately to return errors
|
||||
// based on their swagger rules, we do not need to
|
||||
// additionally return error here, let the next ServeHTTPs
|
||||
// handle it appropriately.
|
||||
if token != "" {
|
||||
r.Header.Add("Authorization", "Bearer "+token)
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
// proxyMiddleware adds the proxy capability
|
||||
func proxyMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.URL.Path, "/api/proxy") {
|
||||
serveProxy(w, r)
|
||||
} else {
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
|
||||
// So this is a good place to plug in a panic handling middleware, logging and metrics.
|
||||
func setupGlobalMiddleware(handler http.Handler) http.Handler {
|
||||
// handle cookie or authorization header for session
|
||||
next := AuthenticationMiddleware(handler)
|
||||
// serve static files
|
||||
next = proxyMiddleware(next)
|
||||
// serve static files
|
||||
next = restapi.FileServerMiddleware(next)
|
||||
// Secure middleware, this middleware wrap all the previous handlers and add
|
||||
// HTTP security headers
|
||||
secureOptions := secure.Options{
|
||||
AllowedHosts: restapi.GetSecureAllowedHosts(),
|
||||
AllowedHostsAreRegex: restapi.GetSecureAllowedHostsAreRegex(),
|
||||
HostsProxyHeaders: restapi.GetSecureHostsProxyHeaders(),
|
||||
SSLRedirect: restapi.GetTLSRedirect() == "on" && len(GlobalPublicCerts) > 0,
|
||||
SSLHost: restapi.GetSecureTLSHost(),
|
||||
STSSeconds: restapi.GetSecureSTSSeconds(),
|
||||
STSIncludeSubdomains: restapi.GetSecureSTSIncludeSubdomains(),
|
||||
STSPreload: restapi.GetSecureSTSPreload(),
|
||||
SSLTemporaryRedirect: restapi.GetSecureTLSTemporaryRedirect(),
|
||||
SSLHostFunc: nil,
|
||||
ForceSTSHeader: restapi.GetSecureForceSTSHeader(),
|
||||
FrameDeny: restapi.GetSecureFrameDeny(),
|
||||
ContentTypeNosniff: restapi.GetSecureContentTypeNonSniff(),
|
||||
BrowserXssFilter: restapi.GetSecureBrowserXSSFilter(),
|
||||
ContentSecurityPolicy: restapi.GetSecureContentSecurityPolicy(),
|
||||
ContentSecurityPolicyReportOnly: restapi.GetSecureContentSecurityPolicyReportOnly(),
|
||||
PublicKey: restapi.GetSecurePublicKey(),
|
||||
ReferrerPolicy: restapi.GetSecureReferrerPolicy(),
|
||||
FeaturePolicy: restapi.GetSecureFeaturePolicy(),
|
||||
ExpectCTHeader: restapi.GetSecureExpectCTHeader(),
|
||||
IsDevelopment: false,
|
||||
}
|
||||
secureMiddleware := secure.New(secureOptions)
|
||||
return secureMiddleware.Handler(next)
|
||||
}
|
||||
69
operatorapi/consts.go
Normal file
69
operatorapi/consts.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
// list of all console environment constants
|
||||
const (
|
||||
// Constants for common configuration
|
||||
ConsoleMinIOServer = "CONSOLE_MINIO_SERVER"
|
||||
ConsoleMinIORegion = "CONSOLE_MINIO_REGION"
|
||||
ConsoleHostname = "CONSOLE_HOSTNAME"
|
||||
ConsolePort = "CONSOLE_PORT"
|
||||
ConsoleTLSHostname = "CONSOLE_TLS_HOSTNAME"
|
||||
ConsoleTLSPort = "CONSOLE_TLS_PORT"
|
||||
ConsoleSubnetLicense = "CONSOLE_SUBNET_LICENSE"
|
||||
|
||||
// Constants for Secure middleware
|
||||
ConsoleSecureAllowedHosts = "CONSOLE_SECURE_ALLOWED_HOSTS"
|
||||
ConsoleSecureAllowedHostsAreRegex = "CONSOLE_SECURE_ALLOWED_HOSTS_ARE_REGEX"
|
||||
ConsoleSecureFrameDeny = "CONSOLE_SECURE_FRAME_DENY"
|
||||
ConsoleSecureContentTypeNoSniff = "CONSOLE_SECURE_CONTENT_TYPE_NO_SNIFF"
|
||||
ConsoleSecureBrowserXSSFilter = "CONSOLE_SECURE_BROWSER_XSS_FILTER"
|
||||
ConsoleSecureContentSecurityPolicy = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY"
|
||||
ConsoleSecureContentSecurityPolicyReportOnly = "CONSOLE_SECURE_CONTENT_SECURITY_POLICY_REPORT_ONLY"
|
||||
ConsoleSecureHostsProxyHeaders = "CONSOLE_SECURE_HOSTS_PROXY_HEADERS"
|
||||
ConsoleSecureSTSSeconds = "CONSOLE_SECURE_STS_SECONDS"
|
||||
ConsoleSecureSTSIncludeSubdomains = "CONSOLE_SECURE_STS_INCLUDE_SUB_DOMAINS"
|
||||
ConsoleSecureSTSPreload = "CONSOLE_SECURE_STS_PRELOAD"
|
||||
ConsoleSecureTLSRedirect = "CONSOLE_SECURE_TLS_REDIRECT"
|
||||
ConsoleSecureTLSHost = "CONSOLE_SECURE_TLS_HOST"
|
||||
ConsoleSecureTLSTemporaryRedirect = "CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT"
|
||||
ConsoleSecureForceSTSHeader = "CONSOLE_SECURE_FORCE_STS_HEADER"
|
||||
ConsoleSecurePublicKey = "CONSOLE_SECURE_PUBLIC_KEY"
|
||||
ConsoleSecureReferrerPolicy = "CONSOLE_SECURE_REFERRER_POLICY"
|
||||
ConsoleSecureFeaturePolicy = "CONSOLE_SECURE_FEATURE_POLICY"
|
||||
ConsoleSecureExpectCTHeader = "CONSOLE_SECURE_EXPECT_CT_HEADER"
|
||||
ConsoleOperatorSAToken = "CONSOLE_OPERATOR_SA_TOKEN"
|
||||
ConsoleOperatorConsoleImage = "CONSOLE_OPERATOR_CONSOLE_IMAGE"
|
||||
|
||||
// Constants for prometheus annotations
|
||||
prometheusPath = "prometheus.io/path"
|
||||
prometheusPort = "prometheus.io/port"
|
||||
prometheusScrape = "prometheus.io/scrape"
|
||||
)
|
||||
|
||||
// Image versions
|
||||
const (
|
||||
KESImageVersion = "minio/kes:v0.13.4"
|
||||
ConsoleImageDefaultVersion = "minio/console:v0.8.2"
|
||||
)
|
||||
|
||||
// K8s
|
||||
|
||||
const (
|
||||
OperatorSubnetLicenseSecretName = "subnet-license"
|
||||
)
|
||||
35
operatorapi/doc.go
Normal file
35
operatorapi/doc.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
// Package operatorapi MinIO Console Server
|
||||
//
|
||||
// Schemes:
|
||||
// http
|
||||
// ws
|
||||
// Host: localhost
|
||||
// BasePath: /api/v1
|
||||
// Version: 0.1.0
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// swagger:meta
|
||||
package operatorapi
|
||||
10354
operatorapi/embedded_spec.go
Normal file
10354
operatorapi/embedded_spec.go
Normal file
File diff suppressed because it is too large
Load Diff
199
operatorapi/error.go
Normal file
199
operatorapi/error.go
Normal file
@@ -0,0 +1,199 @@
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go"
|
||||
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
// Generic error messages
|
||||
errorGeneric = errors.New("an error occurred, please try again")
|
||||
errInvalidCredentials = errors.New("invalid Login")
|
||||
errorGenericInvalidSession = errors.New("invalid session")
|
||||
errorGenericUnauthorized = errors.New("unauthorized")
|
||||
errorGenericForbidden = errors.New("forbidden")
|
||||
// ErrorGenericNotFound Generic error for not found
|
||||
ErrorGenericNotFound = errors.New("not found")
|
||||
// Explicit error messages
|
||||
errorInvalidErasureCodingValue = errors.New("invalid Erasure Coding Value")
|
||||
errorUnableToGetTenantUsage = errors.New("unable to get tenant usage")
|
||||
errorUnableToUpdateTenantCertificates = errors.New("unable to update tenant certificates")
|
||||
errorUpdatingEncryptionConfig = errors.New("unable to update encryption configuration")
|
||||
errBucketBodyNotInRequest = errors.New("error bucket body not in request")
|
||||
errBucketNameNotInRequest = errors.New("error bucket name not in request")
|
||||
errGroupBodyNotInRequest = errors.New("error group body not in request")
|
||||
errGroupNameNotInRequest = errors.New("error group name not in request")
|
||||
errPolicyNameNotInRequest = errors.New("error policy name not in request")
|
||||
errPolicyBodyNotInRequest = errors.New("error policy body not in request")
|
||||
errSSENotConfigured = errors.New("error server side encryption configuration not found")
|
||||
errBucketLifeCycleNotConfigured = errors.New("error bucket life cycle configuration not found")
|
||||
errChangePassword = errors.New("error please check your current password")
|
||||
errInvalidLicense = errors.New("invalid license key")
|
||||
errLicenseNotFound = errors.New("license not found")
|
||||
errAvoidSelfAccountDelete = errors.New("logged in user cannot be deleted by itself")
|
||||
errAccessDenied = errors.New("access denied")
|
||||
errTooFewNodes = errors.New("at least 4 nodes are required in cluster")
|
||||
errTooFewSchedulableNodes = errors.New("at least 4 schedulable nodes are required in cluster")
|
||||
errFewerThanFourNodes = errors.New("at least 4 nodes are required in request")
|
||||
)
|
||||
|
||||
// prepareError receives an error object and parse it against k8sErrors, returns the right error code paired with a generic error message
|
||||
func prepareError(err ...error) *models.Error {
|
||||
errorCode := int32(500)
|
||||
errorMessage := errorGeneric.Error()
|
||||
if len(err) > 0 {
|
||||
frame := getFrame(2)
|
||||
fileParts := strings.Split(frame.File, "/")
|
||||
LogError("original error -> (%s:%d: %v)", fileParts[len(fileParts)-1], frame.Line, err[0])
|
||||
if k8sErrors.IsUnauthorized(err[0]) {
|
||||
errorCode = 401
|
||||
errorMessage = errorGenericUnauthorized.Error()
|
||||
}
|
||||
if k8sErrors.IsForbidden(err[0]) {
|
||||
errorCode = 403
|
||||
errorMessage = errorGenericForbidden.Error()
|
||||
}
|
||||
if k8sErrors.IsNotFound(err[0]) {
|
||||
errorCode = 404
|
||||
errorMessage = ErrorGenericNotFound.Error()
|
||||
}
|
||||
if err[0] == ErrorGenericNotFound {
|
||||
errorCode = 404
|
||||
errorMessage = ErrorGenericNotFound.Error()
|
||||
}
|
||||
if errors.Is(err[0], errInvalidCredentials) {
|
||||
errorCode = 401
|
||||
errorMessage = errInvalidCredentials.Error()
|
||||
}
|
||||
// console invalid erasure coding value
|
||||
if errors.Is(err[0], errorInvalidErasureCodingValue) {
|
||||
errorCode = 400
|
||||
errorMessage = errorInvalidErasureCodingValue.Error()
|
||||
}
|
||||
if errors.Is(err[0], errBucketBodyNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errBucketBodyNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err[0], errBucketNameNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errBucketNameNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err[0], errGroupBodyNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errGroupBodyNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err[0], errGroupNameNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errGroupNameNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err[0], errPolicyNameNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errPolicyNameNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err[0], errPolicyBodyNotInRequest) {
|
||||
errorCode = 400
|
||||
errorMessage = errPolicyBodyNotInRequest.Error()
|
||||
}
|
||||
// console invalid session error
|
||||
if errors.Is(err[0], errorGenericInvalidSession) {
|
||||
errorCode = 401
|
||||
errorMessage = errorGenericInvalidSession.Error()
|
||||
}
|
||||
// Bucket life cycle not configured
|
||||
if errors.Is(err[0], errBucketLifeCycleNotConfigured) {
|
||||
errorCode = 404
|
||||
errorMessage = errBucketLifeCycleNotConfigured.Error()
|
||||
}
|
||||
// Encryption not configured
|
||||
if errors.Is(err[0], errSSENotConfigured) {
|
||||
errorCode = 404
|
||||
errorMessage = errSSENotConfigured.Error()
|
||||
}
|
||||
// account change password
|
||||
if madmin.ToErrorResponse(err[0]).Code == "SignatureDoesNotMatch" {
|
||||
errorCode = 403
|
||||
errorMessage = errChangePassword.Error()
|
||||
}
|
||||
if errors.Is(err[0], errLicenseNotFound) {
|
||||
errorCode = 404
|
||||
errorMessage = errLicenseNotFound.Error()
|
||||
}
|
||||
if errors.Is(err[0], errInvalidLicense) {
|
||||
errorCode = 404
|
||||
errorMessage = errInvalidLicense.Error()
|
||||
}
|
||||
if errors.Is(err[0], errAvoidSelfAccountDelete) {
|
||||
errorCode = 403
|
||||
errorMessage = errAvoidSelfAccountDelete.Error()
|
||||
}
|
||||
if madmin.ToErrorResponse(err[0]).Code == "AccessDenied" {
|
||||
errorCode = 403
|
||||
errorMessage = errAccessDenied.Error()
|
||||
}
|
||||
if madmin.ToErrorResponse(err[0]).Code == "InvalidAccessKeyId" {
|
||||
errorCode = 401
|
||||
errorMessage = errorGenericInvalidSession.Error()
|
||||
}
|
||||
// console invalid session error
|
||||
if madmin.ToErrorResponse(err[0]).Code == "XMinioAdminNoSuchUser" {
|
||||
errorCode = 401
|
||||
errorMessage = errorGenericInvalidSession.Error()
|
||||
}
|
||||
// if we received a second error take that as friendly message but dont override the code
|
||||
if len(err) > 1 && err[1] != nil {
|
||||
LogError("friendly error: %v", err[1].Error())
|
||||
errorMessage = err[1].Error()
|
||||
}
|
||||
// if we receive third error we just print that as debugging
|
||||
if len(err) > 2 && err[2] != nil {
|
||||
LogError("debugging error: %v", err[2].Error())
|
||||
}
|
||||
|
||||
errRemoteTierExists := errors.New("Specified remote tier already exists") //nolint
|
||||
if errors.Is(err[0], errRemoteTierExists) {
|
||||
errorMessage = err[0].Error()
|
||||
}
|
||||
if errors.Is(err[0], errTooFewNodes) {
|
||||
errorCode = 507
|
||||
errorMessage = errTooFewNodes.Error()
|
||||
}
|
||||
if errors.Is(err[0], errTooFewSchedulableNodes) {
|
||||
errorCode = 507
|
||||
errorMessage = errTooFewSchedulableNodes.Error()
|
||||
}
|
||||
if errors.Is(err[0], errFewerThanFourNodes) {
|
||||
errorCode = 507
|
||||
errorMessage = errFewerThanFourNodes.Error()
|
||||
}
|
||||
}
|
||||
return &models.Error{Code: errorCode, Message: swag.String(errorMessage), DetailedMessage: swag.String(err[0].Error())}
|
||||
}
|
||||
|
||||
func getFrame(skipFrames int) runtime.Frame {
|
||||
// We need the frame at index skipFrames+2, since we never want runtime.Callers and getFrame
|
||||
targetFrameIndex := skipFrames + 2
|
||||
|
||||
// Set size to targetFrameIndex+2 to ensure we have room for one more caller than we need
|
||||
programCounters := make([]uintptr, targetFrameIndex+2)
|
||||
n := runtime.Callers(0, programCounters)
|
||||
|
||||
frame := runtime.Frame{Function: "unknown"}
|
||||
if n > 0 {
|
||||
frames := runtime.CallersFrames(programCounters[:n])
|
||||
for more, frameIndex := true, 0; more && frameIndex <= targetFrameIndex; frameIndex++ {
|
||||
var frameCandidate runtime.Frame
|
||||
frameCandidate, more = frames.Next()
|
||||
if frameIndex == targetFrameIndex {
|
||||
frame = frameCandidate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return frame
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package restapi
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package restapi
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
76
operatorapi/logs.go
Normal file
76
operatorapi/logs.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/minio/cli"
|
||||
)
|
||||
|
||||
var infoLog = log.New(os.Stdout, "I: ", log.LstdFlags)
|
||||
var errorLog = log.New(os.Stdout, "E: ", log.LstdFlags)
|
||||
|
||||
func logInfo(msg string, data ...interface{}) {
|
||||
infoLog.Printf(msg+"\n", data...)
|
||||
}
|
||||
|
||||
func logError(msg string, data ...interface{}) {
|
||||
errorLog.Printf(msg+"\n", data...)
|
||||
}
|
||||
|
||||
// globally changeable logger styles
|
||||
var (
|
||||
LogInfo = logInfo
|
||||
LogError = logError
|
||||
)
|
||||
|
||||
// Context captures all command line flags values
|
||||
type Context struct {
|
||||
Host string
|
||||
HTTPPort, HTTPSPort int
|
||||
TLSRedirect string
|
||||
// Legacy options, TODO: remove in future
|
||||
TLSCertificate, TLSKey, TLSca string
|
||||
}
|
||||
|
||||
// Load loads restapi Context from command line context.
|
||||
func (c *Context) Load(ctx *cli.Context) error {
|
||||
*c = Context{
|
||||
Host: ctx.String("host"),
|
||||
HTTPPort: ctx.Int("port"),
|
||||
HTTPSPort: ctx.Int("tls-port"),
|
||||
TLSRedirect: ctx.String("tls-redirect"),
|
||||
// Legacy options to be removed.
|
||||
TLSCertificate: ctx.String("tls-certificate"),
|
||||
TLSKey: ctx.String("tls-key"),
|
||||
TLSca: ctx.String("tls-ca"),
|
||||
}
|
||||
if c.HTTPPort > 65535 {
|
||||
return errors.New("invalid argument --port out of range - ports can range from 1-65535")
|
||||
}
|
||||
if c.HTTPSPort > 65535 {
|
||||
return errors.New("invalid argument --tls-port out of range - ports can range from 1-65535")
|
||||
}
|
||||
if c.TLSRedirect != "on" && c.TLSRedirect != "off" {
|
||||
return errors.New("invalid argument --tls-redirect only accepts either 'on' or 'off'")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package restapi
|
||||
package operatorapi
|
||||
|
||||
type opClientMock struct{}
|
||||
type httpClientMock struct{}
|
||||
793
operatorapi/operations/operator_api.go
Normal file
793
operatorapi/operations/operator_api.go
Normal file
@@ -0,0 +1,793 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/runtime/security"
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
"github.com/minio/console/operatorapi/operations/user_api"
|
||||
)
|
||||
|
||||
// NewOperatorAPI creates a new Operator instance
|
||||
func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
return &OperatorAPI{
|
||||
handlers: make(map[string]map[string]http.Handler),
|
||||
formats: strfmt.Default,
|
||||
defaultConsumes: "application/json",
|
||||
defaultProduces: "application/json",
|
||||
customConsumers: make(map[string]runtime.Consumer),
|
||||
customProducers: make(map[string]runtime.Producer),
|
||||
PreServerShutdown: func() {},
|
||||
ServerShutdown: func() {},
|
||||
spec: spec,
|
||||
useSwaggerUI: false,
|
||||
ServeError: errors.ServeError,
|
||||
BasicAuthenticator: security.BasicAuth,
|
||||
APIKeyAuthenticator: security.APIKeyAuth,
|
||||
BearerAuthenticator: security.BearerAuth,
|
||||
|
||||
JSONConsumer: runtime.JSONConsumer(),
|
||||
|
||||
JSONProducer: runtime.JSONProducer(),
|
||||
|
||||
OperatorAPICreateNamespaceHandler: operator_api.CreateNamespaceHandlerFunc(func(params operator_api.CreateNamespaceParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.CreateNamespace has not yet been implemented")
|
||||
}),
|
||||
OperatorAPICreateTenantHandler: operator_api.CreateTenantHandlerFunc(func(params operator_api.CreateTenantParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.CreateTenant has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDeletePodHandler: operator_api.DeletePodHandlerFunc(func(params operator_api.DeletePodParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DeletePod has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDeleteTenantHandler: operator_api.DeleteTenantHandlerFunc(func(params operator_api.DeleteTenantParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DeleteTenant has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDirectCSIFormatDriveHandler: operator_api.DirectCSIFormatDriveHandlerFunc(func(params operator_api.DirectCSIFormatDriveParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DirectCSIFormatDrive has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectCSIDriveListHandler: operator_api.GetDirectCSIDriveListHandlerFunc(func(params operator_api.GetDirectCSIDriveListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectCSIDriveList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectCSIVolumeListHandler: operator_api.GetDirectCSIVolumeListHandlerFunc(func(params operator_api.GetDirectCSIVolumeListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectCSIVolumeList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetMaxAllocatableMemHandler: operator_api.GetMaxAllocatableMemHandlerFunc(func(params operator_api.GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetMaxAllocatableMem has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetParityHandler: operator_api.GetParityHandlerFunc(func(params operator_api.GetParityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetParity has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetPodEventsHandler: operator_api.GetPodEventsHandlerFunc(func(params operator_api.GetPodEventsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetPodEvents has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetPodLogsHandler: operator_api.GetPodLogsHandlerFunc(func(params operator_api.GetPodLogsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetPodLogs has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetResourceQuotaHandler: operator_api.GetResourceQuotaHandlerFunc(func(params operator_api.GetResourceQuotaParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetResourceQuota has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetTenantPodsHandler: operator_api.GetTenantPodsHandlerFunc(func(params operator_api.GetTenantPodsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetTenantPods has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetTenantUsageHandler: operator_api.GetTenantUsageHandlerFunc(func(params operator_api.GetTenantUsageParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetTenantUsage has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetTenantYAMLHandler: operator_api.GetTenantYAMLHandlerFunc(func(params operator_api.GetTenantYAMLParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetTenantYAML has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIListAllTenantsHandler: operator_api.ListAllTenantsHandlerFunc(func(params operator_api.ListAllTenantsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.ListAllTenants has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIListNodeLabelsHandler: operator_api.ListNodeLabelsHandlerFunc(func(params operator_api.ListNodeLabelsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.ListNodeLabels has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIListPVCsHandler: operator_api.ListPVCsHandlerFunc(func(params operator_api.ListPVCsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.ListPVCs has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIListTenantsHandler: operator_api.ListTenantsHandlerFunc(func(params operator_api.ListTenantsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.ListTenants has not yet been implemented")
|
||||
}),
|
||||
UserAPILoginHandler: user_api.LoginHandlerFunc(func(params user_api.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.Login has not yet been implemented")
|
||||
}),
|
||||
UserAPILoginDetailHandler: user_api.LoginDetailHandlerFunc(func(params user_api.LoginDetailParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.LoginDetail has not yet been implemented")
|
||||
}),
|
||||
UserAPILoginOauth2AuthHandler: user_api.LoginOauth2AuthHandlerFunc(func(params user_api.LoginOauth2AuthParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.LoginOauth2Auth has not yet been implemented")
|
||||
}),
|
||||
UserAPILoginOperatorHandler: user_api.LoginOperatorHandlerFunc(func(params user_api.LoginOperatorParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.LoginOperator has not yet been implemented")
|
||||
}),
|
||||
UserAPILogoutHandler: user_api.LogoutHandlerFunc(func(params user_api.LogoutParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.Logout has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIPutTenantYAMLHandler: operator_api.PutTenantYAMLHandlerFunc(func(params operator_api.PutTenantYAMLParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.PutTenantYAML has not yet been implemented")
|
||||
}),
|
||||
UserAPISessionCheckHandler: user_api.SessionCheckHandlerFunc(func(params user_api.SessionCheckParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.SessionCheck has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISubscriptionActivateHandler: operator_api.SubscriptionActivateHandlerFunc(func(params operator_api.SubscriptionActivateParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SubscriptionActivate has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISubscriptionInfoHandler: operator_api.SubscriptionInfoHandlerFunc(func(params operator_api.SubscriptionInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SubscriptionInfo has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISubscriptionRefreshHandler: operator_api.SubscriptionRefreshHandlerFunc(func(params operator_api.SubscriptionRefreshParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SubscriptionRefresh has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISubscriptionValidateHandler: operator_api.SubscriptionValidateHandlerFunc(func(params operator_api.SubscriptionValidateParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SubscriptionValidate has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantAddPoolHandler: operator_api.TenantAddPoolHandlerFunc(func(params operator_api.TenantAddPoolParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantAddPool has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantDetailsHandler: operator_api.TenantDetailsHandlerFunc(func(params operator_api.TenantDetailsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantDetails has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantSecurityHandler: operator_api.TenantSecurityHandlerFunc(func(params operator_api.TenantSecurityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantSecurity has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantUpdateCertificateHandler: operator_api.TenantUpdateCertificateHandlerFunc(func(params operator_api.TenantUpdateCertificateParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantUpdateCertificate has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantUpdateEncryptionHandler: operator_api.TenantUpdateEncryptionHandlerFunc(func(params operator_api.TenantUpdateEncryptionParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantUpdateEncryption has not yet been implemented")
|
||||
}),
|
||||
OperatorAPITenantUpdatePoolsHandler: operator_api.TenantUpdatePoolsHandlerFunc(func(params operator_api.TenantUpdatePoolsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.TenantUpdatePools has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIUpdateTenantHandler: operator_api.UpdateTenantHandlerFunc(func(params operator_api.UpdateTenantParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.UpdateTenant has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIUpdateTenantSecurityHandler: operator_api.UpdateTenantSecurityHandlerFunc(func(params operator_api.UpdateTenantSecurityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.UpdateTenantSecurity has not yet been implemented")
|
||||
}),
|
||||
|
||||
KeyAuth: func(token string, scopes []string) (*models.Principal, error) {
|
||||
return nil, errors.NotImplemented("oauth2 bearer auth (key) has not yet been implemented")
|
||||
},
|
||||
// default authorizer is authorized meaning no requests are blocked
|
||||
APIAuthorizer: security.Authorized(),
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorAPI the operator API */
|
||||
type OperatorAPI struct {
|
||||
spec *loads.Document
|
||||
context *middleware.Context
|
||||
handlers map[string]map[string]http.Handler
|
||||
formats strfmt.Registry
|
||||
customConsumers map[string]runtime.Consumer
|
||||
customProducers map[string]runtime.Producer
|
||||
defaultConsumes string
|
||||
defaultProduces string
|
||||
Middleware func(middleware.Builder) http.Handler
|
||||
useSwaggerUI bool
|
||||
|
||||
// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
|
||||
// It has a default implementation in the security package, however you can replace it for your particular usage.
|
||||
BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
|
||||
|
||||
// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
|
||||
// It has a default implementation in the security package, however you can replace it for your particular usage.
|
||||
APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
|
||||
|
||||
// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
|
||||
// It has a default implementation in the security package, however you can replace it for your particular usage.
|
||||
BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator
|
||||
|
||||
// JSONConsumer registers a consumer for the following mime types:
|
||||
// - application/json
|
||||
JSONConsumer runtime.Consumer
|
||||
|
||||
// JSONProducer registers a producer for the following mime types:
|
||||
// - application/json
|
||||
JSONProducer runtime.Producer
|
||||
|
||||
// KeyAuth registers a function that takes an access token and a collection of required scopes and returns a principal
|
||||
// it performs authentication based on an oauth2 bearer token provided in the request
|
||||
KeyAuth func(string, []string) (*models.Principal, error)
|
||||
|
||||
// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
|
||||
APIAuthorizer runtime.Authorizer
|
||||
|
||||
// OperatorAPICreateNamespaceHandler sets the operation handler for the create namespace operation
|
||||
OperatorAPICreateNamespaceHandler operator_api.CreateNamespaceHandler
|
||||
// OperatorAPICreateTenantHandler sets the operation handler for the create tenant operation
|
||||
OperatorAPICreateTenantHandler operator_api.CreateTenantHandler
|
||||
// OperatorAPIDeletePodHandler sets the operation handler for the delete pod operation
|
||||
OperatorAPIDeletePodHandler operator_api.DeletePodHandler
|
||||
// OperatorAPIDeleteTenantHandler sets the operation handler for the delete tenant operation
|
||||
OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler
|
||||
// OperatorAPIDirectCSIFormatDriveHandler sets the operation handler for the direct c s i format drive operation
|
||||
OperatorAPIDirectCSIFormatDriveHandler operator_api.DirectCSIFormatDriveHandler
|
||||
// OperatorAPIGetDirectCSIDriveListHandler sets the operation handler for the get direct c s i drive list operation
|
||||
OperatorAPIGetDirectCSIDriveListHandler operator_api.GetDirectCSIDriveListHandler
|
||||
// OperatorAPIGetDirectCSIVolumeListHandler sets the operation handler for the get direct c s i volume list operation
|
||||
OperatorAPIGetDirectCSIVolumeListHandler operator_api.GetDirectCSIVolumeListHandler
|
||||
// OperatorAPIGetMaxAllocatableMemHandler sets the operation handler for the get max allocatable mem operation
|
||||
OperatorAPIGetMaxAllocatableMemHandler operator_api.GetMaxAllocatableMemHandler
|
||||
// OperatorAPIGetParityHandler sets the operation handler for the get parity operation
|
||||
OperatorAPIGetParityHandler operator_api.GetParityHandler
|
||||
// OperatorAPIGetPodEventsHandler sets the operation handler for the get pod events operation
|
||||
OperatorAPIGetPodEventsHandler operator_api.GetPodEventsHandler
|
||||
// OperatorAPIGetPodLogsHandler sets the operation handler for the get pod logs operation
|
||||
OperatorAPIGetPodLogsHandler operator_api.GetPodLogsHandler
|
||||
// OperatorAPIGetResourceQuotaHandler sets the operation handler for the get resource quota operation
|
||||
OperatorAPIGetResourceQuotaHandler operator_api.GetResourceQuotaHandler
|
||||
// OperatorAPIGetTenantPodsHandler sets the operation handler for the get tenant pods operation
|
||||
OperatorAPIGetTenantPodsHandler operator_api.GetTenantPodsHandler
|
||||
// OperatorAPIGetTenantUsageHandler sets the operation handler for the get tenant usage operation
|
||||
OperatorAPIGetTenantUsageHandler operator_api.GetTenantUsageHandler
|
||||
// OperatorAPIGetTenantYAMLHandler sets the operation handler for the get tenant y a m l operation
|
||||
OperatorAPIGetTenantYAMLHandler operator_api.GetTenantYAMLHandler
|
||||
// OperatorAPIListAllTenantsHandler sets the operation handler for the list all tenants operation
|
||||
OperatorAPIListAllTenantsHandler operator_api.ListAllTenantsHandler
|
||||
// OperatorAPIListNodeLabelsHandler sets the operation handler for the list node labels operation
|
||||
OperatorAPIListNodeLabelsHandler operator_api.ListNodeLabelsHandler
|
||||
// OperatorAPIListPVCsHandler sets the operation handler for the list p v cs operation
|
||||
OperatorAPIListPVCsHandler operator_api.ListPVCsHandler
|
||||
// OperatorAPIListTenantsHandler sets the operation handler for the list tenants operation
|
||||
OperatorAPIListTenantsHandler operator_api.ListTenantsHandler
|
||||
// UserAPILoginHandler sets the operation handler for the login operation
|
||||
UserAPILoginHandler user_api.LoginHandler
|
||||
// UserAPILoginDetailHandler sets the operation handler for the login detail operation
|
||||
UserAPILoginDetailHandler user_api.LoginDetailHandler
|
||||
// UserAPILoginOauth2AuthHandler sets the operation handler for the login oauth2 auth operation
|
||||
UserAPILoginOauth2AuthHandler user_api.LoginOauth2AuthHandler
|
||||
// UserAPILoginOperatorHandler sets the operation handler for the login operator operation
|
||||
UserAPILoginOperatorHandler user_api.LoginOperatorHandler
|
||||
// UserAPILogoutHandler sets the operation handler for the logout operation
|
||||
UserAPILogoutHandler user_api.LogoutHandler
|
||||
// OperatorAPIPutTenantYAMLHandler sets the operation handler for the put tenant y a m l operation
|
||||
OperatorAPIPutTenantYAMLHandler operator_api.PutTenantYAMLHandler
|
||||
// UserAPISessionCheckHandler sets the operation handler for the session check operation
|
||||
UserAPISessionCheckHandler user_api.SessionCheckHandler
|
||||
// OperatorAPISubscriptionActivateHandler sets the operation handler for the subscription activate operation
|
||||
OperatorAPISubscriptionActivateHandler operator_api.SubscriptionActivateHandler
|
||||
// OperatorAPISubscriptionInfoHandler sets the operation handler for the subscription info operation
|
||||
OperatorAPISubscriptionInfoHandler operator_api.SubscriptionInfoHandler
|
||||
// OperatorAPISubscriptionRefreshHandler sets the operation handler for the subscription refresh operation
|
||||
OperatorAPISubscriptionRefreshHandler operator_api.SubscriptionRefreshHandler
|
||||
// OperatorAPISubscriptionValidateHandler sets the operation handler for the subscription validate operation
|
||||
OperatorAPISubscriptionValidateHandler operator_api.SubscriptionValidateHandler
|
||||
// OperatorAPITenantAddPoolHandler sets the operation handler for the tenant add pool operation
|
||||
OperatorAPITenantAddPoolHandler operator_api.TenantAddPoolHandler
|
||||
// OperatorAPITenantDetailsHandler sets the operation handler for the tenant details operation
|
||||
OperatorAPITenantDetailsHandler operator_api.TenantDetailsHandler
|
||||
// OperatorAPITenantSecurityHandler sets the operation handler for the tenant security operation
|
||||
OperatorAPITenantSecurityHandler operator_api.TenantSecurityHandler
|
||||
// OperatorAPITenantUpdateCertificateHandler sets the operation handler for the tenant update certificate operation
|
||||
OperatorAPITenantUpdateCertificateHandler operator_api.TenantUpdateCertificateHandler
|
||||
// OperatorAPITenantUpdateEncryptionHandler sets the operation handler for the tenant update encryption operation
|
||||
OperatorAPITenantUpdateEncryptionHandler operator_api.TenantUpdateEncryptionHandler
|
||||
// OperatorAPITenantUpdatePoolsHandler sets the operation handler for the tenant update pools operation
|
||||
OperatorAPITenantUpdatePoolsHandler operator_api.TenantUpdatePoolsHandler
|
||||
// OperatorAPIUpdateTenantHandler sets the operation handler for the update tenant operation
|
||||
OperatorAPIUpdateTenantHandler operator_api.UpdateTenantHandler
|
||||
// OperatorAPIUpdateTenantSecurityHandler sets the operation handler for the update tenant security operation
|
||||
OperatorAPIUpdateTenantSecurityHandler operator_api.UpdateTenantSecurityHandler
|
||||
|
||||
// ServeError is called when an error is received, there is a default handler
|
||||
// but you can set your own with this
|
||||
ServeError func(http.ResponseWriter, *http.Request, error)
|
||||
|
||||
// PreServerShutdown is called before the HTTP(S) server is shutdown
|
||||
// This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
|
||||
PreServerShutdown func()
|
||||
|
||||
// ServerShutdown is called when the HTTP(S) server is shut down and done
|
||||
// handling all active connections and does not accept connections any more
|
||||
ServerShutdown func()
|
||||
|
||||
// Custom command line argument groups with their descriptions
|
||||
CommandLineOptionsGroups []swag.CommandLineOptionsGroup
|
||||
|
||||
// User defined logger function.
|
||||
Logger func(string, ...interface{})
|
||||
}
|
||||
|
||||
// UseRedoc for documentation at /docs
|
||||
func (o *OperatorAPI) UseRedoc() {
|
||||
o.useSwaggerUI = false
|
||||
}
|
||||
|
||||
// UseSwaggerUI for documentation at /docs
|
||||
func (o *OperatorAPI) UseSwaggerUI() {
|
||||
o.useSwaggerUI = true
|
||||
}
|
||||
|
||||
// SetDefaultProduces sets the default produces media type
|
||||
func (o *OperatorAPI) SetDefaultProduces(mediaType string) {
|
||||
o.defaultProduces = mediaType
|
||||
}
|
||||
|
||||
// SetDefaultConsumes returns the default consumes media type
|
||||
func (o *OperatorAPI) SetDefaultConsumes(mediaType string) {
|
||||
o.defaultConsumes = mediaType
|
||||
}
|
||||
|
||||
// SetSpec sets a spec that will be served for the clients.
|
||||
func (o *OperatorAPI) SetSpec(spec *loads.Document) {
|
||||
o.spec = spec
|
||||
}
|
||||
|
||||
// DefaultProduces returns the default produces media type
|
||||
func (o *OperatorAPI) DefaultProduces() string {
|
||||
return o.defaultProduces
|
||||
}
|
||||
|
||||
// DefaultConsumes returns the default consumes media type
|
||||
func (o *OperatorAPI) DefaultConsumes() string {
|
||||
return o.defaultConsumes
|
||||
}
|
||||
|
||||
// Formats returns the registered string formats
|
||||
func (o *OperatorAPI) Formats() strfmt.Registry {
|
||||
return o.formats
|
||||
}
|
||||
|
||||
// RegisterFormat registers a custom format validator
|
||||
func (o *OperatorAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
|
||||
o.formats.Add(name, format, validator)
|
||||
}
|
||||
|
||||
// Validate validates the registrations in the OperatorAPI
|
||||
func (o *OperatorAPI) Validate() error {
|
||||
var unregistered []string
|
||||
|
||||
if o.JSONConsumer == nil {
|
||||
unregistered = append(unregistered, "JSONConsumer")
|
||||
}
|
||||
|
||||
if o.JSONProducer == nil {
|
||||
unregistered = append(unregistered, "JSONProducer")
|
||||
}
|
||||
|
||||
if o.KeyAuth == nil {
|
||||
unregistered = append(unregistered, "KeyAuth")
|
||||
}
|
||||
|
||||
if o.OperatorAPICreateNamespaceHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.CreateNamespaceHandler")
|
||||
}
|
||||
if o.OperatorAPICreateTenantHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.CreateTenantHandler")
|
||||
}
|
||||
if o.OperatorAPIDeletePodHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DeletePodHandler")
|
||||
}
|
||||
if o.OperatorAPIDeleteTenantHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DeleteTenantHandler")
|
||||
}
|
||||
if o.OperatorAPIDirectCSIFormatDriveHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DirectCSIFormatDriveHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectCSIDriveListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectCSIDriveListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectCSIVolumeListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectCSIVolumeListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetMaxAllocatableMemHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetMaxAllocatableMemHandler")
|
||||
}
|
||||
if o.OperatorAPIGetParityHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetParityHandler")
|
||||
}
|
||||
if o.OperatorAPIGetPodEventsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetPodEventsHandler")
|
||||
}
|
||||
if o.OperatorAPIGetPodLogsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetPodLogsHandler")
|
||||
}
|
||||
if o.OperatorAPIGetResourceQuotaHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetResourceQuotaHandler")
|
||||
}
|
||||
if o.OperatorAPIGetTenantPodsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetTenantPodsHandler")
|
||||
}
|
||||
if o.OperatorAPIGetTenantUsageHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetTenantUsageHandler")
|
||||
}
|
||||
if o.OperatorAPIGetTenantYAMLHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetTenantYAMLHandler")
|
||||
}
|
||||
if o.OperatorAPIListAllTenantsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.ListAllTenantsHandler")
|
||||
}
|
||||
if o.OperatorAPIListNodeLabelsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.ListNodeLabelsHandler")
|
||||
}
|
||||
if o.OperatorAPIListPVCsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.ListPVCsHandler")
|
||||
}
|
||||
if o.OperatorAPIListTenantsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.ListTenantsHandler")
|
||||
}
|
||||
if o.UserAPILoginHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.LoginHandler")
|
||||
}
|
||||
if o.UserAPILoginDetailHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.LoginDetailHandler")
|
||||
}
|
||||
if o.UserAPILoginOauth2AuthHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.LoginOauth2AuthHandler")
|
||||
}
|
||||
if o.UserAPILoginOperatorHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.LoginOperatorHandler")
|
||||
}
|
||||
if o.UserAPILogoutHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.LogoutHandler")
|
||||
}
|
||||
if o.OperatorAPIPutTenantYAMLHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.PutTenantYAMLHandler")
|
||||
}
|
||||
if o.UserAPISessionCheckHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.SessionCheckHandler")
|
||||
}
|
||||
if o.OperatorAPISubscriptionActivateHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SubscriptionActivateHandler")
|
||||
}
|
||||
if o.OperatorAPISubscriptionInfoHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SubscriptionInfoHandler")
|
||||
}
|
||||
if o.OperatorAPISubscriptionRefreshHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SubscriptionRefreshHandler")
|
||||
}
|
||||
if o.OperatorAPISubscriptionValidateHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SubscriptionValidateHandler")
|
||||
}
|
||||
if o.OperatorAPITenantAddPoolHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantAddPoolHandler")
|
||||
}
|
||||
if o.OperatorAPITenantDetailsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantDetailsHandler")
|
||||
}
|
||||
if o.OperatorAPITenantSecurityHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantSecurityHandler")
|
||||
}
|
||||
if o.OperatorAPITenantUpdateCertificateHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantUpdateCertificateHandler")
|
||||
}
|
||||
if o.OperatorAPITenantUpdateEncryptionHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantUpdateEncryptionHandler")
|
||||
}
|
||||
if o.OperatorAPITenantUpdatePoolsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.TenantUpdatePoolsHandler")
|
||||
}
|
||||
if o.OperatorAPIUpdateTenantHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.UpdateTenantHandler")
|
||||
}
|
||||
if o.OperatorAPIUpdateTenantSecurityHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.UpdateTenantSecurityHandler")
|
||||
}
|
||||
|
||||
if len(unregistered) > 0 {
|
||||
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ServeErrorFor gets a error handler for a given operation id
|
||||
func (o *OperatorAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
|
||||
return o.ServeError
|
||||
}
|
||||
|
||||
// AuthenticatorsFor gets the authenticators for the specified security schemes
|
||||
func (o *OperatorAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
|
||||
result := make(map[string]runtime.Authenticator)
|
||||
for name := range schemes {
|
||||
switch name {
|
||||
case "key":
|
||||
result[name] = o.BearerAuthenticator(name, func(token string, scopes []string) (interface{}, error) {
|
||||
return o.KeyAuth(token, scopes)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Authorizer returns the registered authorizer
|
||||
func (o *OperatorAPI) Authorizer() runtime.Authorizer {
|
||||
return o.APIAuthorizer
|
||||
}
|
||||
|
||||
// ConsumersFor gets the consumers for the specified media types.
|
||||
// MIME type parameters are ignored here.
|
||||
func (o *OperatorAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
|
||||
result := make(map[string]runtime.Consumer, len(mediaTypes))
|
||||
for _, mt := range mediaTypes {
|
||||
switch mt {
|
||||
case "application/json":
|
||||
result["application/json"] = o.JSONConsumer
|
||||
}
|
||||
|
||||
if c, ok := o.customConsumers[mt]; ok {
|
||||
result[mt] = c
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// ProducersFor gets the producers for the specified media types.
|
||||
// MIME type parameters are ignored here.
|
||||
func (o *OperatorAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
|
||||
result := make(map[string]runtime.Producer, len(mediaTypes))
|
||||
for _, mt := range mediaTypes {
|
||||
switch mt {
|
||||
case "application/json":
|
||||
result["application/json"] = o.JSONProducer
|
||||
}
|
||||
|
||||
if p, ok := o.customProducers[mt]; ok {
|
||||
result[mt] = p
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// HandlerFor gets a http.Handler for the provided operation method and path
|
||||
func (o *OperatorAPI) HandlerFor(method, path string) (http.Handler, bool) {
|
||||
if o.handlers == nil {
|
||||
return nil, false
|
||||
}
|
||||
um := strings.ToUpper(method)
|
||||
if _, ok := o.handlers[um]; !ok {
|
||||
return nil, false
|
||||
}
|
||||
if path == "/" {
|
||||
path = ""
|
||||
}
|
||||
h, ok := o.handlers[um][path]
|
||||
return h, ok
|
||||
}
|
||||
|
||||
// Context returns the middleware context for the operator API
|
||||
func (o *OperatorAPI) Context() *middleware.Context {
|
||||
if o.context == nil {
|
||||
o.context = middleware.NewRoutableContext(o.spec, o, nil)
|
||||
}
|
||||
|
||||
return o.context
|
||||
}
|
||||
|
||||
func (o *OperatorAPI) initHandlerCache() {
|
||||
o.Context() // don't care about the result, just that the initialization happened
|
||||
if o.handlers == nil {
|
||||
o.handlers = make(map[string]map[string]http.Handler)
|
||||
}
|
||||
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespace"] = operator_api.NewCreateNamespace(o.context, o.OperatorAPICreateNamespaceHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/tenants"] = operator_api.NewCreateTenant(o.context, o.OperatorAPICreateTenantHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"] = operator_api.NewDeletePod(o.context, o.OperatorAPIDeletePodHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewDeleteTenant(o.context, o.OperatorAPIDeleteTenantHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/direct-csi/drives/format"] = operator_api.NewDirectCSIFormatDrive(o.context, o.OperatorAPIDirectCSIFormatDriveHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/direct-csi/drives"] = operator_api.NewGetDirectCSIDriveList(o.context, o.OperatorAPIGetDirectCSIDriveListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/direct-csi/volumes"] = operator_api.NewGetDirectCSIVolumeList(o.context, o.OperatorAPIGetDirectCSIVolumeListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/cluster/max-allocatable-memory"] = operator_api.NewGetMaxAllocatableMem(o.context, o.OperatorAPIGetMaxAllocatableMemHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/get-parity/{nodes}/{disksPerNode}"] = operator_api.NewGetParity(o.context, o.OperatorAPIGetParityHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events"] = operator_api.NewGetPodEvents(o.context, o.OperatorAPIGetPodEventsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"] = operator_api.NewGetPodLogs(o.context, o.OperatorAPIGetPodLogsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/resourcequotas/{resource-quota-name}"] = operator_api.NewGetResourceQuota(o.context, o.OperatorAPIGetResourceQuotaHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods"] = operator_api.NewGetTenantPods(o.context, o.OperatorAPIGetTenantPodsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/usage"] = operator_api.NewGetTenantUsage(o.context, o.OperatorAPIGetTenantUsageHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/yaml"] = operator_api.NewGetTenantYAML(o.context, o.OperatorAPIGetTenantYAMLHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/tenants"] = operator_api.NewListAllTenants(o.context, o.OperatorAPIListAllTenantsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/nodes/labels"] = operator_api.NewListNodeLabels(o.context, o.OperatorAPIListNodeLabelsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/list-pvcs"] = operator_api.NewListPVCs(o.context, o.OperatorAPIListPVCsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants"] = operator_api.NewListTenants(o.context, o.OperatorAPIListTenantsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/login"] = user_api.NewLogin(o.context, o.UserAPILoginHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/login"] = user_api.NewLoginDetail(o.context, o.UserAPILoginDetailHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/login/oauth2/auth"] = user_api.NewLoginOauth2Auth(o.context, o.UserAPILoginOauth2AuthHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/login/operator"] = user_api.NewLoginOperator(o.context, o.UserAPILoginOperatorHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/logout"] = user_api.NewLogout(o.context, o.UserAPILogoutHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/yaml"] = operator_api.NewPutTenantYAML(o.context, o.OperatorAPIPutTenantYAMLHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/session"] = user_api.NewSessionCheck(o.context, o.UserAPISessionCheckHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subscription/namespaces/{namespace}/tenants/{tenant}/activate"] = operator_api.NewSubscriptionActivate(o.context, o.OperatorAPISubscriptionActivateHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subscription/info"] = operator_api.NewSubscriptionInfo(o.context, o.OperatorAPISubscriptionInfoHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subscription/refresh"] = operator_api.NewSubscriptionRefresh(o.context, o.OperatorAPISubscriptionRefreshHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subscription/validate"] = operator_api.NewSubscriptionValidate(o.context, o.OperatorAPISubscriptionValidateHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/pools"] = operator_api.NewTenantAddPool(o.context, o.OperatorAPITenantAddPoolHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewTenantDetails(o.context, o.OperatorAPITenantDetailsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/security"] = operator_api.NewTenantSecurity(o.context, o.OperatorAPITenantSecurityHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/certificates"] = operator_api.NewTenantUpdateCertificate(o.context, o.OperatorAPITenantUpdateCertificateHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/encryption"] = operator_api.NewTenantUpdateEncryption(o.context, o.OperatorAPITenantUpdateEncryptionHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/pools"] = operator_api.NewTenantUpdatePools(o.context, o.OperatorAPITenantUpdatePoolsHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewUpdateTenant(o.context, o.OperatorAPIUpdateTenantHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/security"] = operator_api.NewUpdateTenantSecurity(o.context, o.OperatorAPIUpdateTenantSecurityHandler)
|
||||
}
|
||||
|
||||
// Serve creates a http handler to serve the API over HTTP
|
||||
// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
|
||||
func (o *OperatorAPI) Serve(builder middleware.Builder) http.Handler {
|
||||
o.Init()
|
||||
|
||||
if o.Middleware != nil {
|
||||
return o.Middleware(builder)
|
||||
}
|
||||
if o.useSwaggerUI {
|
||||
return o.context.APIHandlerSwaggerUI(builder)
|
||||
}
|
||||
return o.context.APIHandler(builder)
|
||||
}
|
||||
|
||||
// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
|
||||
func (o *OperatorAPI) Init() {
|
||||
if len(o.handlers) == 0 {
|
||||
o.initHandlerCache()
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterConsumer allows you to add (or override) a consumer for a media type.
|
||||
func (o *OperatorAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) {
|
||||
o.customConsumers[mediaType] = consumer
|
||||
}
|
||||
|
||||
// RegisterProducer allows you to add (or override) a producer for a media type.
|
||||
func (o *OperatorAPI) RegisterProducer(mediaType string, producer runtime.Producer) {
|
||||
o.customProducers[mediaType] = producer
|
||||
}
|
||||
|
||||
// AddMiddlewareFor adds a http middleware to existing handler
|
||||
func (o *OperatorAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) {
|
||||
um := strings.ToUpper(method)
|
||||
if path == "/" {
|
||||
path = ""
|
||||
}
|
||||
o.Init()
|
||||
if h, ok := o.handlers[um][path]; ok {
|
||||
o.handlers[method][path] = builder(h)
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewCreateNamespace(ctx *middleware.Context, handler CreateNamespaceHandler)
|
||||
return &CreateNamespace{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* CreateNamespace swagger:route POST /namespace AdminAPI createNamespace
|
||||
/* CreateNamespace swagger:route POST /namespace OperatorAPI createNamespace
|
||||
|
||||
Creates a new Namespace with given information
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewCreateTenant(ctx *middleware.Context, handler CreateTenantHandler) *Crea
|
||||
return &CreateTenant{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* CreateTenant swagger:route POST /tenants AdminAPI createTenant
|
||||
/* CreateTenant swagger:route POST /tenants OperatorAPI createTenant
|
||||
|
||||
Create Tenant
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -30,40 +30,40 @@ import (
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// TenantInfoHandlerFunc turns a function with the right signature into a tenant info handler
|
||||
type TenantInfoHandlerFunc func(TenantInfoParams, *models.Principal) middleware.Responder
|
||||
// DeletePodHandlerFunc turns a function with the right signature into a delete pod handler
|
||||
type DeletePodHandlerFunc func(DeletePodParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn TenantInfoHandlerFunc) Handle(params TenantInfoParams, principal *models.Principal) middleware.Responder {
|
||||
func (fn DeletePodHandlerFunc) Handle(params DeletePodParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// TenantInfoHandler interface for that can handle valid tenant info params
|
||||
type TenantInfoHandler interface {
|
||||
Handle(TenantInfoParams, *models.Principal) middleware.Responder
|
||||
// DeletePodHandler interface for that can handle valid delete pod params
|
||||
type DeletePodHandler interface {
|
||||
Handle(DeletePodParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewTenantInfo creates a new http.Handler for the tenant info operation
|
||||
func NewTenantInfo(ctx *middleware.Context, handler TenantInfoHandler) *TenantInfo {
|
||||
return &TenantInfo{Context: ctx, Handler: handler}
|
||||
// NewDeletePod creates a new http.Handler for the delete pod operation
|
||||
func NewDeletePod(ctx *middleware.Context, handler DeletePodHandler) *DeletePod {
|
||||
return &DeletePod{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* TenantInfo swagger:route GET /namespaces/{namespace}/tenants/{tenant}/info AdminAPI tenantInfo
|
||||
/* DeletePod swagger:route DELETE /namespaces/{namespace}/tenants/{tenant}/pods/{podName} OperatorAPI deletePod
|
||||
|
||||
Tenant Info
|
||||
Delete pod
|
||||
|
||||
*/
|
||||
type TenantInfo struct {
|
||||
type DeletePod struct {
|
||||
Context *middleware.Context
|
||||
Handler TenantInfoHandler
|
||||
Handler DeletePodHandler
|
||||
}
|
||||
|
||||
func (o *TenantInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
func (o *DeletePod) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewTenantInfoParams()
|
||||
var Params = NewDeletePodParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -30,19 +30,19 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewTenantInfoParams creates a new TenantInfoParams object
|
||||
// NewDeletePodParams creates a new DeletePodParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewTenantInfoParams() TenantInfoParams {
|
||||
func NewDeletePodParams() DeletePodParams {
|
||||
|
||||
return TenantInfoParams{}
|
||||
return DeletePodParams{}
|
||||
}
|
||||
|
||||
// TenantInfoParams contains all the bound params for the tenant info operation
|
||||
// DeletePodParams contains all the bound params for the delete pod operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters TenantInfo
|
||||
type TenantInfoParams struct {
|
||||
// swagger:parameters DeletePod
|
||||
type DeletePodParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
@@ -56,14 +56,19 @@ type TenantInfoParams struct {
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PodName string
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Tenant string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewTenantInfoParams() beforehand.
|
||||
func (o *TenantInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
// To ensure default values, the struct must have been initialized with NewDeletePodParams() beforehand.
|
||||
func (o *DeletePodParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
@@ -73,6 +78,11 @@ func (o *TenantInfoParams) BindRequest(r *http.Request, route *middleware.Matche
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPodName, rhkPodName, _ := route.Params.GetOK("podName")
|
||||
if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
|
||||
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
@@ -84,7 +94,7 @@ func (o *TenantInfoParams) BindRequest(r *http.Request, route *middleware.Matche
|
||||
}
|
||||
|
||||
// bindNamespace binds and validates parameter Namespace from path.
|
||||
func (o *TenantInfoParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *DeletePodParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
@@ -97,8 +107,22 @@ func (o *TenantInfoParams) bindNamespace(rawData []string, hasKey bool, formats
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindPodName binds and validates parameter PodName from path.
|
||||
func (o *DeletePodParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.PodName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindTenant binds and validates parameter Tenant from path.
|
||||
func (o *TenantInfoParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *DeletePodParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
113
operatorapi/operations/operator_api/delete_pod_responses.go
Normal file
113
operatorapi/operations/operator_api/delete_pod_responses.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// DeletePodNoContentCode is the HTTP code returned for type DeletePodNoContent
|
||||
const DeletePodNoContentCode int = 204
|
||||
|
||||
/*DeletePodNoContent A successful response.
|
||||
|
||||
swagger:response deletePodNoContent
|
||||
*/
|
||||
type DeletePodNoContent struct {
|
||||
}
|
||||
|
||||
// NewDeletePodNoContent creates DeletePodNoContent with default headers values
|
||||
func NewDeletePodNoContent() *DeletePodNoContent {
|
||||
|
||||
return &DeletePodNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeletePodNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*DeletePodDefault Generic error response.
|
||||
|
||||
swagger:response deletePodDefault
|
||||
*/
|
||||
type DeletePodDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeletePodDefault creates DeletePodDefault with default headers values
|
||||
func NewDeletePodDefault(code int) *DeletePodDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DeletePodDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the delete pod default response
|
||||
func (o *DeletePodDefault) WithStatusCode(code int) *DeletePodDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the delete pod default response
|
||||
func (o *DeletePodDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete pod default response
|
||||
func (o *DeletePodDefault) WithPayload(payload *models.Error) *DeletePodDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete pod default response
|
||||
func (o *DeletePodDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeletePodDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -29,9 +29,10 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TenantInfoURL generates an URL for the tenant info operation
|
||||
type TenantInfoURL struct {
|
||||
// DeletePodURL generates an URL for the delete pod operation
|
||||
type DeletePodURL struct {
|
||||
Namespace string
|
||||
PodName string
|
||||
Tenant string
|
||||
|
||||
_basePath string
|
||||
@@ -42,7 +43,7 @@ type TenantInfoURL struct {
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *TenantInfoURL) WithBasePath(bp string) *TenantInfoURL {
|
||||
func (o *DeletePodURL) WithBasePath(bp string) *DeletePodURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
@@ -50,28 +51,35 @@ func (o *TenantInfoURL) WithBasePath(bp string) *TenantInfoURL {
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *TenantInfoURL) SetBasePath(bp string) {
|
||||
func (o *DeletePodURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *TenantInfoURL) Build() (*url.URL, error) {
|
||||
func (o *DeletePodURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/namespaces/{namespace}/tenants/{tenant}/info"
|
||||
var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"
|
||||
|
||||
namespace := o.Namespace
|
||||
if namespace != "" {
|
||||
_path = strings.Replace(_path, "{namespace}", namespace, -1)
|
||||
} else {
|
||||
return nil, errors.New("namespace is required on TenantInfoURL")
|
||||
return nil, errors.New("namespace is required on DeletePodURL")
|
||||
}
|
||||
|
||||
podName := o.PodName
|
||||
if podName != "" {
|
||||
_path = strings.Replace(_path, "{podName}", podName, -1)
|
||||
} else {
|
||||
return nil, errors.New("podName is required on DeletePodURL")
|
||||
}
|
||||
|
||||
tenant := o.Tenant
|
||||
if tenant != "" {
|
||||
_path = strings.Replace(_path, "{tenant}", tenant, -1)
|
||||
} else {
|
||||
return nil, errors.New("tenant is required on TenantInfoURL")
|
||||
return nil, errors.New("tenant is required on DeletePodURL")
|
||||
}
|
||||
|
||||
_basePath := o._basePath
|
||||
@@ -84,7 +92,7 @@ func (o *TenantInfoURL) Build() (*url.URL, error) {
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *TenantInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
func (o *DeletePodURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -95,17 +103,17 @@ func (o *TenantInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *TenantInfoURL) String() string {
|
||||
func (o *DeletePodURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *TenantInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
func (o *DeletePodURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on TenantInfoURL")
|
||||
return nil, errors.New("scheme is required for a full url on DeletePodURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on TenantInfoURL")
|
||||
return nil, errors.New("host is required for a full url on DeletePodURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
@@ -119,6 +127,6 @@ func (o *TenantInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *TenantInfoURL) StringFull(scheme, host string) string {
|
||||
func (o *DeletePodURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewDeleteTenant(ctx *middleware.Context, handler DeleteTenantHandler) *Dele
|
||||
return &DeleteTenant{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* DeleteTenant swagger:route DELETE /namespaces/{namespace}/tenants/{tenant} AdminAPI deleteTenant
|
||||
/* DeleteTenant swagger:route DELETE /namespaces/{namespace}/tenants/{tenant} OperatorAPI deleteTenant
|
||||
|
||||
Delete tenant and underlying pvcs
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewDirectCSIFormatDrive(ctx *middleware.Context, handler DirectCSIFormatDri
|
||||
return &DirectCSIFormatDrive{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* DirectCSIFormatDrive swagger:route POST /direct-csi/drives/format AdminAPI directCSIFormatDrive
|
||||
/* DirectCSIFormatDrive swagger:route POST /direct-csi/drives/format OperatorAPI directCSIFormatDrive
|
||||
|
||||
Format direct-csi drives from a list
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetDirectCSIDriveList(ctx *middleware.Context, handler GetDirectCSIDrive
|
||||
return &GetDirectCSIDriveList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectCSIDriveList swagger:route GET /direct-csi/drives AdminAPI getDirectCSIDriveList
|
||||
/* GetDirectCSIDriveList swagger:route GET /direct-csi/drives OperatorAPI getDirectCSIDriveList
|
||||
|
||||
Get direct-csi drives list
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetDirectCSIVolumeList(ctx *middleware.Context, handler GetDirectCSIVolu
|
||||
return &GetDirectCSIVolumeList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectCSIVolumeList swagger:route GET /direct-csi/volumes AdminAPI getDirectCSIVolumeList
|
||||
/* GetDirectCSIVolumeList swagger:route GET /direct-csi/volumes OperatorAPI getDirectCSIVolumeList
|
||||
|
||||
Get direct-csi volumes list
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetMaxAllocatableMem(ctx *middleware.Context, handler GetMaxAllocatableM
|
||||
return &GetMaxAllocatableMem{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetMaxAllocatableMem swagger:route GET /cluster/max-allocatable-memory AdminAPI getMaxAllocatableMem
|
||||
/* GetMaxAllocatableMem swagger:route GET /cluster/max-allocatable-memory OperatorAPI getMaxAllocatableMem
|
||||
|
||||
Get maximum allocatable memory for given number of nodes
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetParity(ctx *middleware.Context, handler GetParityHandler) *GetParity
|
||||
return &GetParity{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetParity swagger:route GET /get-parity/{nodes}/{disksPerNode} AdminAPI getParity
|
||||
/* GetParity swagger:route GET /get-parity/{nodes}/{disksPerNode} OperatorAPI getParity
|
||||
|
||||
Gets parity by sending number of nodes & number of disks
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetPodEvents(ctx *middleware.Context, handler GetPodEventsHandler) *GetP
|
||||
return &GetPodEvents{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetPodEvents swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events AdminAPI getPodEvents
|
||||
/* GetPodEvents swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events OperatorAPI getPodEvents
|
||||
|
||||
Get Events for Pod
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetPodLogs(ctx *middleware.Context, handler GetPodLogsHandler) *GetPodLo
|
||||
return &GetPodLogs{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetPodLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName} AdminAPI getPodLogs
|
||||
/* GetPodLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName} OperatorAPI getPodLogs
|
||||
|
||||
Get Logs for Pod
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetResourceQuota(ctx *middleware.Context, handler GetResourceQuotaHandle
|
||||
return &GetResourceQuota{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetResourceQuota swagger:route GET /namespaces/{namespace}/resourcequotas/{resource-quota-name} AdminAPI getResourceQuota
|
||||
/* GetResourceQuota swagger:route GET /namespaces/{namespace}/resourcequotas/{resource-quota-name} OperatorAPI getResourceQuota
|
||||
|
||||
Get Resource Quota
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetTenantPods(ctx *middleware.Context, handler GetTenantPodsHandler) *Ge
|
||||
return &GetTenantPods{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetTenantPods swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods AdminAPI getTenantPods
|
||||
/* GetTenantPods swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods OperatorAPI getTenantPods
|
||||
|
||||
Get Pods For The Tenant
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetTenantUsage(ctx *middleware.Context, handler GetTenantUsageHandler) *
|
||||
return &GetTenantUsage{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetTenantUsage swagger:route GET /namespaces/{namespace}/tenants/{tenant}/usage AdminAPI getTenantUsage
|
||||
/* GetTenantUsage swagger:route GET /namespaces/{namespace}/tenants/{tenant}/usage OperatorAPI getTenantUsage
|
||||
|
||||
Get Usage For The Tenant
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewGetTenantYAML(ctx *middleware.Context, handler GetTenantYAMLHandler) *Ge
|
||||
return &GetTenantYAML{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetTenantYAML swagger:route GET /namespaces/{namespace}/tenants/{tenant}/yaml AdminAPI getTenantYAML
|
||||
/* GetTenantYAML swagger:route GET /namespaces/{namespace}/tenants/{tenant}/yaml OperatorAPI getTenantYAML
|
||||
|
||||
Get the Tenant YAML
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
@@ -48,7 +48,7 @@ func NewListAllTenants(ctx *middleware.Context, handler ListAllTenantsHandler) *
|
||||
return &ListAllTenants{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* ListAllTenants swagger:route GET /tenants AdminAPI listAllTenants
|
||||
/* ListAllTenants swagger:route GET /tenants OperatorAPI listAllTenants
|
||||
|
||||
List Tenant of All Namespaces
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package admin_api
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user