Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ build-windows: save-version gen-version $(BUILD_UI) ## Build for Windows
# Target: build-ui
# Description: Builds the UI for the dashboard.
# Usage: make build-ui
# TODO: use env var to define the build mode
.PHONY: build-ui
build-ui: gen-version ## Build UI for the dashboard
@echo "🧀 Building UI for the dashboard ..."
Expand Down Expand Up @@ -292,3 +293,33 @@ check: ## Check the lint, test, and build
@$(MAKE) build || (echo "❌ Build check failed!" && exit 1)
@echo "✅ Build check passed!"
@echo "🎉 All checks passed successfully!"

# controller-gen path
CONTROLLER_GEN = ${GOPATH}/bin/controller-gen
# controller-gen version
CONTROLLER_GEN_VERSION = v0.17.1

# Target: install-controller-gen
# Description: Install controller_gen.
# Usage:
# make install-controller-gen
.PHONY: install-controller-gen
install-controller-gen:
$(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)

# Target: generate-crds
# Description: Generate CRDs into a special dir.
# Usage:
# make generate-crds
.PHONY: generate-crds
generate-crds:
@# generate rbac, webhook and crds
$(CONTROLLER_GEN) crd paths="./pkg/kubernetes/apis/cluster/v1beta1/..." output:crd:artifacts:config=config/crds/
$(CONTROLLER_GEN) crd paths="./pkg/kubernetes/apis/search/v1beta1/..." output:crd:artifacts:config=config/crds/

# Target: manifests
# Description: Install controller_gen and generate CRDs into a special dir.
# Usage:
# make manifests
.PHONY: manifests
manifests: install-controller-gen generate-crds
85 changes: 85 additions & 0 deletions api/openapispec/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,20 @@ var doc = `{
"name": "description",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "cluster mode",
"name": "clusterMode",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "cluster scale level",
"name": "clusterLevel",
"in": "formData",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -920,6 +934,69 @@ var doc = `{
}
}
},
"/rest-api/v1/cluster/{clusterName}/agentYml": {
"get": {
"description": "Obtain the agent yaml in secret for cluster.",
"consumes": [
"text/plain",
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"cluster"
],
"summary": "Get agent yaml",
"parameters": [
{
"type": "string",
"description": "The name of the cluster",
"name": "clusterName",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Verification passed server version",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"429": {
"description": "Too Many Requests",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/rest-api/v1/clusters": {
"get": {
"description": "This endpoint lists all cluster resources.",
Expand Down Expand Up @@ -2265,6 +2342,14 @@ var doc = `{
"cluster.ClusterPayload": {
"type": "object",
"properties": {
"clusterLevel": {
"description": "clusterLevel is the scale level of cluster to be created",
"type": "integer"
},
"clusterMode": {
"description": "ClusterMode is the mode of cluster to be created",
"type": "string"
},
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"type": "string"
Expand Down
85 changes: 85 additions & 0 deletions api/openapispec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,20 @@
"name": "description",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "cluster mode",
"name": "clusterMode",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "cluster scale level",
"name": "clusterLevel",
"in": "formData",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -904,6 +918,69 @@
}
}
},
"/rest-api/v1/cluster/{clusterName}/agentYml": {
"get": {
"description": "Obtain the agent yaml in secret for cluster.",
"consumes": [
"text/plain",
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"cluster"
],
"summary": "Get agent yaml",
"parameters": [
{
"type": "string",
"description": "The name of the cluster",
"name": "clusterName",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Verification passed server version",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"429": {
"description": "Too Many Requests",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/rest-api/v1/clusters": {
"get": {
"description": "This endpoint lists all cluster resources.",
Expand Down Expand Up @@ -2249,6 +2326,14 @@
"cluster.ClusterPayload": {
"type": "object",
"properties": {
"clusterLevel": {
"description": "clusterLevel is the scale level of cluster to be created",
"type": "integer"
},
"clusterMode": {
"description": "ClusterMode is the mode of cluster to be created",
"type": "string"
},
"description": {
"description": "ClusterDescription is the description of cluster to be created",
"type": "string"
Expand Down
58 changes: 58 additions & 0 deletions api/openapispec/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ definitions:
type: object
cluster.ClusterPayload:
properties:
clusterLevel:
description: clusterLevel is the scale level of cluster to be created
type: integer
clusterMode:
description: ClusterMode is the mode of cluster to be created
type: string
description:
description: ClusterDescription is the description of cluster to be created
type: string
Expand Down Expand Up @@ -774,6 +780,48 @@ paths:
summary: Update updates the cluster metadata by name.
tags:
- cluster
/rest-api/v1/cluster/{clusterName}/agentYml:
get:
consumes:
- text/plain
- application/json
description: Obtain the agent yaml in secret for cluster.
parameters:
- description: The name of the cluster
in: path
name: clusterName
required: true
type: string
produces:
- application/json
responses:
"200":
description: Verification passed server version
schema:
type: string
"400":
description: Bad Request
schema:
type: string
"401":
description: Unauthorized
schema:
type: string
"404":
description: Not Found
schema:
type: string
"429":
description: Too Many Requests
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Get agent yaml
tags:
- cluster
/rest-api/v1/cluster/config/file:
post:
consumes:
Expand All @@ -800,6 +848,16 @@ paths:
name: description
required: true
type: string
- description: cluster mode
in: formData
name: clusterMode
required: true
type: string
- description: cluster scale level
in: formData
name: clusterLevel
required: true
type: integer
produces:
- text/plain
responses:
Expand Down
7 changes: 4 additions & 3 deletions cmd/cert-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ import (
"k8s.io/apiserver/pkg/server"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/component-base/cli"
"k8s.io/klog/v2"
)

func main() {
ctx := server.SetupSignalContext()
command := NewCertGeneratorCommand(ctx)
code := cli.Run(command)
os.Exit(code)
if err := command.Execute(); err != nil {
klog.Fatal(err)
}
}

func NewCertGeneratorCommand(ctx context.Context) *cobra.Command {
Expand Down
Loading