diff --git a/api/api-rules/violation_exceptions.list b/api/api-rules/violation_exceptions.list index 3839cffa3..89253301d 100644 --- a/api/api-rules/violation_exceptions.list +++ b/api/api-rules/violation_exceptions.list @@ -1,6 +1,6 @@ -API rule violation: list_type_missing,./pkg/apis/devops/v1alpha3,DevOpsProjectList,Items -API rule violation: list_type_missing,./pkg/apis/devops/v1alpha3,NoScmPipeline,Parameters -API rule violation: list_type_missing,./pkg/apis/devops/v1alpha3,PipelineList,Items +API rule violation: list_type_missing,./staging/src/kubesphere.io/api/devops/v1alpha3,DevOpsProjectList,Items +API rule violation: list_type_missing,./staging/src/kubesphere.io/api/devops/v1alpha3,NoScmPipeline,Parameters +API rule violation: list_type_missing,./staging/src/kubesphere.io/api/devops/v1alpha3,PipelineList,Items API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroup,ServerAddressByClientCIDRs API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroup,Versions API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,APIGroupList,Groups @@ -29,63 +29,63 @@ API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,Table API rule violation: list_type_missing,k8s.io/apimachinery/pkg/apis/meta/v1,UpdateOptions,DryRun API rule violation: list_type_missing,k8s.io/apimachinery/pkg/runtime,RawExtension,Raw API rule violation: list_type_missing,k8s.io/apimachinery/pkg/runtime,Unknown,Raw -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,ApiUri -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,CloneOption -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,DiscoverBranches -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,DiscoverPRFromForks -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,DiscoverPRFromOrigin -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,DiscoverTags -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,RegexFilter -API rule violation: names_match,./pkg/apis/devops/v1alpha3,BitbucketServerSource,ScmId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,DiscarderProperty,DaysToKeep -API rule violation: names_match,./pkg/apis/devops/v1alpha3,DiscarderProperty,NumToKeep -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,CloneOption -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,DiscoverBranches -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,DiscoverTags -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,RegexFilter -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitSource,ScmId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,ApiUri -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,CloneOption -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,DiscoverBranches -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,DiscoverPRFromForks -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,DiscoverPRFromOrigin -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,DiscoverTags -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,RegexFilter -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GithubSource,ScmId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,ApiUri -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,CloneOption -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,DiscoverBranches -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,DiscoverPRFromForks -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,DiscoverPRFromOrigin -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,DiscoverTags -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,RegexFilter -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,ScmId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,GitlabSource,ServerName -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchJobTrigger,CreateActionJobsToTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchJobTrigger,DeleteActionJobsToTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,BitbucketServerSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,GitHubSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,GitSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,GitlabSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,MultiBranchJobTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,ScriptPath -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,SingleSvnSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,SourceType -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,SvnSource -API rule violation: names_match,./pkg/apis/devops/v1alpha3,MultiBranchPipeline,TimerTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,NoScmPipeline,DisableConcurrent -API rule violation: names_match,./pkg/apis/devops/v1alpha3,NoScmPipeline,RemoteTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,NoScmPipeline,TimerTrigger -API rule violation: names_match,./pkg/apis/devops/v1alpha3,Parameter,DefaultValue -API rule violation: names_match,./pkg/apis/devops/v1alpha3,PipelineSpec,MultiBranchPipeline -API rule violation: names_match,./pkg/apis/devops/v1alpha3,SingleSvnSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,SingleSvnSource,ScmId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,SvnSource,CredentialId -API rule violation: names_match,./pkg/apis/devops/v1alpha3,SvnSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,ApiUri +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,CloneOption +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,DiscoverBranches +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,DiscoverPRFromForks +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,DiscoverPRFromOrigin +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,DiscoverTags +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,RegexFilter +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,BitbucketServerSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,DiscarderProperty,DaysToKeep +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,DiscarderProperty,NumToKeep +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,CloneOption +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,DiscoverBranches +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,DiscoverTags +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,RegexFilter +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,ApiUri +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,CloneOption +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,DiscoverBranches +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,DiscoverPRFromForks +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,DiscoverPRFromOrigin +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,DiscoverTags +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,RegexFilter +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GithubSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,ApiUri +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,CloneOption +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,DiscoverBranches +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,DiscoverPRFromForks +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,DiscoverPRFromOrigin +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,DiscoverTags +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,RegexFilter +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,GitlabSource,ServerName +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchJobTrigger,CreateActionJobsToTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchJobTrigger,DeleteActionJobsToTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,BitbucketServerSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,GitHubSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,GitSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,GitlabSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,MultiBranchJobTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,ScriptPath +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,SingleSvnSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,SourceType +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,SvnSource +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,MultiBranchPipeline,TimerTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,NoScmPipeline,DisableConcurrent +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,NoScmPipeline,RemoteTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,NoScmPipeline,TimerTrigger +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,Parameter,DefaultValue +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,PipelineSpec,MultiBranchPipeline +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,SingleSvnSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,SingleSvnSource,ScmId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,SvnSource,CredentialId +API rule violation: names_match,./staging/src/kubesphere.io/api/devops/v1alpha3,SvnSource,ScmId API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,APIResourceList,APIResources API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Duration,Duration API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Object diff --git a/api/ks-openapi-spec/swagger.json b/api/ks-openapi-spec/swagger.json index 995e8d9c1..b74bd79d9 100644 --- a/api/ks-openapi-spec/swagger.json +++ b/api/ks-openapi-spec/swagger.json @@ -135,6 +135,754 @@ ] }, "paths": { + "/kapis/alerting.kubesphere.io/v2alpha1/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the alerts of the cluster-level custom alerting rules", + "operationId": "handleListCustomRulesAlerts", + "parameters": [ + { + "type": "string", + "description": "state, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/builtin/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the alerts of the builtin(non-custom) rules", + "operationId": "handleListBuiltinRulesAlerts", + "parameters": [ + { + "type": "string", + "description": "state, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/builtin/rules": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the builtin(non-custom) alerting rules", + "operationId": "handleListBuiltinAlertingRules", + "parameters": [ + { + "type": "string", + "description": "rule name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "state of a rule based on its alerts, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "health state of a rule based on the last execution, one of `ok`, `err`, `unknown`", + "name": "health", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "string", + "description": "sort field, one of `name`, `lastEvaluation`, `evaluationTime`", + "name": "sort_field", + "in": "query" + }, + { + "type": "string", + "description": "sort type, one of `asc`, `desc`", + "name": "sort_type", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRuleList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/builtin/rules/{rule_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "get the builtin(non-custom) alerting rule with specified id", + "operationId": "handleGetBuiltinAlertingRule", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRule" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/builtin/rules/{rule_id}/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the alerts of the builtin(non-custom) alerting rule with the specified id", + "operationId": "handleListBuiltinRuleAlerts", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/bulkrules": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "create or update cluster-level custom alerting rules in bulk", + "operationId": "handleCreateOrUpdateCustomAlertingRules", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.BulkResponse" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/namespaces/{namespace}/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the alerts of the custom alerting rules in the specified namespace.", + "operationId": "handleListCustomRulesAlerts", + "parameters": [ + { + "type": "string", + "description": "state, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/namespaces/{namespace}/bulkrules": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "create or update custom alerting rules in bulk in the specified namespace", + "operationId": "handleCreateOrUpdateCustomAlertingRules", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.BulkResponse" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/namespaces/{namespace}/rules": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the custom alerting rules in the specified namespace", + "operationId": "handleListCustomAlertingRules", + "parameters": [ + { + "type": "string", + "description": "rule name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "state of a rule based on its alerts, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "health state of a rule based on the last execution, one of `ok`, `err`, `unknown`", + "name": "health", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "string", + "description": "sort field, one of `name`, `lastEvaluation`, `evaluationTime`", + "name": "sort_field", + "in": "query" + }, + { + "type": "string", + "description": "sort type, one of `asc`, `desc`", + "name": "sort_type", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRuleList" + } + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "create a custom alerting rule in the specified namespace", + "operationId": "handleCreateCustomAlertingRule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "delete multiple custom alerting rules in the specified namespace", + "operationId": "handleDeleteCustomAlertingRules", + "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "rule name", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.BulkResponse" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/namespaces/{namespace}/rules/{rule_name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "get the custom alerting rule with the specified name in the specified namespace", + "operationId": "handleGetCustomAlertingRule", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRule" + } + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "update the custom alerting rule with the specified name in the specified namespace", + "operationId": "handleUpdateCustomAlertingRule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "delete the custom alerting rule with the specified rule name in the specified namespace", + "operationId": "handleDeleteCustomAlertingRule", + "responses": { + "200": { + "description": "ok" + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/namespaces/{namespace}/rules/{rule_name}/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "get the alerts of the custom alerting rule with the specified name in the specified namespace", + "operationId": "handleListCustomRuleAlerts", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/rules": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the cluster-level custom alerting rules", + "operationId": "handleListCustomAlertingRules", + "parameters": [ + { + "type": "string", + "description": "rule name", + "name": "name", + "in": "query" + }, + { + "type": "string", + "description": "state of a rule based on its alerts, one of `firing`, `pending`, `inactive`", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "health state of a rule based on the last execution, one of `ok`, `err`, `unknown`", + "name": "health", + "in": "query" + }, + { + "type": "string", + "format": "key=%s,key~%s", + "description": "label filters, concatenating multiple filters with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "label_filters", + "in": "query" + }, + { + "type": "string", + "description": "sort field, one of `name`, `lastEvaluation`, `evaluationTime`", + "name": "sort_field", + "in": "query" + }, + { + "type": "string", + "description": "sort type, one of `asc`, `desc`", + "name": "sort_type", + "in": "query" + }, + { + "type": "integer", + "default": 1, + "description": "page of the result set", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 10, + "description": "limit size of the result set", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRuleList" + } + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "create a cluster-level custom alerting rule", + "operationId": "handleCreateCustomAlertingRule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + ], + "responses": { + "200": { + "description": "ok" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "delete multiple cluster-level custom alerting rules", + "operationId": "handleDeleteCustomAlertingRules", + "parameters": [ + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "rule name", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.BulkResponse" + } + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/rules/{rule_name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "get the cluster-level custom alerting rule with the specified name", + "operationId": "handleGetCustomAlertingRule", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRule" + } + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "update the cluster-level custom alerting rule with the specified name", + "operationId": "handleUpdateCustomAlertingRule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v2alpha1.PostableAlertingRule" + } + } + ], + "responses": { + "200": { + "description": "ok" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "delete the cluster-level custom alerting rule with the specified name", + "operationId": "handleDeleteCustomAlertingRule", + "responses": { + "200": { + "description": "ok" + } + } + } + }, + "/kapis/alerting.kubesphere.io/v2alpha1/rules/{rule_name}/alerts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Alerting" + ], + "summary": "list the alerts of the cluster-level custom alerting rule with the specified name", + "operationId": "handleListCustomRuleAlerts", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v2alpha1.AlertList" + } + } + } + } + }, "/kapis/cluster.kubesphere.io/v1alpha1/clusters/validation": { "post": { "produces": [ @@ -185,126 +933,56 @@ } } }, - "/kapis/devops.kubesphere.io/v1alpha2/crumbissuer": { + "/kapis/devops.kubesphere.io/v1alpha2/{path}": { "get": { "produces": [ "application/json" ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get crumb issuer. A CrumbIssuer represents an algorithm to generate a nonce value, known as a crumb, to counter cross site request forgery exploits. Crumbs are typically hashes incorporating information that uniquely identifies an agent that sends a request, along with a guarded secret so that the crumb value cannot be forged by a third party.", - "operationId": "GetCrumb", + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.Crumb" - } + "description": "ok" } } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/checkCron": { + }, + "put": { + "produces": [ + "application/json" + ], + "operationId": "handler", + "responses": { + "200": { + "description": "ok" + } + } + }, "post": { "produces": [ - "application/json", - "charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Check cron script compile.", - "operationId": "CheckCron", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.CronData" - } - } + "application/json" ], + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.CheckCronRes" - } + "description": "ok" } } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/credentials/{credential}/usage": { - "get": { + }, + "delete": { "produces": [ "application/json" ], - "tags": [ - "DevOps Credential" - ], - "summary": "Get the specified credential usage of the DevOps project", - "operationId": "GetProjectCredentialUsage", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "credential's ID, e.g. dockerhub-id", - "name": "credential", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.Credential" - } + "description": "ok" } } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/jenkins/{path}": { - "get": { + }, + "patch": { "produces": [ "application/json" ], - "tags": [ - "Jenkins" - ], - "operationId": "func2", - "parameters": [ - { - "pattern": "*", - "type": "string", - "description": "Path stands for any suffix path.", - "name": "path", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { "description": "ok" @@ -312,2123 +990,37 @@ } } }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}": { + "/kapis/devops.kubesphere.io/v1alpha3/{path}": { "get": { "produces": [ "application/json" ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get the specified pipeline of the DevOps project", - "operationId": "GetPipeline", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.Pipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get all branches in the specified pipeline.", - "operationId": "GetPipelineBranch", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "filter=%s", - "description": "filter remote scm. e.g. origin", - "name": "filter", - "in": "query" - }, - { - "type": "string", - "format": "start=%d", - "default": "start=0", - "description": "the count of branches start.", - "name": "start", - "in": "query" - }, - { - "type": "string", - "format": "limit=%d", - "default": "limit=100", - "description": "the count of branches limit.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineBranch" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get the specified branch pipeline of the DevOps project", - "operationId": "GetBranchPipeline", - "parameters": [ - { - "type": "string", - "description": "the name of devops project", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch", - "name": "branch", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.BranchPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Run the specified pipeline of the DevOps project.", - "operationId": "RunBranchPipeline", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.RunPayload" - } - }, - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.RunPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get details in the specified pipeline activity.", - "operationId": "GetBranchPipelineRun", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run id, the unique id for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.PipelineRun" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/artifacts": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get all artifacts generated from the specified run of the pipeline branch.", - "operationId": "GetBranchArtifacts", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - }, - { - "type": "string", - "format": "limit=%d", - "description": "the limit item count of the search.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "The filed of \"Url\" in response can download artifacts", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.Artifacts" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/log": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get run logs of the specified pipeline activity.", - "operationId": "GetBranchRunLog", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "default": "start=0", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get run nodes.", - "operationId": "GetBranchPipelineRunNodes", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run id, the unique id for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "limit=%d", - "default": "limit=10000", - "description": "the limit item count of the search.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipelineRunNodes" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get all steps in the specified node.", - "operationId": "GetBranchNodeSteps", - "parameters": [ - { - "type": "string", - "description": "the name of devops project", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node ID, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodeSteps" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step}": { - "post": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Proceed or Break the paused pipeline which waiting for user input.", - "operationId": "SubmitBranchInputStep", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node ID, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline step ID, the step in pipeline.", - "name": "step", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.CheckPlayload" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step}/log": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get the step logs in the specified pipeline activity.", - "operationId": "GetBranchStepLog", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run id, the unique id for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node id, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline step id, the step in pipeline.", - "name": "step", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "default": "start=0", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodesdetail": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Get steps details in an activity node. For a node, the steps which is defined inside the node.", - "operationId": "GetBranchNodesDetail", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodesDetail" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/replay": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Replay the specified pipeline of the DevOps project", - "operationId": "ReplayBranchPipeline", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.ReplayPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/stop": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "(MultiBranchesPipeline) Stop the specified pipeline of the DevOps project.", - "operationId": "StopBranchPipeline", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of branch, same as repository branch.", - "name": "branch", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "blocking=%t", - "default": "blocking=false", - "description": "stop and between each retries will sleep.", - "name": "blocking", - "in": "query" - }, - { - "type": "string", - "format": "timeOutInSecs=%d", - "default": "timeOutInSecs=10", - "description": "the time of stop and between each retries sleep.", - "name": "timeOutInSecs", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.StopPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/checkScriptCompile": { - "post": { - "consumes": [ - "application/x-www-form-urlencoded", - "charset=utf-8" - ], - "produces": [ - "application/json", - "charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Check pipeline script compile.", - "operationId": "CheckScriptCompile", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "pipeline=%s", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.ReqScript" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.CheckScript" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/consolelog": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get scan reponsitory logs in the specified pipeline.", - "operationId": "GetConsoleLog", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get all runs of the specified pipeline", - "operationId": "ListPipelineRuns", - "parameters": [ - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "description": "the item number that the search starts from", - "name": "start", - "in": "query" - }, - { - "type": "string", - "format": "limit=%d", - "description": "the limit item count of the search", - "name": "limit", - "in": "query" - }, - { - "type": "string", - "format": "branch=%s", - "description": "the name of branch, same as repository branch, will be filtered by branch.", - "name": "branch", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.PipelineRunList" - } - } - } - }, - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Run pipeline.", - "operationId": "RunPipeline", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.RunPayload" - } - }, - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.RunPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get details in the specified pipeline activity.", - "operationId": "GetPipelineRun", - "parameters": [ - { - "type": "string", - "description": "the name of devops project", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.PipelineRun" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/artifacts": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get all artifacts in the specified pipeline.", - "operationId": "GetArtifacts", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - }, - { - "type": "string", - "format": "limit=%d", - "description": "the limit item count of the search.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "The filed of \"Url\" in response can download artifacts", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.Artifacts" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/log": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get run logs of the specified pipeline activity.", - "operationId": "GetRunLog", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "default": "start=0", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get all nodes in the specified activity. node is the stage in the pipeline task", - "operationId": "GetPipelineRunNodes", - "parameters": [ - { - "type": "string", - "description": "the name of devops project", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRunNodes" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get all steps in the specified node.", - "operationId": "GetNodeSteps", - "parameters": [ - { - "type": "string", - "description": "the name of devops project", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node ID, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodeSteps" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}": { - "post": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Proceed or Break the paused pipeline which is waiting for user input.", - "operationId": "SubmitInputStep", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.CheckPlayload" - } - }, - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node ID, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline step ID", - "name": "step", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}/log": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get pipelines step log.", - "operationId": "GetStepLog", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline node ID, the stage in pipeline.", - "name": "node", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline step ID, the step in pipeline.", - "name": "step", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "start=%d", - "default": "start=0", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodesdetail": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Get steps details inside a activity node. For a node, the steps which defined inside the node.", - "operationId": "GetNodesDetail", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodesDetail" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/replay": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Replay pipeline", - "operationId": "ReplayPipeline", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.ReplayPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/runs/{run}/stop": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Stop pipeline", - "operationId": "StopPipeline", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline run ID, the unique ID for a pipeline once build.", - "name": "run", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "blocking=%t", - "default": "blocking=false", - "description": "stop and between each retries will sleep.", - "name": "blocking", - "in": "query" - }, - { - "type": "string", - "format": "timeOutInSecs=%d", - "default": "timeOutInSecs=10", - "description": "the time of stop and between each retries sleep.", - "name": "timeOutInSecs", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.StopPipeline" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/devops/{devops}/pipelines/{pipeline}/scan": { - "post": { - "produces": [ - "text/html; charset=utf-8" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Scan remote Repository, Start a build if have new branch.", - "operationId": "ScanBranch", - "parameters": [ - { - "type": "string", - "description": "DevOps project's ID, e.g. project-RRRRAzLBlLEm", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "the name of the CI/CD pipeline", - "name": "pipeline", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "delay=%d", - "description": "the delay time to scan", - "name": "delay", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/jenkins/{path}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "Jenkins" - ], - "operationId": "func1", - "parameters": [ - { - "pattern": "*", - "type": "string", - "description": "Path stands for any suffix path.", - "name": "path", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { "description": "ok" } } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/scms/{scm}/organizations": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Scm" - ], - "summary": "List all organizations of the specified source configuration management (SCM) such as Github.", - "operationId": "GetSCMOrg", - "parameters": [ - { - "type": "string", - "description": "the ID of the source configuration management (SCM).", - "name": "scm", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "credentialId=%s", - "description": "credential ID for source configuration management (SCM).", - "name": "credentialId", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.SCMOrg" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/scms/{scm}/organizations/{organization}/repositories": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Scm" - ], - "summary": "List all repositories in the specified organization.", - "operationId": "GetOrgRepo", - "parameters": [ - { - "type": "string", - "description": "The ID of the source configuration management (SCM).", - "name": "scm", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "organization ID, such as github username.", - "name": "organization", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "credentialId=%s", - "description": "credential ID for SCM.", - "name": "credentialId", - "in": "query", - "required": true - }, - { - "type": "string", - "format": "pageNumber=%d", - "description": "page number.", - "name": "pageNumber", - "in": "query", - "required": true - }, - { - "type": "string", - "format": "pageSize=%d", - "description": "the item count of one page.", - "name": "pageSize", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.OrgRepo" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/scms/{scm}/servers": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Scm" - ], - "summary": "List all servers in the jenkins.", - "operationId": "GetSCMServers", - "parameters": [ - { - "type": "string", - "description": "The ID of the source configuration management (SCM).", - "name": "scm", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.SCMServer" - } - } - } - } - }, - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Scm" - ], - "summary": "Create scm server in the jenkins.", - "operationId": "CreateSCMServers", - "parameters": [ - { - "type": "string", - "description": "The ID of the source configuration management (SCM).", - "name": "scm", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.CreateScmServerReq" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.SCMServer" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/scms/{scm}/verify": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Scm" - ], - "summary": "Validate the access token of the specified source configuration management (SCM) such as Github", - "operationId": "Validate", - "parameters": [ - { - "type": "string", - "description": "the ID of the source configuration management (SCM).", - "name": "scm", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.Validates" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/search": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "Search DevOps resource. More info: https://github.com/jenkinsci/blueocean-plugin/tree/master/blueocean-rest#get-pipelines-across-organization", - "operationId": "ListPipelines", - "parameters": [ - { - "type": "string", - "format": "q=%s", - "description": "query pipelines, condition for filtering.", - "name": "q", - "in": "query", - "required": true - }, - { - "type": "string", - "format": "filter=%s", - "description": "Filter some types of jobs. e.g. no-folder,will not get a job of type folder", - "name": "filter", - "in": "query" - }, - { - "type": "string", - "format": "start=%d", - "description": "the item number that the search starts from.", - "name": "start", - "in": "query" - }, - { - "type": "string", - "format": "limit=%d", - "description": "the limit item count of the search.", - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.PipelineList" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/tojenkinsfile": { - "post": { - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/json", - "charset=utf-8" - ], - "tags": [ - "DevOps Jenkinsfile" - ], - "summary": "Convert json to jenkinsfile format.", - "operationId": "ToJenkinsfile", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.ReqJson" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.ResJenkinsfile" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/tojson": { - "post": { - "consumes": [ - "application/x-www-form-urlencoded" - ], - "produces": [ - "application/json", - "charset=utf-8" - ], - "tags": [ - "DevOps Jenkinsfile" - ], - "summary": "Convert jenkinsfile to json format. Usually the frontend uses json to show or edit pipeline", - "operationId": "ToJson", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/devops.ReqJenkinsfile" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/devops.ResJson" - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/webhook/git": { - "get": { - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Webhook" - ], - "summary": "Get commit notification by HTTP GET method. Git webhook will request here.", - "operationId": "GetNotifyCommit", - "parameters": [ - { - "type": "string", - "format": "url=%s", - "description": "Git url", - "name": "url", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - }, - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "text/plain; charset=utf-8" - ], - "tags": [ - "DevOps Webhook" - ], - "summary": "Get commit notification by HTTP POST method. Git webhook will request here.", - "operationId": "PostNotifyCommit", - "parameters": [ - { - "type": "string", - "format": "url=%s", - "description": "Git url", - "name": "url", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha2/webhook/github": { - "post": { - "consumes": [ - "application/x-www-form-urlencoded", - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Webhook" - ], - "summary": "Get commit notification. Github webhook will request here.", - "operationId": "GithubWebhook", - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/devops/{devops}/credentials": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "list the credentials of the specified devops for the current user", - "operationId": "ListCredential", - "parameters": [ - { - "type": "string", - "description": "devops name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "name used to do filtering", - "name": "name", - "in": "query" - }, - { - "type": "string", - "format": "page=%d", - "default": "page=1", - "description": "page", - "name": "page", - "in": "query" - }, - { - "type": "string", - "description": "limit", - "name": "limit", - "in": "query" - }, - { - "type": "string", - "default": "ascending=false", - "description": "sort parameters, e.g. ascending=false", - "name": "ascending", - "in": "query" - }, - { - "type": "string", - "description": "sort parameters, e.g. orderBy=createTime", - "name": "sortBy", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/api.ListResult" - } - } - } - }, - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "create the credential of the specified devops for the current user", - "operationId": "CreateCredential", - "parameters": [ - { - "type": "string", - "description": "devops name", - "name": "devops", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Pipeline" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/devops/{devops}/credentials/{credential}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "get the credential of the specified devops for the current user", - "operationId": "GetCredential", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline name", - "name": "credential", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.Secret" - } - } - } - } }, "put": { "produces": [ "application/json" ], - "tags": [ - "DevOps Project" - ], - "summary": "put the credential of the specified devops for the current user", - "operationId": "UpdateCredential", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "credential name", - "name": "credential", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.Secret" - } - } + "description": "ok" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "operationId": "handler", + "responses": { + "200": { + "description": "ok" } } }, @@ -2436,396 +1028,21 @@ "produces": [ "application/json" ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "delete the credential of the specified devops for the current user", - "operationId": "DeleteCredential", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "credential name", - "name": "credential", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.Secret" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/devops/{devops}/pipelines": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "list the pipelines of the specified devops for the current user", - "operationId": "ListPipeline", - "parameters": [ - { - "type": "string", - "description": "devops name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "limit=%d,page=%d", - "default": "limit=10,page=1", - "description": "paging query, e.g. limit=100,page=1", - "name": "paging", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/api.ListResult" - } + "description": "ok" } } }, - "post": { + "patch": { "produces": [ "application/json" ], - "tags": [ - "DevOps Project" - ], - "summary": "create the pipeline of the specified devops for the current user", - "operationId": "CreatePipeline", - "parameters": [ - { - "type": "string", - "description": "devops name", - "name": "devops", - "in": "path", - "required": true - } - ], + "operationId": "handler", "responses": { "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Pipeline" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/devops/{devops}/pipelines/{pipeline}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "get the pipeline of the specified devops for the current user", - "operationId": "getPipelineByName", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline name", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Pipeline" - } - } - } - } - }, - "put": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "put the pipeline of the specified devops for the current user", - "operationId": "UpdatePipeline", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline name", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Pipeline" - } - } - } - } - }, - "delete": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Pipeline" - ], - "summary": "delete the pipeline of the specified devops for the current user", - "operationId": "DeletePipeline", - "parameters": [ - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "pipeline name", - "name": "pipeline", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Pipeline" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/workspaces/{workspace}/devops": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "List the devopsproject of the specified workspace for the current user", - "operationId": "ListDevOpsProject", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "format": "limit=%d,page=%d", - "default": "limit=10,page=1", - "description": "paging query, e.g. limit=100,page=1", - "name": "paging", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/api.ListResult" - } - } - } - }, - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "Create the devopsproject of the specified workspace for the current user", - "operationId": "CreateDevOpsProject", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.DevOpsProject" - } - } - } - } - } - }, - "/kapis/devops.kubesphere.io/v1alpha3/workspaces/{workspace}/devops/{devops}": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "Get the devopsproject of the specified workspace for the current user", - "operationId": "GetDevOpsProject", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.DevOpsProject" - } - } - } - } - }, - "put": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "Put the devopsproject of the specified workspace for the current user", - "operationId": "UpdateDevOpsProject", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.DevOpsProject" - } - } - } - } - }, - "delete": { - "produces": [ - "application/json" - ], - "tags": [ - "DevOps Project" - ], - "summary": "Get the devopsproject of the specified workspace for the current user", - "operationId": "DeleteDevOpsProject", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "project name", - "name": "devops", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.DevOpsProject" - } - } + "description": "ok" } } } @@ -3822,49 +2039,6 @@ } } }, - "/kapis/iam.kubesphere.io/v1alpha2/namespace/{namespace}/rolebindings/{rolebinding}": { - "delete": { - "produces": [ - "application/json" - ], - "tags": [ - "Group" - ], - "summary": "Delete rolebinding under namespace.", - "operationId": "DeleteRoleBinding", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "groupbinding name", - "name": "namespace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "groupbinding name", - "name": "rolebinding", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/errors.Error" - } - } - } - } - }, "/kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/members": { "get": { "produces": [ @@ -4126,6 +2300,49 @@ } } }, + "/kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/rolebindings/{rolebinding}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Group" + ], + "summary": "Delete rolebinding under namespace.", + "operationId": "DeleteRoleBinding", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "groupbinding name", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "groupbinding name", + "name": "rolebinding", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } + } + }, "/kapis/iam.kubesphere.io/v1alpha2/namespaces/{namespace}/roles": { "get": { "produces": [ @@ -4579,6 +2796,40 @@ } }, "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/groupbindings": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Group" + ], + "summary": "Retrieve group's members in the workspace.", + "operationId": "ListGroupBindings", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "group name", + "name": "group", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + }, "post": { "produces": [ "application/json" @@ -4828,18 +3079,16 @@ } } } - } - }, - "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/groups/{group}/devopsrolebindings": { - "get": { + }, + "patch": { "produces": [ "application/json" ], "tags": [ "Group" ], - "summary": "Retrieve group's rolebindings of all devops projects in the workspace.", - "operationId": "ListGroupDevOpsRoleBindings", + "summary": "Patch Group", + "operationId": "PatchGroup", "parameters": [ { "type": "string", @@ -4849,60 +3098,25 @@ "required": true }, { - "type": "string", - "description": "group name", - "name": "group", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1alpha2.Group" + } } ], "responses": { "200": { "description": "ok", "schema": { - "$ref": "#/definitions/api.ListResult" + "$ref": "#/definitions/v1alpha2.Group" } } } } }, - "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/groups/{group}/groupbindings": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "Group" - ], - "summary": "Retrieve group's members in the workspace.", - "operationId": "ListGroupBindings", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "group name", - "name": "group", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/api.ListResult" - } - } - } - } - }, - "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/groups/{group}/rolebindings": { + "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/rolebindings": { "get": { "produces": [ "application/json" @@ -4938,42 +3152,6 @@ } } }, - "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/groups/{group}/workspacerolebindings": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "Group" - ], - "summary": "Retrieve group's workspacerolebindings of the workspace.", - "operationId": "ListGroupWorkspaceRoleBindings", - "parameters": [ - { - "type": "string", - "description": "workspace name", - "name": "workspace", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "group name", - "name": "group", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/api.ListResult" - } - } - } - } - }, "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/workspacemembers": { "get": { "produces": [ @@ -5193,6 +3371,40 @@ } }, "/kapis/iam.kubesphere.io/v1alpha2/workspaces/{workspace}/workspacerolebindings": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Group" + ], + "summary": "Retrieve group's workspacerolebindings of the workspace.", + "operationId": "ListGroupWorkspaceRoleBindings", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "group name", + "name": "group", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + }, "post": { "produces": [ "application/json" @@ -6767,6 +4979,12 @@ "description": "Page size, the maximum number of results in a single page. Defaults to 5.", "name": "limit", "in": "query" + }, + { + "type": "string", + "description": "The query type. This field can be set to 'rank' for node ranking query or '' for others. Defaults to ''.", + "name": "type", + "in": "query" } ], "responses": { @@ -6869,6 +5087,12 @@ "name": "resources_filter", "in": "query" }, + { + "type": "string", + "description": "Specifies a namespaced resources filter in `\u003cnamespace\u003e/\u003cpod_name\u003e|\u003cnamespace\u003e/\u003cpod_name\u003e` format. For example, a namespaced resources filter like `ns1/pod1|ns2/pod2` will request the data of pod1 in ns1 together with pod2 in ns2.", + "name": "namespaced_resources_filter", + "in": "query" + }, { "type": "string", "description": "Start time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1559347200. ", @@ -6939,8 +5163,9 @@ "tags": [ "Pod Metrics" ], - "summary": "Get pod-level metric data of a specific pod. Navigate to the pod by the node where it is scheduled.", + "summary": "Get pod-level metric data of a specific pod. Navigate to the pod by the node where it is scheduled. Deprecated: please use `/namespaces/{namespace}/pods/{pod}` or `/pods` instead.", "operationId": "handlePodMetricsQuery", + "deprecated": true, "parameters": [ { "type": "string", @@ -7017,8 +5242,8 @@ }, { "type": "string", - "description": "The pod filter consists of a regexp pattern. It specifies which pod data to return. For example, the following filter matches any pod whose name begins with redis: `redis.*`.", - "name": "resources_filter", + "description": "Specifies a namespaced resources filter in `\u003cnamespace\u003e/\u003cpod_name\u003e|\u003cnamespace\u003e/\u003cpod_name\u003e` format. For example, a namespaced resources filter like `ns1/pod1|ns2/pod2` will request the data of pod1 in ns1 together with pod2 in ns2.", + "name": "namespaced_resources_filter", "in": "query" }, { @@ -7605,10 +5830,11 @@ "application/json" ], "tags": [ - "App Instance" + "OpenPitrix Resources" ], "summary": "List all applications", "operationId": "ListApplications", + "deprecated": true, "parameters": [ { "type": "string", @@ -7642,10 +5868,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "List app templates", "operationId": "ListApps", + "deprecated": true, "parameters": [ { "type": "string", @@ -7689,10 +5916,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Create a new app template", "operationId": "CreateApp", + "deprecated": true, "parameters": [ { "name": "body", @@ -7726,10 +5954,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Describe the specified app template", "operationId": "DescribeApp", + "deprecated": true, "parameters": [ { "type": "string", @@ -7753,10 +5982,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Delete the specified app template", "operationId": "DeleteApp", + "deprecated": true, "parameters": [ { "type": "string", @@ -7778,17 +6008,18 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Patch the specified app template", "operationId": "ModifyApp", + "deprecated": true, "parameters": [ { "name": "body", @@ -7821,11 +6052,9 @@ "produces": [ "application/json" ], - "tags": [ - "App Management" - ], "summary": "Perform recover or suspend operation on app", "operationId": "DoAppAction", + "deprecated": true, "parameters": [ { "type": "string", @@ -7858,10 +6087,11 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "List audits information of the specific app template", "operationId": "ListAppVersionAudits", + "deprecated": true, "parameters": [ { "type": "string", @@ -7887,10 +6117,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Get active versions of app, can filter with these fields(version_id, app_id, name, owner, description, package_name, status, type), default return all active app versions", "operationId": "ListAppVersions", + "deprecated": true, "parameters": [ { "type": "string", @@ -7941,10 +6172,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Create a new app template version", "operationId": "CreateAppVersion", + "deprecated": true, "parameters": [ { "name": "body", @@ -7984,10 +6216,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Describe the specified app template version", "operationId": "DescribeAppVersion", + "deprecated": true, "parameters": [ { "type": "string", @@ -8018,10 +6251,11 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Delete the specified app template version", "operationId": "DeleteAppVersion", + "deprecated": true, "parameters": [ { "type": "string", @@ -8050,17 +6284,18 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Patch the specified app template version", "operationId": "ModifyAppVersion", + "deprecated": true, "parameters": [ { "name": "body", @@ -8101,10 +6336,11 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "Perform submit or other operations on app", "operationId": "DoAppVersionAction", + "deprecated": true, "parameters": [ { "type": "string", @@ -8137,10 +6373,11 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "List audits information of version-specific app template", "operationId": "ListAppVersionAudits", + "deprecated": true, "parameters": [ { "type": "string", @@ -8172,11 +6409,9 @@ "produces": [ "application/json" ], - "tags": [ - "App Template" - ], "summary": "Get app template package files", "operationId": "GetAppVersionFiles", + "deprecated": true, "parameters": [ { "type": "string", @@ -8239,14 +6474,31 @@ } } }, + "/kapis/openpitrix.io/v1/attachments": { + "post": { + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "summary": "Create an attachment", + "operationId": "CreateAttachment", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/openpitrix.Attachment" + } + } + } + } + }, "/kapis/openpitrix.io/v1/attachments/{attachment}": { "get": { "produces": [ "application/json" ], - "tags": [ - "Attachment" - ], "summary": "Get attachment by attachment id", "operationId": "DescribeAttachment", "parameters": [ @@ -8266,6 +6518,30 @@ } } } + }, + "delete": { + "produces": [ + "application/json" + ], + "summary": "Delete one or multiple attachments, whose ids are separated by comma", + "operationId": "DeleteAttachments", + "parameters": [ + { + "type": "string", + "description": "attachment id", + "name": "attachment", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } } }, "/kapis/openpitrix.io/v1/categories": { @@ -8273,9 +6549,6 @@ "produces": [ "application/json" ], - "tags": [ - "Category" - ], "summary": "List categories", "operationId": "ListCategories", "parameters": [ @@ -8321,7 +6594,7 @@ "application/json" ], "tags": [ - "Category" + "OpenPitrix Resources" ], "summary": "Create app template category", "operationId": "CreateCategory", @@ -8358,7 +6631,7 @@ "application/json" ], "tags": [ - "Category" + "OpenPitrix Resources" ], "summary": "Describe the specified category", "operationId": "DescribeCategory", @@ -8385,7 +6658,7 @@ "application/json" ], "tags": [ - "Category" + "OpenPitrix Resources" ], "summary": "Delete the specified category", "operationId": "DeleteCategory", @@ -8410,14 +6683,14 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "Category" + "OpenPitrix Resources" ], "summary": "Patch the specified category", "operationId": "ModifyCategory", @@ -8448,15 +6721,59 @@ } } }, + "/kapis/openpitrix.io/v1/clusters/{cluster}/applications": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "List all applications within the specified cluster", + "operationId": "ListApplications", + "parameters": [ + { + "type": "string", + "format": "key=value,key~value", + "description": "query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "conditions", + "in": "query" + }, + { + "type": "string", + "description": "the cluster of the project.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "limit=%d,page=%d", + "default": "limit=10,page=1", + "description": "paging query, e.g. limit=100,page=1", + "name": "paging", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/models.PageableResponse" + } + } + } + } + }, "/kapis/openpitrix.io/v1/repos": { "get": { "produces": [ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "List repositories in the specified workspace", + "summary": "List global repositories", "operationId": "ListRepos", "parameters": [ { @@ -8501,9 +6818,9 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Create repository in the specified workspace, repository used to store package of app", + "summary": "Create a global repository, which is used to store package of app", "operationId": "CreateRepo", "parameters": [ { @@ -8537,9 +6854,9 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Describe the specified repository in the specified workspace", + "summary": "Describe the specified global repository", "operationId": "DescribeRepo", "parameters": [ { @@ -8564,9 +6881,9 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Delete the specified repository in the specified workspace", + "summary": "Delete the specified global repository", "operationId": "DeleteRepo", "parameters": [ { @@ -8589,16 +6906,16 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Patch the specified repository in the specified workspace", + "summary": "Patch the specified global repository", "operationId": "ModifyRepo", "parameters": [ { @@ -8633,10 +6950,11 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "Start index repository event", "operationId": "DoRepoAction", + "deprecated": true, "parameters": [ { "name": "body", @@ -8670,9 +6988,9 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Get repository events", + "summary": "Get global repository events", "operationId": "ListRepoEvents", "parameters": [ { @@ -8698,9 +7016,6 @@ "produces": [ "application/json" ], - "tags": [ - "App Management" - ], "summary": "Get reviews of version-specific app", "operationId": "ListReviews", "parameters": [ @@ -8730,13 +7045,57 @@ } } }, + "/kapis/openpitrix.io/v1/workspaces/{workspace}/applications": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "List all applications within the specified workspace", + "operationId": "ListApplications", + "parameters": [ + { + "type": "string", + "format": "key=value,key~value", + "description": "query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a", + "name": "conditions", + "in": "query" + }, + { + "type": "string", + "description": "the workspace of the project.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "limit=%d,page=%d", + "default": "limit=10,page=1", + "description": "paging query, e.g. limit=100,page=1", + "name": "paging", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/models.PageableResponse" + } + } + } + } + }, "/kapis/openpitrix.io/v1/workspaces/{workspace}/apps": { "get": { "produces": [ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "List app templates in the specified workspace.", "operationId": "ListApps", @@ -8790,7 +7149,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Create a new app template", "operationId": "CreateApp", @@ -8827,7 +7186,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Describe the specified app template", "operationId": "DescribeApp", @@ -8854,7 +7213,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Delete the specified app template", "operationId": "DeleteApp", @@ -8879,14 +7238,14 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Patch the specified app template", "operationId": "ModifyApp", @@ -8922,9 +7281,6 @@ "produces": [ "application/json" ], - "tags": [ - "App Management" - ], "summary": "Perform recover or suspend operation on app", "operationId": "DoAppAction", "parameters": [ @@ -8959,7 +7315,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Get active versions of app, can filter with these fields(version_id, app_id, name, owner, description, package_name, status, type), default return all active app versions", "operationId": "ListAppVersions", @@ -9013,7 +7369,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Create a new app template version", "operationId": "CreateAppVersion", @@ -9056,7 +7412,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Describe the specified app template version", "operationId": "DescribeAppVersion", @@ -9090,7 +7446,7 @@ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Delete the specified app template version", "operationId": "DeleteAppVersion", @@ -9122,14 +7478,14 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Template" + "OpenPitrix Resources" ], "summary": "Patch the specified app template version", "operationId": "ModifyAppVersion", @@ -9173,7 +7529,7 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "Perform submit or other operations on app", "operationId": "DoAppVersionAction", @@ -9209,7 +7565,7 @@ "application/json" ], "tags": [ - "App Management" + "OpenPitrix Resources" ], "summary": "List audits information of version-specific app template", "operationId": "ListAppVersionAudits", @@ -9245,9 +7601,9 @@ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], - "summary": "List all applications in special cluster", + "summary": "List all applications within the specified cluster", "operationId": "ListApplications", "parameters": [ { @@ -9259,7 +7615,14 @@ }, { "type": "string", - "description": "the name of the cluster.", + "description": "the workspace of the project.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the cluster of the project.", "name": "cluster", "in": "path", "required": true @@ -9283,13 +7646,56 @@ } } }, + "/kapis/openpitrix.io/v1/workspaces/{workspace}/clusters/{cluster}/applications/{application}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Delete the specified application", + "operationId": "DeleteApplication", + "parameters": [ + { + "type": "string", + "description": "the name of the cluster.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the workspaces of the project", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } + } + }, "/kapis/openpitrix.io/v1/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications": { "get": { "produces": [ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "List all applications within the specified namespace", "operationId": "ListApplications", @@ -9301,6 +7707,13 @@ "name": "conditions", "in": "query" }, + { + "type": "string", + "description": "the workspace of the project.", + "name": "workspace", + "in": "path", + "required": true + }, { "type": "string", "description": "the name of the cluster.", @@ -9338,7 +7751,7 @@ "application/json" ], "tags": [ - "App Instance" + "OpenPitrix Resources" ], "summary": "Deploy a new application", "operationId": "CreateApplication", @@ -9382,7 +7795,7 @@ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "Describe the specified application of the namespace", "operationId": "DescribeApplication", @@ -9421,14 +7834,14 @@ "post": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "Upgrade application", "operationId": "UpgradeApplication", @@ -9477,7 +7890,7 @@ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "Delete the specified application", "operationId": "DeleteApplication", @@ -9516,14 +7929,14 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "Modify application", "operationId": "ModifyApplication", @@ -9574,7 +7987,7 @@ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "List all applications within the specified namespace", "operationId": "ListApplications", @@ -9610,6 +8023,41 @@ } } } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Deploy a new application", + "operationId": "CreateApplication", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/openpitrix.CreateClusterRequest" + } + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } } }, "/kapis/openpitrix.io/v1/workspaces/{workspace}/namespaces/{namespace}/applications/{application}": { @@ -9618,7 +8066,7 @@ "application/json" ], "tags": [ - "App Instance" + "Namespace Resources" ], "summary": "Describe the specified application of the namespace", "operationId": "DescribeApplication", @@ -9646,6 +8094,141 @@ } } } + }, + "post": { + "consumes": [ + "application/json", + "application/json-patch+json", + "application/merge-patch+json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Upgrade application", + "operationId": "UpgradeApplication", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/openpitrix.UpgradeClusterRequest" + } + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Delete the specified application", + "operationId": "DeleteApplication", + "parameters": [ + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the workspace of the project", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } + }, + "patch": { + "consumes": [ + "application/json", + "application/json-patch+json", + "application/merge-patch+json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Modify application", + "operationId": "ModifyApplication", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/openpitrix.ModifyClusterAttributesRequest" + } + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } } }, "/kapis/openpitrix.io/v1/workspaces/{workspace}/repos": { @@ -9654,7 +8237,7 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], "summary": "List repositories in the specified workspace", "operationId": "ListRepos", @@ -9701,9 +8284,9 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], - "summary": "Create repository in the specified workspace, repository used to store package of app", + "summary": "Create repository in the specified workspace, which is used to store package of app", "operationId": "CreateRepo", "parameters": [ { @@ -9737,7 +8320,7 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], "summary": "Describe the specified repository in the specified workspace", "operationId": "DescribeRepo", @@ -9764,7 +8347,7 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], "summary": "Delete the specified repository in the specified workspace", "operationId": "DeleteRepo", @@ -9789,14 +8372,14 @@ "patch": { "consumes": [ "application/json", - "application/merge-patch+json", - "application/json-patch+json" + "application/json-patch+json", + "application/merge-patch+json" ], "produces": [ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], "summary": "Patch the specified repository in the specified workspace", "operationId": "ModifyRepo", @@ -9832,9 +8415,6 @@ "produces": [ "application/json" ], - "tags": [ - "App Management" - ], "summary": "Start index repository event", "operationId": "DoRepoAction", "parameters": [ @@ -9870,7 +8450,7 @@ "application/json" ], "tags": [ - "Repository" + "OpenPitrix Resources" ], "summary": "Get repository events", "operationId": "ListRepoEvents", @@ -9893,6 +8473,984 @@ } } }, + "/kapis/openpitrix.io/v2alpha1/applications": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all applications", + "operationId": "ListApplications", + "deprecated": true, + "parameters": [ + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/applications/{application}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Describe the specified application of the namespace", + "operationId": "DescribeApplication", + "parameters": [ + { + "type": "string", + "description": "the name of the cluster.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmRelease" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/apps": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all apps", + "operationId": "ListApps", + "parameters": [ + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/apps/{app}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified app template", + "operationId": "DescribeApp", + "parameters": [ + { + "type": "string", + "description": "app template id", + "name": "app", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmApplication" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/apps/{app}/versions": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all apps", + "operationId": "ListAppVersion", + "parameters": [ + { + "type": "string", + "description": "the id of the app.", + "name": "app", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/apps/{app}/versions/{version}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified app template version", + "operationId": "DescribeAppVersion", + "parameters": [ + { + "type": "string", + "description": "app template version id", + "name": "version", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "app template id", + "name": "app", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmApplication" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/categories": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List categories", + "operationId": "ListCategories", + "parameters": [ + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/categories/{category}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified category", + "operationId": "DescribeCategory", + "parameters": [ + { + "type": "string", + "description": "category id", + "name": "category", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/openpitrix.Category" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/applications": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all applications within the specified workspace", + "operationId": "ListApplications", + "parameters": [ + { + "type": "string", + "description": "the name of the workspace.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/applications/{application} ": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Describe the specified application of the namespace", + "operationId": "DescribeApplication", + "parameters": [ + { + "type": "string", + "description": "the name of the cluster.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmRelease" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/apps": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all apps within the specified workspace", + "operationId": "ListApps", + "parameters": [ + { + "type": "string", + "description": "the name of the workspace.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/apps/{app}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified app template", + "operationId": "DescribeApp", + "parameters": [ + { + "type": "string", + "description": "app template id", + "name": "app", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmApplication" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/apps/{app}/versions": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List all apps within the specified workspace", + "operationId": "ListAppVersion", + "parameters": [ + { + "type": "string", + "description": "the name of the workspace.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the app.", + "name": "app", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/apps/{app}/versions/{version}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified app template version", + "operationId": "DescribeAppVersion", + "parameters": [ + { + "type": "string", + "description": "app template version id", + "name": "version", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "app template id", + "name": "app", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the workspace", + "name": "workspaces", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmApplication" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications": { + "get": { + "produces": [ + "application/json" + ], + "summary": "List all applications within the specified namespace", + "operationId": "ListApplications", + "parameters": [ + { + "type": "string", + "description": "the name of the namespace.", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the cluster.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/clusters/{cluster}/namespaces/{namespace}/applications/{application}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "Namespace Resources" + ], + "summary": "Describe the specified application of the namespace", + "operationId": "DescribeApplication", + "parameters": [ + { + "type": "string", + "description": "the name of the cluster.", + "name": "cluster", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the project", + "name": "namespace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the id of the application", + "name": "application", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmRelease" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/repos": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "List repositories in the specified workspace", + "operationId": "ListRepos", + "parameters": [ + { + "type": "string", + "description": "the name of the workspace.", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "sort parameters, e.g. reverse=true", + "name": "reverse", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "orderBy", + "in": "query" + }, + { + "type": "string", + "description": "name used to do filtering", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "page=%d", + "default": "page=1", + "description": "page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "limit", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "default": "ascending=false", + "description": "sort parameters, e.g. reverse=true", + "name": "ascending", + "in": "query" + }, + { + "type": "string", + "description": "sort parameters, e.g. orderBy=createTime", + "name": "sortBy", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/api.ListResult" + } + } + } + } + }, + "/kapis/openpitrix.io/v2alpha1/workspaces/{workspace}/repos/{repo}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "OpenPitrix Resources" + ], + "summary": "Describe the specified repository in the specified workspace", + "operationId": "DescribeRepo", + "parameters": [ + { + "type": "string", + "description": "repo id", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha1.HelmRepo" + } + } + } + } + }, "/kapis/operations.kubesphere.io/v1alpha2/namespaces/{namespace}/jobs/{job}": { "post": { "produces": [ @@ -10475,6 +10033,13 @@ "description": "secret name", "name": "secret", "in": "query" + }, + { + "type": "string", + "format": "insecure=%s", + "description": "whether verify cert if using https repo", + "name": "insecure", + "in": "query" } ], "responses": { @@ -10921,7 +10486,7 @@ "ServiceMesh" ], "summary": "Get app health", - "operationId": "getAppHealth", + "operationId": "GetAppHealth", "parameters": [ { "type": "string", @@ -10954,10 +10519,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.appHealthResponse" - } + "description": "OK" } } } @@ -10971,7 +10533,7 @@ "ServiceMesh" ], "summary": "Get app metrics from a specific namespace", - "operationId": "getAppMetrics", + "operationId": "GetAppMetrics", "parameters": [ { "type": "string", @@ -11059,10 +10621,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.metricsResponse" - } + "description": "OK" } } } @@ -11076,7 +10635,7 @@ "ServiceMesh" ], "summary": "Get service graph for a specific namespace", - "operationId": "getNamespaceGraph", + "operationId": "GetNamespaceGraph", "parameters": [ { "type": "string", @@ -11121,12 +10680,6 @@ } ], "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.graphResponse" - } - }, "400": { "description": "bad request", "schema": { @@ -11151,7 +10704,7 @@ "ServiceMesh" ], "summary": "Get app/service/workload health of a namespace", - "operationId": "getNamespaceHealth", + "operationId": "GetNamespaceHealth", "parameters": [ { "type": "string", @@ -11176,12 +10729,6 @@ } ], "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.namespaceAppHealthResponse" - } - }, "400": { "description": "bad request", "schema": { @@ -11206,7 +10753,7 @@ "ServiceMesh" ], "summary": "Get metrics from a specific namespace", - "operationId": "getNamespaceMetrics", + "operationId": "GetNamespaceMetrics", "parameters": [ { "type": "string", @@ -11287,10 +10834,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.metricsResponse" - } + "description": "OK" } } } @@ -11304,7 +10848,7 @@ "ServiceMesh" ], "summary": "Get service health", - "operationId": "getServiceHealth", + "operationId": "GetServiceHealth", "parameters": [ { "type": "string", @@ -11337,10 +10881,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.serviceHealthResponse" - } + "description": "OK" } } } @@ -11354,7 +10895,7 @@ "ServiceMesh" ], "summary": "Get service metrics from a specific namespace", - "operationId": "getServiceMetrics", + "operationId": "GetServiceMetrics", "parameters": [ { "type": "string", @@ -11442,10 +10983,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.metricsResponse" - } + "description": "OK" } } } @@ -11462,7 +11000,7 @@ "ServiceMesh" ], "summary": "Get tracing of a service, should have servicemesh enabled first", - "operationId": "getServiceTracing", + "operationId": "GetServiceTracing", "parameters": [ { "type": "string", @@ -11532,7 +11070,7 @@ "ServiceMesh" ], "summary": "Get workload health", - "operationId": "getWorkloadHealth", + "operationId": "GetWorkloadHealth", "parameters": [ { "type": "string", @@ -11565,10 +11103,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.workloadHealthResponse" - } + "description": "OK" } } } @@ -11582,7 +11117,7 @@ "ServiceMesh" ], "summary": "Get workload metrics from a specific namespace", - "operationId": "getWorkloadMetrics", + "operationId": "GetWorkloadMetrics", "parameters": [ { "type": "string", @@ -11670,10 +11205,7 @@ ], "responses": { "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/v1alpha2.metricsResponse" - } + "description": "OK" } } } @@ -12146,6 +11678,185 @@ } } }, + "/kapis/tenant.kubesphere.io/v1alpha2/metering": { + "get": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "tags": [ + "Workspace Meters" + ], + "summary": "Get meterings against the cluster.", + "operationId": "QueryMetering", + "parameters": [ + { + "type": "string", + "description": "Metering level.", + "name": "level", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "Node name.", + "name": "node", + "in": "query" + }, + { + "type": "string", + "description": "Workspace name.", + "name": "workspace", + "in": "query" + }, + { + "type": "string", + "description": "Namespace name.", + "name": "namespace", + "in": "query" + }, + { + "type": "string", + "description": "Workload kind. One of deployment, daemonset, statefulset.", + "name": "kind", + "in": "query" + }, + { + "type": "string", + "description": "Workload name.", + "name": "workload", + "in": "query" + }, + { + "type": "string", + "description": "Pod name.", + "name": "pod", + "in": "query" + }, + { + "type": "string", + "description": "Appliction names, format app_name[:app_version](such as nginx:v1, nignx) which are joined by \"|\" ", + "name": "applications", + "in": "query" + }, + { + "type": "string", + "description": "Services which are joined by \"|\".", + "name": "services", + "in": "query" + }, + { + "type": "string", + "description": "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both workspace CPU usage and memory usage: `meter_workspace_cpu_usage|meter_workspace_memory_usage`.", + "name": "metrics_filter", + "in": "query" + }, + { + "type": "string", + "description": "The workspace filter consists of a regexp pattern. It specifies which workspace data to return.", + "name": "resources_filter", + "in": "query" + }, + { + "type": "string", + "description": "Start time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1559347200. ", + "name": "start", + "in": "query" + }, + { + "type": "string", + "description": "End time of query. Use **start** and **end** to retrieve metric data over a time span. It is a string with Unix time format, eg. 1561939200. ", + "name": "end", + "in": "query" + }, + { + "type": "string", + "default": "10m", + "description": "Time interval. Retrieve metric data at a fixed interval within the time range of start and end. It requires both **start** and **end** are provided. The format is [0-9]+[smhdwy]. Defaults to 10m (i.e. 10 min).", + "name": "step", + "in": "query" + }, + { + "type": "string", + "description": "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.", + "name": "time", + "in": "query" + }, + { + "type": "string", + "description": "Sort workspaces by the specified metric. Not applicable if **start** and **end** are provided.", + "name": "sort_metric", + "in": "query" + }, + { + "type": "string", + "default": "desc.", + "description": "Sort order. One of asc, desc.", + "name": "sort_type", + "in": "query" + }, + { + "type": "integer", + "description": "The page number. This field paginates result data of each metric, then returns a specific page. For example, setting **page** to 2 returns the second page. It only applies to sorted metric data.", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "default": 5, + "description": "Page size, the maximum number of results in a single page. Defaults to 5.", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "The name of the storageclass.", + "name": "storageclass", + "in": "query" + }, + { + "type": "string", + "description": "The PVC filter consists of a regexp pattern. It specifies which PVC data to return.", + "name": "pvc_filter", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/monitoring.Metrics" + } + } + } + } + }, + "/kapis/tenant.kubesphere.io/v1alpha2/metering/price": { + "get": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "summary": "Get resoure price.", + "operationId": "HandlePriceInfoQuery", + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/metering.PriceInfo" + } + } + } + } + }, "/kapis/tenant.kubesphere.io/v1alpha2/namespaces": { "get": { "produces": [ @@ -12166,6 +11877,54 @@ } } }, + "/kapis/tenant.kubesphere.io/v1alpha2/namespaces/{namespace}/metering/hierarchy": { + "get": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "summary": "get current metering hierarchies info in last one hour", + "operationId": "QueryMeteringHierarchy", + "parameters": [ + { + "type": "string", + "description": "Namespace name.", + "name": "namespace", + "in": "path" + }, + { + "type": "string", + "description": "The metric name filter consists of a regexp pattern. It specifies which metric data to return. For example, the following filter matches both workspace CPU usage and memory usage: `meter_pod_cpu_usage|meter_pod_memory_usage_wo_cache`.", + "name": "metrics_filter", + "in": "query" + }, + { + "type": "string", + "description": "A timestamp in Unix time format. Retrieve metric data at a single point in time. Defaults to now. Time and the combination of start, end, step are mutually exclusive.", + "name": "time", + "in": "query" + }, + { + "type": "string", + "description": "Cluster name", + "name": "cluster", + "in": "query" + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/metering.ResourceStatistic" + } + } + } + } + }, "/kapis/tenant.kubesphere.io/v1alpha2/workspaces": { "get": { "produces": [ @@ -12653,6 +12412,168 @@ } } }, + "/kapis/tenant.kubesphere.io/v1alpha2/workspaces/{workspace}/resourcequotas": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "tags": [ + "Workspace" + ], + "summary": "Create resource quota.", + "operationId": "CreateWorkspaceResourceQuota", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1alpha2.ResourceQuota" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha2.ResourceQuota" + } + } + } + } + }, + "/kapis/tenant.kubesphere.io/v1alpha2/workspaces/{workspace}/resourcequotas/{resourcequota}": { + "get": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "tags": [ + "Workspace" + ], + "summary": "Describe resource quota.", + "operationId": "DescribeWorkspaceResourceQuota", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "resource quota name", + "name": "resourcequota", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha2.ResourceQuota" + } + } + } + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "tags": [ + "Workspace" + ], + "summary": "Update resource quota.", + "operationId": "UpdateWorkspaceResourceQuota", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "resource quota name", + "name": "resourcequota", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1alpha2.ResourceQuota" + } + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/v1alpha2.ResourceQuota" + } + } + } + }, + "delete": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "text/plain" + ], + "tags": [ + "Workspace" + ], + "summary": "Delete resource quota.", + "operationId": "DeleteWorkspaceResourceQuota", + "parameters": [ + { + "type": "string", + "description": "workspace name", + "name": "workspace", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "resource quota name", + "name": "resourcequota", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ok", + "schema": { + "$ref": "#/definitions/errors.Error" + } + } + } + } + }, "/kapis/tenant.kubesphere.io/v1alpha2/workspaces/{workspace}/workspacemembers/{workspacemember}/devops": { "get": { "produces": [ @@ -12864,7 +12785,7 @@ "Authentication" ], "summary": "OAuth callback API, the path param callback is config by identity provider", - "operationId": "oauthCallBack", + "operationId": "oauthCallback", "parameters": [ { "type": "string", @@ -12910,6 +12831,49 @@ } } }, + "/oauth/logout": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Authentication" + ], + "summary": "This endpoint takes an ID token and logs the user out of KubeSphere if the subject matches the current session.", + "operationId": "Logout", + "parameters": [ + { + "type": "string", + "description": "ID Token previously issued by the OP to the RP passed to the Logout Endpoint as a hint about the End-User's current authenticated session with the Client. This is used as an indication of the identity of the End-User that the RP is requesting be logged out by the OP.", + "name": "id_token_hint", + "in": "query" + }, + { + "type": "string", + "description": "URL to which the RP is requesting that the End-User's User Agent be redirected after a logout has been performed. ", + "name": "post_logout_redirect_uri", + "in": "query" + }, + { + "type": "string", + "description": "Opaque value used by the RP to maintain state between the logout request and the callback to the endpoint specified by the post_logout_redirect_uri parameter.", + "name": "state", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/oauth/token": { "post": { "consumes": [ @@ -12958,431 +12922,6 @@ } }, "definitions": { - "._links": { - "properties": { - "actions": { - "$ref": "#/definitions/.actions" - }, - "branches": { - "$ref": "#/definitions/.branches" - }, - "queue": { - "$ref": "#/definitions/.queue" - }, - "runs": { - "$ref": "#/definitions/.runs" - }, - "scm": { - "$ref": "#/definitions/.scm" - }, - "self": { - "$ref": "#/definitions/.self" - }, - "trends": { - "$ref": "#/definitions/.trends" - } - } - }, - ".actions": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".branch": { - "properties": { - "isPrimary": { - "description": "primary or not", - "type": "boolean" - }, - "issues": { - "description": "issues", - "type": "array", - "items": { - "$ref": "#/definitions/.branch.issues" - } - }, - "url": { - "description": "url", - "type": "string" - } - } - }, - ".branch.issues": {}, - ".branches": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".data": { - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/definitions/.data.errors" - } - }, - "jenkinsfile": { - "description": "jenkinsfile", - "type": "string" - }, - "result": { - "description": "result e.g. success", - "type": "string" - } - } - }, - ".data.errors": { - "properties": { - "error": { - "description": "error message", - "type": "string" - }, - "location": { - "description": "err location", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - ".defaultParameterValue": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "name": { - "description": "name", - "type": "string" - }, - "value": { - "description": "value, string or bool type", - "$ref": "#/definitions/.defaultParameterValue.value" - } - } - }, - ".defaultParameterValue.value": {}, - ".latestRun": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/.latestRun.actions" - } - }, - "artifactsZipFile": { - "description": "the artifacts zip file", - "type": "string" - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/.latestRun.causeOfBlockage" - }, - "causes": { - "type": "array", - "items": { - "$ref": "#/definitions/.latestRun.causes" - } - }, - "changeSet": { - "description": "changeset information", - "type": "array", - "items": { - "$ref": "#/definitions/.latestRun.changeSet" - } - }, - "description": { - "description": "description", - "$ref": "#/definitions/.latestRun.description" - }, - "durationInMillis": { - "description": "duration time in millis", - "type": "integer", - "format": "int32" - }, - "enQueueTime": { - "description": "the time of enter the queue", - "type": "string" - }, - "endTime": { - "description": "the time of end", - "type": "string" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time in millis", - "type": "integer", - "format": "int32" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "$ref": "#/definitions/.latestRun.name" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "pipeline": { - "description": "pipeline", - "type": "string" - }, - "replayable": { - "description": "Replayable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "runSummary": { - "description": "pipeline run summary", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - ".latestRun.actions": {}, - ".latestRun.causeOfBlockage": {}, - ".latestRun.causes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "shortDescription": { - "description": "short description", - "type": "string" - }, - "userId": { - "description": "user id", - "type": "string" - }, - "userName": { - "description": "user name", - "type": "string" - } - } - }, - ".latestRun.changeSet": {}, - ".latestRun.description": {}, - ".latestRun.name": {}, - ".permissions": { - "properties": { - "configure": { - "description": "configure action", - "type": "boolean" - }, - "create": { - "description": "create action", - "type": "boolean" - }, - "read": { - "description": "read action", - "type": "boolean" - }, - "start": { - "description": "start action", - "type": "boolean" - }, - "stop": { - "description": "stop action", - "type": "boolean" - } - } - }, - ".queue": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".ranges": { - "properties": { - "ranges": { - "type": "array", - "items": { - "$ref": "#/definitions/.ranges.ranges" - } - } - } - }, - ".ranges.ranges": { - "properties": { - "end": { - "description": "End build number", - "type": "integer", - "format": "int32" - }, - "start": { - "description": "Start build number", - "type": "integer", - "format": "int32" - } - } - }, - ".repositories": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/.repositories.items" - } - }, - "lastPage": { - "description": "last page", - "$ref": "#/definitions/.repositories.lastPage" - }, - "nextPage": { - "description": "next page", - "$ref": "#/definitions/.repositories.nextPage" - }, - "pageSize": { - "description": "page size", - "type": "integer", - "format": "int32" - } - } - }, - ".repositories.items": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "defaultBranch": { - "description": "default branch", - "type": "string" - }, - "description": { - "description": "description", - "type": "string" - }, - "fullName": { - "description": "full name", - "type": "string" - }, - "name": { - "description": "name", - "type": "string" - }, - "permissions": { - "$ref": "#/definitions/.permissions" - }, - "private": { - "description": "private or not", - "type": "boolean" - } - } - }, - ".repositories.lastPage": {}, - ".repositories.nextPage": {}, - ".runs": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".scm": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".scmSource": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "apiUrl": { - "description": "api url", - "$ref": "#/definitions/.scmSource.apiUrl" - }, - "id": { - "description": "The id of the source configuration management (SCM).", - "type": "string" - } - } - }, - ".scmSource.apiUrl": {}, - ".self": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - ".trends": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, "api.ListResult": { "required": [ "items", @@ -13479,1646 +13018,6 @@ } } }, - "devops.Artifacts": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "downloadable": { - "description": "downloadable or not", - "type": "boolean" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "type": "string" - }, - "path": { - "description": "path", - "type": "string" - }, - "size": { - "description": "size", - "type": "integer", - "format": "int32" - }, - "url": { - "description": "The url for Download artifacts", - "type": "string" - } - } - }, - "devops.BranchPipeline": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipeline.actions" - } - }, - "branch": { - "$ref": "#/definitions/.branch" - }, - "disabled": { - "description": "disable or not, if disabled, can not do any action", - "type": "boolean" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time in millis", - "type": "integer", - "format": "int32" - }, - "fullDisplayName": { - "description": "full display name", - "type": "string" - }, - "fullName": { - "description": "full name", - "type": "string" - }, - "latestRun": { - "$ref": "#/definitions/.latestRun" - }, - "name": { - "description": "name", - "type": "string" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipeline.parameters" - } - }, - "permissions": { - "$ref": "#/definitions/.permissions" - }, - "weatherScore": { - "description": "the score to description the result of pipeline", - "type": "integer", - "format": "int32" - } - } - }, - "devops.BranchPipeline.actions": {}, - "devops.BranchPipeline.parameters": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "choices": { - "description": "choices", - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipeline.parameters.choices" - } - }, - "defaultParameterValue": { - "$ref": "#/definitions/.defaultParameterValue" - }, - "description": { - "description": "description", - "type": "string" - }, - "name": { - "description": "name", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.BranchPipeline.parameters.choices": {}, - "devops.BranchPipelineRunNodes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipelineRunNodes.actions" - } - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/devops.BranchPipelineRunNodes.causeOfBlockage" - }, - "displayDescription": { - "description": "display description", - "$ref": "#/definitions/devops.BranchPipelineRunNodes.displayDescription" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "durationInMillis": { - "description": "duration time in millis", - "type": "integer", - "format": "int32" - }, - "edges": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipelineRunNodes.edges" - } - }, - "firstParent": { - "description": "first parent resource", - "$ref": "#/definitions/devops.BranchPipelineRunNodes.firstParent" - }, - "id": { - "description": "id", - "type": "string" - }, - "input": { - "description": "the action should user input", - "$ref": "#/definitions/devops.Input" - }, - "restartable": { - "description": "restartable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS. e.g. SUCCESS", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "steps": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipelineRunNodes.steps" - } - }, - "type": { - "description": "source type, e.g. \"WorkflowRun\"", - "type": "string" - } - } - }, - "devops.BranchPipelineRunNodes.actions": {}, - "devops.BranchPipelineRunNodes.causeOfBlockage": {}, - "devops.BranchPipelineRunNodes.displayDescription": {}, - "devops.BranchPipelineRunNodes.edges": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "id": { - "description": "id", - "type": "string" - }, - "type": { - "description": "source type", - "type": "string" - } - } - }, - "devops.BranchPipelineRunNodes.firstParent": {}, - "devops.BranchPipelineRunNodes.steps": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "references the reachable path to this resource", - "type": "array", - "items": { - "$ref": "#/definitions/devops.BranchPipelineRunNodes.steps.actions" - } - }, - "displayDescription": { - "description": "display description", - "$ref": "#/definitions/devops.BranchPipelineRunNodes.steps.displayDescription" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "durationInMillis": { - "description": "duration time in millis", - "type": "integer", - "format": "int32" - }, - "id": { - "description": "id", - "type": "string" - }, - "input": { - "description": "the action should user input", - "$ref": "#/definitions/devops.Input" - }, - "result": { - "description": "result", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "source type", - "type": "string" - } - } - }, - "devops.BranchPipelineRunNodes.steps.actions": { - "properties": { - "_class": { - "type": "string" - }, - "_links": { - "$ref": "#/definitions/._links" - }, - "urlName": { - "type": "string" - } - } - }, - "devops.BranchPipelineRunNodes.steps.displayDescription": {}, - "devops.CheckCronRes": { - "properties": { - "lastTime": { - "description": "last run time.", - "type": "string" - }, - "message": { - "description": "message", - "type": "string" - }, - "nextTime": { - "description": "next run time.", - "type": "string" - }, - "result": { - "description": "result e.g. ok, error", - "type": "string" - } - } - }, - "devops.CheckPlayload": { - "properties": { - "abort": { - "description": "abort or not", - "type": "boolean" - }, - "id": { - "description": "id", - "type": "string" - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.CheckPlayloadParameters" - } - } - } - }, - "devops.CheckPlayloadParameters": { - "properties": { - "name": { - "description": "name", - "type": "string" - }, - "value": { - "description": "value", - "$ref": "#/definitions/devops.CheckPlayloadParameters.value" - } - } - }, - "devops.CheckPlayloadParameters.value": {}, - "devops.CheckScript": { - "properties": { - "column": { - "description": "column e.g. 0", - "type": "integer", - "format": "int32" - }, - "line": { - "description": "line e.g. 0", - "type": "integer", - "format": "int32" - }, - "message": { - "description": "message e.g. unexpected char: '#'", - "type": "string" - }, - "status": { - "description": "status e.g. fail", - "type": "string" - } - } - }, - "devops.CreateScmServerReq": { - "properties": { - "apiUrl": { - "description": "url of scm server", - "type": "string" - }, - "name": { - "description": "name of scm server", - "type": "string" - } - } - }, - "devops.Credential": { - "required": [ - "id", - "type" - ], - "properties": { - "description": { - "description": "Credential's description'", - "type": "string" - }, - "display_name": { - "description": "Credential's display name", - "type": "string" - }, - "domain": { - "description": "Credential's domain,In ks we only use the default domain, default '_''", - "type": "string" - }, - "fingerprint": { - "description": "usage of the Credential", - "$ref": "#/definitions/devops.Credential.fingerprint" - }, - "id": { - "description": "Id of Credential, e.g. dockerhub-id", - "type": "string" - }, - "type": { - "description": "Type of Credential, e.g. ssh/kubeconfig", - "type": "string" - } - } - }, - "devops.Credential.fingerprint": { - "properties": { - "file_name": { - "description": "Credential's display name and description", - "type": "string" - }, - "hash": { - "description": "Credential's hash", - "type": "string" - }, - "usage": { - "description": "all usage of Credential", - "type": "array", - "items": { - "$ref": "#/definitions/devops.Credential.fingerprint.usage" - } - } - } - }, - "devops.Credential.fingerprint.usage": { - "properties": { - "name": { - "description": "pipeline full name", - "type": "string" - }, - "ranges": { - "description": "The build number of all pipelines that use this credential", - "$ref": "#/definitions/.ranges" - } - } - }, - "devops.CronData": { - "required": [ - "cron" - ], - "properties": { - "cron": { - "description": "Cron script data.", - "type": "string" - }, - "pipelineName": { - "description": "Pipeline name, if pipeline haven't created, not required'", - "type": "string" - } - } - }, - "devops.Crumb": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "crumb": { - "description": "crumb data", - "type": "string" - }, - "crumbRequestField": { - "description": "crumb request field", - "type": "string" - } - } - }, - "devops.Input": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/devops.Input._links" - }, - "id": { - "description": "the id of check action", - "type": "string" - }, - "message": { - "description": "the message of check action", - "type": "string" - }, - "ok": { - "description": "check status. e.g. \"Proceed\"", - "type": "string" - }, - "parameters": { - "description": "the parameters of check action", - "type": "array", - "items": { - "$ref": "#/definitions/devops.Input.parameters" - } - }, - "submitter": { - "description": "check submitter", - "$ref": "#/definitions/devops.Input.submitter" - } - } - }, - "devops.Input._links": { - "properties": { - "self": { - "$ref": "#/definitions/devops.Input._links.self" - } - } - }, - "devops.Input._links.self": { - "properties": { - "_class": { - "type": "string" - }, - "href": { - "type": "string" - } - } - }, - "devops.Input.parameters": {}, - "devops.Input.submitter": {}, - "devops.NodeSteps": { - "required": [ - "aprovable" - ], - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodeSteps.actions" - } - }, - "aprovable": { - "description": "indicate if this step can be approved by current user", - "type": "boolean" - }, - "displayDescription": { - "description": "display description", - "type": "string" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "durationInMillis": { - "description": "duration time in mullis", - "type": "integer", - "format": "int32" - }, - "id": { - "description": "id", - "type": "string" - }, - "input": { - "description": "the action should user input", - "$ref": "#/definitions/devops.Input" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "startTime": { - "description": "the time of starts", - "type": "string" - }, - "state": { - "description": "run state. e.g. SKIPPED", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.NodeSteps.actions": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "urlName": { - "description": "url name", - "type": "string" - } - } - }, - "devops.NodesDetail": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodesDetail.actions" - } - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/devops.NodesDetail.causeOfBlockage" - }, - "displayDescription": { - "description": "display description", - "$ref": "#/definitions/devops.NodesDetail.displayDescription" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "durationInMillis": { - "description": "duration time in mullis", - "type": "integer", - "format": "int32" - }, - "edges": { - "description": "edges", - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodesDetail.edges" - } - }, - "firstParent": { - "description": "first parent", - "$ref": "#/definitions/devops.NodesDetail.firstParent" - }, - "id": { - "description": "id", - "type": "string" - }, - "input": { - "description": "the action should user input", - "$ref": "#/definitions/devops.Input" - }, - "restartable": { - "description": "restartable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. FINISHED", - "type": "string" - }, - "steps": { - "description": "steps", - "type": "array", - "items": { - "$ref": "#/definitions/devops.NodeSteps" - } - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.NodesDetail.actions": {}, - "devops.NodesDetail.causeOfBlockage": {}, - "devops.NodesDetail.displayDescription": {}, - "devops.NodesDetail.edges": {}, - "devops.NodesDetail.firstParent": {}, - "devops.OrgRepo": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "repositories": { - "$ref": "#/definitions/.repositories" - } - } - }, - "devops.Pipeline": { - "required": [ - "weatherScore" - ], - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource.", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions.", - "type": "array", - "items": { - "$ref": "#/definitions/devops.Pipeline.actions" - } - }, - "branchNames": { - "description": "branch names", - "type": "array", - "items": { - "type": "string" - } - }, - "disabled": { - "description": "disable or not, if disabled, can not do any action.", - "$ref": "#/definitions/devops.Pipeline.disabled" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time, unit is millis", - "type": "integer", - "format": "int32" - }, - "fullDisplayName": { - "description": "full display name", - "type": "string" - }, - "fullName": { - "description": "full name", - "type": "string" - }, - "name": { - "description": "name", - "type": "string" - }, - "numberOfFailingBranches": { - "description": "number of failing branches", - "type": "integer", - "format": "int32" - }, - "numberOfFailingPullRequests": { - "description": "number of failing pull requests", - "type": "integer", - "format": "int32" - }, - "numberOfFolders": { - "description": "number of folders", - "type": "integer", - "format": "int32" - }, - "numberOfPipelines": { - "description": "number of pipelines", - "type": "integer", - "format": "int32" - }, - "numberOfSuccessfulBranches": { - "description": "number of successful pull requests", - "type": "integer", - "format": "int32" - }, - "numberOfSuccessfulPullRequests": { - "description": "number of successful pull requests", - "type": "integer", - "format": "int32" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "parameters": { - "description": "parameters of pipeline, a pipeline can define list of parameters pipeline job expects.", - "$ref": "#/definitions/devops.Pipeline.parameters" - }, - "permissions": { - "description": "permissions", - "$ref": "#/definitions/.permissions" - }, - "pipelineFolderNames": { - "description": "pipeline folder names", - "type": "array", - "items": { - "$ref": "#/definitions/devops.Pipeline.pipelineFolderNames" - } - }, - "scmSource": { - "$ref": "#/definitions/.scmSource" - }, - "totalNumberOfBranches": { - "description": "total number of branches", - "type": "integer", - "format": "int32" - }, - "totalNumberOfPullRequests": { - "description": "total number of pull requests", - "type": "integer", - "format": "int32" - }, - "weatherScore": { - "description": "the score to description the result of pipeline activity", - "type": "integer", - "format": "int32" - } - } - }, - "devops.Pipeline.actions": {}, - "devops.Pipeline.disabled": {}, - "devops.Pipeline.parameters": {}, - "devops.Pipeline.pipelineFolderNames": {}, - "devops.PipelineBranch": {}, - "devops.PipelineList": { - "required": [ - "items", - "total_count" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.Pipeline" - } - }, - "total_count": { - "type": "integer", - "format": "int32" - } - } - }, - "devops.PipelineRun": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRun.actions" - } - }, - "artifactsZipFile": { - "description": "the artifacts zip file", - "$ref": "#/definitions/devops.PipelineRun.artifactsZipFile" - }, - "branch": { - "description": "branch", - "$ref": "#/definitions/devops.PipelineRun.branch" - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/devops.PipelineRun.causeOfBlockage" - }, - "causes": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRun.causes" - } - }, - "changeSet": { - "description": "changeset information", - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRun.changeSet" - } - }, - "commitId": { - "description": "commit id", - "$ref": "#/definitions/devops.PipelineRun.commitId" - }, - "commitUrl": { - "description": "commit url", - "$ref": "#/definitions/devops.PipelineRun.commitUrl" - }, - "description": { - "description": "description", - "$ref": "#/definitions/devops.PipelineRun.description" - }, - "durationInMillis": { - "description": "duration time in millis", - "type": "integer", - "format": "int32" - }, - "enQueueTime": { - "description": "the time of enter the queue", - "type": "string" - }, - "endTime": { - "description": "the time of end", - "type": "string" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time in millis", - "type": "integer", - "format": "int32" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "$ref": "#/definitions/devops.PipelineRun.name" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "pipeline": { - "description": "the name of pipeline", - "type": "string" - }, - "pullRequest": { - "description": "pull request", - "$ref": "#/definitions/devops.PipelineRun.pullRequest" - }, - "replayable": { - "description": "replayable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "runSummary": { - "description": "pipeline run summary", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.PipelineRun.actions": {}, - "devops.PipelineRun.artifactsZipFile": {}, - "devops.PipelineRun.branch": {}, - "devops.PipelineRun.causeOfBlockage": {}, - "devops.PipelineRun.causes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "shortDescription": { - "description": "short description", - "type": "string" - }, - "userId": { - "description": "user id", - "type": "string" - }, - "userName": { - "description": "user name", - "type": "string" - } - } - }, - "devops.PipelineRun.changeSet": {}, - "devops.PipelineRun.commitId": {}, - "devops.PipelineRun.commitUrl": {}, - "devops.PipelineRun.description": {}, - "devops.PipelineRun.name": {}, - "devops.PipelineRun.pullRequest": {}, - "devops.PipelineRunList": { - "required": [ - "items", - "totalItems" - ], - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRun" - } - }, - "totalItems": { - "type": "integer", - "format": "int32" - } - } - }, - "devops.PipelineRunNodes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRunNodes.actions" - } - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/devops.PipelineRunNodes.causeOfBlockage" - }, - "displayDescription": { - "description": "display description", - "$ref": "#/definitions/devops.PipelineRunNodes.displayDescription" - }, - "displayName": { - "description": "display name", - "type": "string" - }, - "durationInMillis": { - "description": "duration time in mullis", - "type": "integer", - "format": "int32" - }, - "edges": { - "description": "edges", - "type": "array", - "items": { - "$ref": "#/definitions/devops.PipelineRunNodes.edges" - } - }, - "firstParent": { - "description": "first parent", - "$ref": "#/definitions/devops.PipelineRunNodes.firstParent" - }, - "id": { - "description": "id", - "type": "string" - }, - "input": { - "description": "the action should user input", - "$ref": "#/definitions/devops.Input" - }, - "restartable": { - "description": "restartable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. FINISHED", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.PipelineRunNodes.actions": {}, - "devops.PipelineRunNodes.causeOfBlockage": {}, - "devops.PipelineRunNodes.displayDescription": {}, - "devops.PipelineRunNodes.edges": {}, - "devops.PipelineRunNodes.firstParent": {}, - "devops.ReplayPipeline": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions.", - "type": "array", - "items": { - "$ref": "#/definitions/devops.ReplayPipeline.actions" - } - }, - "artifactsZipFile": { - "description": "the artifacts zip file", - "$ref": "#/definitions/devops.ReplayPipeline.artifactsZipFile" - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "type": "string" - }, - "causes": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.ReplayPipeline.causes" - } - }, - "changeSet": { - "description": "changeset information", - "type": "array", - "items": { - "$ref": "#/definitions/devops.ReplayPipeline.changeSet" - } - }, - "description": { - "description": "description", - "$ref": "#/definitions/devops.ReplayPipeline.description" - }, - "durationInMillis": { - "description": "duration time in millis", - "$ref": "#/definitions/devops.ReplayPipeline.durationInMillis" - }, - "enQueueTime": { - "description": "the time of enter the queue", - "$ref": "#/definitions/devops.ReplayPipeline.enQueueTime" - }, - "endTime": { - "description": "the time of end", - "$ref": "#/definitions/devops.ReplayPipeline.endTime" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time, unit is millis", - "$ref": "#/definitions/devops.ReplayPipeline.estimatedDurationInMillis" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "$ref": "#/definitions/devops.ReplayPipeline.name" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "pipeline": { - "description": "pipeline", - "type": "string" - }, - "queueId": { - "description": "queue id", - "type": "string" - }, - "replayable": { - "description": "replayable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "runSummary": { - "description": "pipeline run summary", - "$ref": "#/definitions/devops.ReplayPipeline.runSummary" - }, - "startTime": { - "description": "the time of start", - "$ref": "#/definitions/devops.ReplayPipeline.startTime" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.ReplayPipeline.actions": {}, - "devops.ReplayPipeline.artifactsZipFile": {}, - "devops.ReplayPipeline.causes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "shortDescription": { - "description": "short description", - "type": "string" - }, - "userId": { - "description": "user id", - "type": "string" - }, - "userName": { - "description": "user name", - "type": "string" - } - } - }, - "devops.ReplayPipeline.changeSet": {}, - "devops.ReplayPipeline.description": {}, - "devops.ReplayPipeline.durationInMillis": {}, - "devops.ReplayPipeline.enQueueTime": {}, - "devops.ReplayPipeline.endTime": {}, - "devops.ReplayPipeline.estimatedDurationInMillis": {}, - "devops.ReplayPipeline.name": {}, - "devops.ReplayPipeline.runSummary": {}, - "devops.ReplayPipeline.startTime": {}, - "devops.ReqJenkinsfile": { - "properties": { - "jenkinsfile": { - "description": "jenkinsfile", - "type": "string" - } - } - }, - "devops.ReqJson": { - "properties": { - "json": { - "description": "json data", - "type": "string" - } - } - }, - "devops.ReqScript": { - "properties": { - "value": { - "description": "Pipeline script data", - "type": "string" - } - } - }, - "devops.ResJenkinsfile": { - "properties": { - "data": { - "$ref": "#/definitions/.data" - }, - "status": { - "description": "status e.g. ok", - "type": "string" - } - } - }, - "devops.ResJson": { - "properties": { - "data": { - "$ref": "#/definitions/.data" - }, - "status": { - "description": "status e.g. ok", - "type": "string" - } - } - }, - "devops.RunPayload": { - "properties": { - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.RunPayload.parameters" - } - } - } - }, - "devops.RunPayload.parameters": { - "properties": { - "name": { - "description": "name", - "type": "string" - }, - "value": { - "description": "value", - "type": "string" - } - } - }, - "devops.RunPipeline": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions", - "type": "array", - "items": { - "$ref": "#/definitions/devops.RunPipeline.actions" - } - }, - "artifactsZipFile": { - "description": "the artifacts zip file", - "$ref": "#/definitions/devops.RunPipeline.artifactsZipFile" - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "type": "string" - }, - "causes": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.RunPipeline.causes" - } - }, - "changeSet": { - "description": "changeset information", - "type": "array", - "items": { - "$ref": "#/definitions/devops.RunPipeline.changeSet" - } - }, - "description": { - "description": "description", - "$ref": "#/definitions/devops.RunPipeline.description" - }, - "durationInMillis": { - "description": "duration time in millis", - "$ref": "#/definitions/devops.RunPipeline.durationInMillis" - }, - "enQueueTime": { - "description": "the time of enter the queue", - "$ref": "#/definitions/devops.RunPipeline.enQueueTime" - }, - "endTime": { - "description": "the time of end", - "$ref": "#/definitions/devops.RunPipeline.endTime" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time in millis", - "$ref": "#/definitions/devops.RunPipeline.estimatedDurationInMillis" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "$ref": "#/definitions/devops.RunPipeline.name" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "pipeline": { - "description": "pipeline", - "type": "string" - }, - "queueId": { - "description": "queue id", - "type": "string" - }, - "replayable": { - "description": "replayable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "runSummary": { - "description": "pipeline run summary", - "$ref": "#/definitions/devops.RunPipeline.runSummary" - }, - "startTime": { - "description": "the time of start", - "$ref": "#/definitions/devops.RunPipeline.startTime" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.RunPipeline.actions": {}, - "devops.RunPipeline.artifactsZipFile": {}, - "devops.RunPipeline.causes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "shortDescription": { - "description": "short description", - "type": "string" - }, - "userId": { - "description": "user id", - "type": "string" - }, - "userName": { - "description": "user name", - "type": "string" - } - } - }, - "devops.RunPipeline.changeSet": {}, - "devops.RunPipeline.description": {}, - "devops.RunPipeline.durationInMillis": {}, - "devops.RunPipeline.enQueueTime": {}, - "devops.RunPipeline.endTime": {}, - "devops.RunPipeline.estimatedDurationInMillis": {}, - "devops.RunPipeline.name": {}, - "devops.RunPipeline.runSummary": {}, - "devops.RunPipeline.startTime": {}, - "devops.SCMOrg": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "avatar": { - "description": "the url of organization avatar", - "type": "string" - }, - "jenkinsOrganizationPipeline": { - "description": "weather or not already have jenkins pipeline.", - "type": "boolean" - }, - "name": { - "description": "organization name", - "type": "string" - } - } - }, - "devops.SCMServer": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "apiUrl": { - "description": "url of scm server", - "type": "string" - }, - "id": { - "description": "server id of scm server", - "type": "string" - }, - "name": { - "description": "name of scm server", - "type": "string" - } - } - }, - "devops.StopPipeline": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "_links": { - "description": "references the reachable path to this resource", - "$ref": "#/definitions/._links" - }, - "actions": { - "description": "the list of all actions.", - "type": "array", - "items": { - "$ref": "#/definitions/devops.StopPipeline.actions" - } - }, - "artifactsZipFile": { - "description": "the artifacts zip file", - "$ref": "#/definitions/devops.StopPipeline.artifactsZipFile" - }, - "branch": { - "$ref": "#/definitions/.branch" - }, - "causeOfBlockage": { - "description": "the cause of blockage", - "$ref": "#/definitions/devops.StopPipeline.causeOfBlockage" - }, - "causes": { - "type": "array", - "items": { - "$ref": "#/definitions/devops.StopPipeline.causes" - } - }, - "changeSet": { - "description": "changeset information", - "type": "array", - "items": { - "$ref": "#/definitions/devops.StopPipeline.changeSet" - } - }, - "commitId": { - "description": "commit id", - "type": "string" - }, - "commitUrl": { - "description": "commit url", - "$ref": "#/definitions/devops.StopPipeline.commitUrl" - }, - "description": { - "description": "description", - "$ref": "#/definitions/devops.StopPipeline.description" - }, - "durationInMillis": { - "description": "duration time in millis", - "type": "integer", - "format": "int32" - }, - "enQueueTime": { - "description": "the time of enter the queue", - "type": "string" - }, - "endTime": { - "description": "the time of end", - "type": "string" - }, - "estimatedDurationInMillis": { - "description": "estimated duration time in millis", - "type": "integer", - "format": "int32" - }, - "id": { - "description": "id", - "type": "string" - }, - "name": { - "description": "name", - "$ref": "#/definitions/devops.StopPipeline.name" - }, - "organization": { - "description": "the name of organization", - "type": "string" - }, - "pipeline": { - "description": "pipeline", - "type": "string" - }, - "pullRequest": { - "description": "pull request", - "$ref": "#/definitions/devops.StopPipeline.pullRequest" - }, - "replayable": { - "description": "replayable or not", - "type": "boolean" - }, - "result": { - "description": "the result of pipeline run. e.g. SUCCESS", - "type": "string" - }, - "runSummary": { - "description": "pipeline run summary", - "type": "string" - }, - "startTime": { - "description": "the time of start", - "type": "string" - }, - "state": { - "description": "run state. e.g. RUNNING", - "type": "string" - }, - "type": { - "description": "type", - "type": "string" - } - } - }, - "devops.StopPipeline.actions": {}, - "devops.StopPipeline.artifactsZipFile": {}, - "devops.StopPipeline.causeOfBlockage": {}, - "devops.StopPipeline.causes": { - "properties": { - "_class": { - "description": "It’s a fully qualified name and is an identifier of the producer of this resource's capability.", - "type": "string" - }, - "shortDescription": { - "description": "short description", - "type": "string" - } - } - }, - "devops.StopPipeline.changeSet": {}, - "devops.StopPipeline.commitUrl": {}, - "devops.StopPipeline.description": {}, - "devops.StopPipeline.name": {}, - "devops.StopPipeline.pullRequest": {}, - "devops.Validates": { - "properties": { - "credentialId": { - "description": "the id of credential", - "type": "string" - } - } - }, "errors.Error": { "required": [ "message" @@ -15158,7 +13057,7 @@ "description": "actual array of results", "type": "array", "items": { - "$ref": "#/definitions/v1.Event" + "$ref": "#/definitions/events.Events.records" } }, "total": { @@ -15168,6 +13067,7 @@ } } }, + "events.Events.records": {}, "events.Histogram": { "required": [ "total", @@ -15335,6 +13235,374 @@ } } }, + "metering.AppStatistic": { + "required": [ + "cpu_usage", + "memory_usage_wo_cache", + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total", + "deployments", + "statefulsets", + "daemonsets" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "daemonsets": { + "description": "daemonsets statistics", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DaemonsetStatistic" + } + }, + "deployments": { + "description": "deployment statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DeploymentStatistic" + } + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "description": "net_bytes_transmitted", + "type": "number", + "format": "double" + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + }, + "statefulsets": { + "description": "statefulset statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.StatefulsetStatistic" + } + } + } + }, + "metering.DaemonsetStatistic": { + "required": [ + "cpu_usage", + "memory_usage_wo_cache", + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total", + "pods" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "description": "net_bytes_transmitted", + "type": "number", + "format": "double" + }, + "pods": { + "description": "pod statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.PodStatistic" + } + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + } + } + }, + "metering.DeploymentStatistic": { + "required": [ + "cpu_usage", + "memory_usage_wo_cache", + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total", + "pods" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "type": "number", + "format": "double" + }, + "pods": { + "description": "pod statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.PodStatistic" + } + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + } + } + }, + "metering.OpenPitrixStatistic": { + "required": [ + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total", + "deployments", + "statefulsets", + "daemonsets", + "cpu_usage", + "memory_usage_wo_cache" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "daemonsets": { + "description": "daemonsets statistics", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DaemonsetStatistic" + } + }, + "deployments": { + "description": "deployment statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DeploymentStatistic" + } + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "description": "net_bytes_transmitted", + "type": "number", + "format": "double" + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + }, + "statefulsets": { + "description": "statefulset statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.StatefulsetStatistic" + } + } + } + }, + "metering.PodStatistic": { + "required": [ + "cpu_usage", + "memory_usage_wo_cache", + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "type": "number", + "format": "double" + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + } + } + }, + "metering.PriceInfo": { + "required": [ + "currency" + ], + "properties": { + "cpu_per_core_per_hour": { + "description": "cpu price", + "type": "number", + "format": "double" + }, + "currency": { + "description": "currency", + "type": "string" + }, + "egress_network_traffic_per_megabytes_per_hour": { + "description": "egress price", + "type": "number", + "format": "double" + }, + "ingress_network_traffic_per_megabytes_per_hour": { + "description": "ingress price", + "type": "number", + "format": "double" + }, + "mem_per_gigabytes_per_hour": { + "description": "mem price", + "type": "number", + "format": "double" + }, + "pvc_per_gigabytes_per_hour": { + "description": "pvc price", + "type": "number", + "format": "double" + } + } + }, + "metering.ResourceStatistic": { + "required": [ + "openpitrixs", + "apps", + "deployments", + "statefulsets", + "daemonsets" + ], + "properties": { + "apps": { + "description": "app statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.AppStatistic" + } + }, + "daemonsets": { + "description": "daemonsets statistics", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DaemonsetStatistic" + } + }, + "deployments": { + "description": "deployment statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.DeploymentStatistic" + } + }, + "openpitrixs": { + "description": "openpitrix statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.OpenPitrixStatistic" + } + }, + "statefulsets": { + "description": "statefulset statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.StatefulsetStatistic" + } + } + } + }, + "metering.StatefulsetStatistic": { + "required": [ + "cpu_usage", + "memory_usage_wo_cache", + "net_bytes_transmitted", + "net_bytes_received", + "pvc_bytes_total", + "pods" + ], + "properties": { + "cpu_usage": { + "description": "cpu_usage", + "type": "number", + "format": "double" + }, + "memory_usage_wo_cache": { + "description": "memory_usage_wo_cache", + "type": "number", + "format": "double" + }, + "net_bytes_received": { + "description": "net_bytes_received", + "type": "number", + "format": "double" + }, + "net_bytes_transmitted": { + "description": "net_bytes_transmitted", + "type": "number", + "format": "double" + }, + "pods": { + "description": "pod statistic", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/metering.PodStatistic" + } + }, + "pvc_bytes_total": { + "description": "pvc_bytes_total", + "type": "number", + "format": "double" + } + } + }, "models.PageableResponse": { "required": [ "items", @@ -15442,7 +13710,45 @@ } }, "monitoring.MetricValue": { + "required": [ + "min_value", + "max_value", + "avg_value", + "sum_value", + "fee", + "resource_unit", + "currency_unit" + ], "properties": { + "avg_value": { + "description": "average value from monitor points", + "type": "string" + }, + "currency_unit": { + "type": "string" + }, + "exported_value": { + "description": "exported time series, values of vector type", + "type": "array", + "items": { + "type": "number" + } + }, + "exported_values": { + "description": "exported time series, values of matrix type", + "type": "array", + "items": { + "$ref": "#/definitions/monitoring.ExportPoint" + } + }, + "fee": { + "description": "resource fee", + "type": "string" + }, + "max_value": { + "description": "maximum value from monitor points", + "type": "string" + }, "metric": { "description": "time series labels", "type": "object", @@ -15450,6 +13756,17 @@ "type": "string" } }, + "min_value": { + "description": "minimum value from monitor points", + "type": "string" + }, + "resource_unit": { + "type": "string" + }, + "sum_value": { + "description": "sum value from monitor points", + "type": "string" + }, "value": { "description": "time series, values of vector type", "type": "string" @@ -15859,31 +14176,20 @@ "description": "application cluster info", "$ref": "#/definitions/openpitrix.Cluster" }, - "ingresses": { - "description": "application ingresses", - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.Ingress" - } - }, "name": { "description": "application name", "type": "string" }, - "services": { - "description": "application services", + "releaseInfo": { + "description": "release info", "type": "array", "items": { - "$ref": "#/definitions/v1.Service" + "$ref": "#/definitions/runtime.Object" } }, "version": { "description": "application template version info", "$ref": "#/definitions/openpitrix.AppVersion" - }, - "workloads": { - "description": "application workloads", - "$ref": "#/definitions/openpitrix.workLoads" } } }, @@ -16095,6 +14401,8 @@ }, "openpitrix.CreateClusterRequest": { "required": [ + "name", + "description", "advanced_param" ], "properties": { @@ -16110,11 +14418,20 @@ "conf": { "type": "string" }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, "runtime_id": { "type": "string" }, "version_id": { "type": "string" + }, + "workspace": { + "type": "string" } } }, @@ -16230,7 +14547,13 @@ } }, "openpitrix.ModifyClusterAttributesRequest": { + "required": [ + "cluster_id" + ], "properties": { + "clusterName": { + "type": "string" + }, "cluster_id": { "type": "string" }, @@ -16239,6 +14562,9 @@ }, "name": { "type": "string" + }, + "namespace": { + "type": "string" } } }, @@ -16299,6 +14625,10 @@ "$ref": "#/definitions/openpitrix.ResourceCategory" } }, + "chart_count": { + "type": "integer", + "format": "int32" + }, "controller": { "type": "integer", "format": "int32" @@ -16306,6 +14636,9 @@ "create_time": { "type": "string" }, + "creator": { + "type": "string" + }, "credential": { "type": "string" }, @@ -16321,9 +14654,6 @@ "name": { "type": "string" }, - "owner": { - "type": "string" - }, "providers": { "type": "array", "items": { @@ -16358,11 +14688,15 @@ }, "openpitrix.RepoActionRequest": { "required": [ - "action" + "action", + "workspace" ], "properties": { "action": { "type": "string" + }, + "workspace": { + "type": "string" } } }, @@ -16417,6 +14751,7 @@ "openpitrix.UpgradeClusterRequest": { "required": [ "cluster_id", + "app_id", "advanced_param" ], "properties": { @@ -16426,12 +14761,18 @@ "type": "string" } }, + "app_id": { + "type": "string" + }, "cluster_id": { "type": "string" }, "conf": { "type": "string" }, + "namespace": { + "type": "string" + }, "runtime_id": { "type": "string" }, @@ -16440,31 +14781,6 @@ } } }, - "openpitrix.workLoads": { - "properties": { - "daemonsets": { - "description": "daemonset list", - "type": "array", - "items": { - "$ref": "#/definitions/v1.DaemonSet" - } - }, - "deployments": { - "description": "deployment list", - "type": "array", - "items": { - "$ref": "#/definitions/v1.Deployment" - } - }, - "statefulsets": { - "description": "statefulset list", - "type": "array", - "items": { - "$ref": "#/definitions/v1.StatefulSet" - } - } - } - }, "registries.Config": { "properties": { "ArgsEscaped": { @@ -16874,6 +15190,7 @@ } } }, + "runtime.Object": {}, "v1.AWSElasticBlockStoreVolumeSource": { "description": "Represents a Persistent Disk resource in AWS.\n\nAn AWS EBS disk must exist before mounting to a container. The disk must also be in the same AWS zone as the kubelet. An AWS EBS disk can only be mounted as read/write once. AWS EBS volumes support ownership management and SELinux relabeling.", "required": [ @@ -17518,169 +15835,6 @@ } } }, - "v1.Deployment": { - "description": "Deployment enables declarative updates for Pods and ReplicaSets.", - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "description": "Standard object metadata.", - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "description": "Specification of the desired behavior of the Deployment.", - "$ref": "#/definitions/v1.DeploymentSpec" - }, - "status": { - "description": "Most recently observed status of the Deployment.", - "$ref": "#/definitions/v1.DeploymentStatus" - } - } - }, - "v1.DeploymentCondition": { - "description": "DeploymentCondition describes the state of a deployment at a certain point.", - "required": [ - "type", - "status" - ], - "properties": { - "lastTransitionTime": { - "description": "Last time the condition transitioned from one status to another.", - "type": "string" - }, - "lastUpdateTime": { - "description": "The last time this condition was updated.", - "type": "string" - }, - "message": { - "description": "A human readable message indicating details about the transition.", - "type": "string" - }, - "reason": { - "description": "The reason for the condition's last transition.", - "type": "string" - }, - "status": { - "description": "Status of the condition, one of True, False, Unknown.", - "type": "string" - }, - "type": { - "description": "Type of deployment condition.", - "type": "string" - } - } - }, - "v1.DeploymentSpec": { - "description": "DeploymentSpec is the specification of the desired behavior of the Deployment.", - "required": [ - "selector", - "template" - ], - "properties": { - "minReadySeconds": { - "description": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)", - "type": "integer", - "format": "int32" - }, - "paused": { - "description": "Indicates that the deployment is paused.", - "type": "boolean" - }, - "progressDeadlineSeconds": { - "description": "The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.", - "type": "integer", - "format": "int32" - }, - "replicas": { - "description": "Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.", - "type": "integer", - "format": "int32" - }, - "revisionHistoryLimit": { - "description": "The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.", - "type": "integer", - "format": "int32" - }, - "selector": { - "description": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.", - "$ref": "#/definitions/v1.LabelSelector" - }, - "strategy": { - "description": "The deployment strategy to use to replace existing pods with new ones.", - "$ref": "#/definitions/v1.DeploymentStrategy" - }, - "template": { - "description": "Template describes the pods that will be created.", - "$ref": "#/definitions/v1.PodTemplateSpec" - } - } - }, - "v1.DeploymentStatus": { - "description": "DeploymentStatus is the most recently observed status of the Deployment.", - "properties": { - "availableReplicas": { - "description": "Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.", - "type": "integer", - "format": "int32" - }, - "collisionCount": { - "description": "Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", - "type": "integer", - "format": "int32" - }, - "conditions": { - "description": "Represents the latest available observations of a deployment's current state.", - "type": "array", - "items": { - "$ref": "#/definitions/v1.DeploymentCondition" - } - }, - "observedGeneration": { - "description": "The generation observed by the deployment controller.", - "type": "integer", - "format": "int64" - }, - "readyReplicas": { - "description": "Total number of ready pods targeted by this deployment.", - "type": "integer", - "format": "int32" - }, - "replicas": { - "description": "Total number of non-terminated pods targeted by this deployment (their labels match the selector).", - "type": "integer", - "format": "int32" - }, - "unavailableReplicas": { - "description": "Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", - "type": "integer", - "format": "int32" - }, - "updatedReplicas": { - "description": "Total number of non-terminated pods targeted by this deployment that have the desired template spec.", - "type": "integer", - "format": "int32" - } - } - }, - "v1.DeploymentStrategy": { - "description": "DeploymentStrategy describes how to replace existing pods with new ones.", - "properties": { - "rollingUpdate": { - "description": "Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.", - "$ref": "#/definitions/v1.RollingUpdateDeployment" - }, - "type": { - "description": "Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.", - "type": "string" - } - } - }, "v1.DownwardAPIProjection": { "description": "Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode.", "properties": { @@ -17927,117 +16081,6 @@ } } }, - "v1.Event": { - "description": "Event is a report of an event somewhere in the cluster.", - "required": [ - "metadata", - "involvedObject", - "reportingComponent", - "reportingInstance" - ], - "properties": { - "action": { - "description": "What action was taken/failed regarding to the Regarding object.", - "type": "string" - }, - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "count": { - "description": "The number of times this event has occurred.", - "type": "integer", - "format": "int32" - }, - "eventTime": { - "description": "Time when this Event was first observed.", - "type": "string" - }, - "firstTimestamp": { - "description": "The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)", - "type": "string" - }, - "involvedObject": { - "description": "The object that this event is about.", - "$ref": "#/definitions/v1.ObjectReference" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "lastTimestamp": { - "description": "The time at which the most recent occurrence of this event was recorded.", - "type": "string" - }, - "message": { - "description": "A human-readable description of the status of this operation.", - "type": "string" - }, - "metadata": { - "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "$ref": "#/definitions/v1.ObjectMeta" - }, - "reason": { - "description": "This should be a short, machine understandable string that gives the reason for the transition into the object's current status.", - "type": "string" - }, - "related": { - "description": "Optional secondary object for more complex actions.", - "$ref": "#/definitions/v1.ObjectReference" - }, - "reportingComponent": { - "description": "Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.", - "type": "string" - }, - "reportingInstance": { - "description": "ID of the controller instance, e.g. `kubelet-xyzf`.", - "type": "string" - }, - "series": { - "description": "Data about the Event series this event represents or nil if it's a singleton Event.", - "$ref": "#/definitions/v1.EventSeries" - }, - "source": { - "description": "The component reporting this event. Should be a short machine understandable string.", - "$ref": "#/definitions/v1.EventSource" - }, - "type": { - "description": "Type of this event (Normal, Warning), new types could be added in the future", - "type": "string" - } - } - }, - "v1.EventSeries": { - "description": "EventSeries contain information on series of events, i.e. thing that was/is happening continuously for some time.", - "properties": { - "count": { - "description": "Number of occurrences in this series up to the last heartbeat time", - "type": "integer", - "format": "int32" - }, - "lastObservedTime": { - "description": "Time of the last occurrence observed", - "type": "string" - }, - "state": { - "description": "State of this Series: Ongoing or Finished Deprecated. Planned removal for 1.18", - "type": "string" - } - } - }, - "v1.EventSource": { - "description": "EventSource contains information for an event.", - "properties": { - "component": { - "description": "Component from which the event is generated.", - "type": "string" - }, - "host": { - "description": "Node name on which the event is generated.", - "type": "string" - } - } - }, "v1.ExecAction": { "description": "ExecAction describes a \"run in container\" action.", "properties": { @@ -18764,39 +16807,6 @@ } } }, - "v1.ObjectReference": { - "description": "ObjectReference contains enough information to let you inspect or modify the referred object.", - "properties": { - "apiVersion": { - "description": "API version of the referent.", - "type": "string" - }, - "fieldPath": { - "description": "If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.", - "type": "string" - }, - "kind": { - "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "name": { - "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", - "type": "string" - }, - "namespace": { - "description": "Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/", - "type": "string" - }, - "resourceVersion": { - "description": "Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", - "type": "string" - }, - "uid": { - "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids", - "type": "string" - } - } - }, "v1.OwnerReference": { "description": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", "required": [ @@ -19700,6 +17710,29 @@ } } }, + "v1.ResourceQuotaSpec": { + "description": "ResourceQuotaSpec defines the desired hard limits to enforce for Quota.", + "properties": { + "hard": { + "description": "hard is the set of desired hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/resource.Quantity" + } + }, + "scopeSelector": { + "description": "scopeSelector is also a collection of filters like scopes that must match each object tracked by a quota but expressed using ScopeSelectorOperator in combination with possible values. For a resource to match, both scopes AND scopeSelector (if specified in spec), must be matched.", + "$ref": "#/definitions/v1.ScopeSelector" + }, + "scopes": { + "description": "A collection of filters that must match each object tracked by a quota. If not specified, the quota matches all objects.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "v1.ResourceQuotaStatus": { "description": "ResourceQuotaStatus defines the enforced hard limits and observed use.", "properties": { @@ -19827,19 +17860,6 @@ } } }, - "v1.RollingUpdateDeployment": { - "description": "Spec to control the desired behavior of rolling update.", - "properties": { - "maxSurge": { - "description": "The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.", - "type": "string" - }, - "maxUnavailable": { - "description": "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.", - "type": "string" - } - } - }, "v1.RollingUpdateStatefulSetStrategy": { "description": "RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.", "properties": { @@ -19921,42 +17941,39 @@ } } }, - "v1.Secret": { - "description": "Secret holds secret data of a certain type. The total bytes of the values in the Data field must be less than MaxSecretSize bytes.", + "v1.ScopeSelector": { + "description": "A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements.", "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "matchExpressions": { + "description": "A list of scope selector requirements by scope of the resources.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.ScopedResourceSelectorRequirement" + } + } + } + }, + "v1.ScopedResourceSelectorRequirement": { + "description": "A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator that relates the scope name and values.", + "required": [ + "scopeName", + "operator" + ], + "properties": { + "operator": { + "description": "Represents a scope's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist.", "type": "string" }, - "data": { - "description": "Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4", - "type": "object", - "additionalProperties": { + "scopeName": { + "description": "The name of the scope that the selector applies to.", + "type": "string" + }, + "values": { + "description": "An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.", + "type": "array", + "items": { "type": "string" } - }, - "immutable": { - "description": "Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. This is an alpha field enabled by ImmutableEphemeralVolumes feature gate.", - "type": "boolean" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "$ref": "#/definitions/v1.ObjectMeta" - }, - "stringData": { - "description": "stringData allows specifying non-binary secret data in string form. It is provided as a write-only convenience method. All keys and values are merged into the data field on write, overwriting any existing values. It is never output when reading from the API.", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "type": { - "description": "Used to facilitate programmatic handling of secret data.", - "type": "string" } } }, @@ -20871,6 +18888,299 @@ } } }, + "v1alpha1.HelmApplication": { + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/v1alpha1.HelmApplicationSpec" + }, + "status": { + "$ref": "#/definitions/v1alpha1.HelmApplicationStatus" + } + } + }, + "v1alpha1.HelmApplicationSpec": { + "required": [ + "name" + ], + "properties": { + "abstraction": { + "type": "string" + }, + "appHome": { + "type": "string" + }, + "attachments": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "v1alpha1.HelmApplicationStatus": { + "required": [ + "updateTime", + "statusTime" + ], + "properties": { + "latestVersion": { + "type": "string" + }, + "state": { + "type": "string" + }, + "statusTime": { + "type": "string" + }, + "updateTime": { + "type": "string" + } + } + }, + "v1alpha1.HelmRelease": { + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/v1alpha1.HelmReleaseSpec" + }, + "status": { + "$ref": "#/definitions/v1alpha1.HelmReleaseStatus" + } + } + }, + "v1alpha1.HelmReleaseDeployStatus": { + "required": [ + "state", + "deployTime" + ], + "properties": { + "deployTime": { + "type": "string" + }, + "message": { + "type": "string" + }, + "state": { + "type": "string" + } + } + }, + "v1alpha1.HelmReleaseSpec": { + "required": [ + "name", + "chartName", + "chartVersion", + "version" + ], + "properties": { + "appId": { + "type": "string" + }, + "appVerId": { + "type": "string" + }, + "chartAppVer": { + "type": "string" + }, + "chartName": { + "type": "string" + }, + "chartVersion": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "repoId": { + "type": "string" + }, + "values": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.HelmReleaseStatus": { + "required": [ + "state" + ], + "properties": { + "deployStatus": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.HelmReleaseDeployStatus" + } + }, + "lastDeployed": { + "type": "string" + }, + "lastUpdate": { + "type": "string" + }, + "message": { + "type": "string" + }, + "state": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.HelmRepo": { + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/v1alpha1.HelmRepoSpec" + }, + "status": { + "$ref": "#/definitions/v1alpha1.HelmRepoStatus" + } + } + }, + "v1alpha1.HelmRepoCredential": { + "properties": { + "accessKeyID": { + "type": "string" + }, + "caFile": { + "type": "string" + }, + "certFile": { + "type": "string" + }, + "insecureSkipTLSVerify": { + "type": "boolean" + }, + "keyFile": { + "type": "string" + }, + "password": { + "type": "string" + }, + "secretAccessKey": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "v1alpha1.HelmRepoSpec": { + "required": [ + "name", + "url" + ], + "properties": { + "credential": { + "$ref": "#/definitions/v1alpha1.HelmRepoCredential" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "syncPeriod": { + "type": "integer", + "format": "int32" + }, + "url": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.HelmRepoStatus": { + "properties": { + "data": { + "type": "string" + }, + "lastUpdateTime": { + "type": "string" + }, + "state": { + "type": "string" + }, + "syncState": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha1.HelmRepoSyncState" + } + }, + "version": { + "type": "integer", + "format": "int32" + } + } + }, + "v1alpha1.HelmRepoSyncState": { + "required": [ + "syncTime" + ], + "properties": { + "message": { + "type": "string" + }, + "state": { + "type": "string" + }, + "syncTime": { + "type": "string" + } + } + }, "v1alpha1.WorkspaceSpec": { "properties": { "manager": { @@ -21417,10 +19727,10 @@ }, "v1alpha2.NodeSummary": { "required": [ - "id", - "label", "labelMinor", - "rank" + "rank", + "id", + "label" ], "properties": { "adjacency": { @@ -21558,6 +19868,89 @@ } } }, + "v1alpha2.ResourceQuota": { + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/v1.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/v1alpha2.ResourceQuotaSpec" + }, + "status": { + "$ref": "#/definitions/v1alpha2.ResourceQuotaStatus" + } + } + }, + "v1alpha2.ResourceQuotaSpec": { + "required": [ + "selector", + "quota" + ], + "properties": { + "quota": { + "$ref": "#/definitions/v1.ResourceQuotaSpec" + }, + "selector": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "v1alpha2.ResourceQuotaStatus": { + "required": [ + "total", + "namespaces" + ], + "properties": { + "namespaces": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha2.ResourceQuotaStatusByNamespace" + } + }, + "total": { + "$ref": "#/definitions/v1.ResourceQuotaStatus" + } + } + }, + "v1alpha2.ResourceQuotaStatusByNamespace": { + "description": "ResourceQuotaStatus defines the enforced hard limits and observed use.", + "required": [ + "namespace" + ], + "properties": { + "hard": { + "description": "Hard is the set of enforced hard limits for each named resource. More info: https://kubernetes.io/docs/concepts/policy/resource-quotas/", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/resource.Quantity" + } + }, + "namespace": { + "type": "string" + }, + "used": { + "description": "Used is the current observed total usage of the resource in the namespace.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/resource.Quantity" + } + } + } + }, "v1alpha2.Row": { "required": [ "id", @@ -21777,511 +20170,6 @@ } } }, - "v1alpha2.appHealthResponse": {}, - "v1alpha2.graphResponse": {}, - "v1alpha2.metricsResponse": {}, - "v1alpha2.namespaceAppHealthResponse": {}, - "v1alpha2.serviceHealthResponse": {}, - "v1alpha2.workloadHealthResponse": {}, - "v1alpha3.BitbucketServerSource": { - "properties": { - "api_uri": { - "description": "The api url can specify the location of the github apiserver.For private cloud configuration", - "type": "string" - }, - "credential_id": { - "description": "credential id to access github source", - "type": "string" - }, - "discover_branches": { - "description": "Discover branch configuration", - "type": "integer", - "format": "int32" - }, - "discover_pr_from_forks": { - "description": "Discover fork PR configuration", - "$ref": "#/definitions/v1alpha3.DiscoverPRFromForks" - }, - "discover_pr_from_origin": { - "description": "Discover origin PR configuration", - "type": "integer", - "format": "int32" - }, - "discover_tags": { - "description": "Discover tag configuration", - "type": "boolean" - }, - "git_clone_option": { - "description": "advavced git clone options", - "$ref": "#/definitions/v1alpha3.GitCloneOption" - }, - "owner": { - "description": "owner of github repo", - "type": "string" - }, - "regex_filter": { - "description": "Regex used to match the name of the branch that needs to be run", - "type": "string" - }, - "repo": { - "description": "repo name of github repo", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - } - } - }, - "v1alpha3.DevOpsProject": { - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "$ref": "#/definitions/v1alpha3.DevOpsProjectSpec" - }, - "status": { - "$ref": "#/definitions/v1alpha3.DevOpsProjectStatus" - } - } - }, - "v1alpha3.DevOpsProjectSpec": {}, - "v1alpha3.DevOpsProjectStatus": { - "properties": { - "adminNamespace": { - "type": "string" - } - } - }, - "v1alpha3.DiscarderProperty": { - "properties": { - "days_to_keep": { - "description": "days to keep pipeline", - "type": "string" - }, - "num_to_keep": { - "description": "nums to keep pipeline", - "type": "string" - } - } - }, - "v1alpha3.DiscoverPRFromForks": { - "properties": { - "strategy": { - "description": "github discover strategy", - "type": "integer", - "format": "int32" - }, - "trust": { - "description": "trust user type", - "type": "integer", - "format": "int32" - } - } - }, - "v1alpha3.GitCloneOption": { - "properties": { - "depth": { - "description": "git clone depth", - "type": "integer", - "format": "int32" - }, - "shallow": { - "description": "Whether to use git shallow clone", - "type": "boolean" - }, - "timeout": { - "description": "git clone timeout mins", - "type": "integer", - "format": "int32" - } - } - }, - "v1alpha3.GitSource": { - "properties": { - "credential_id": { - "description": "credential id to access git source", - "type": "string" - }, - "discover_branches": { - "description": "Whether to discover a branch", - "type": "boolean" - }, - "discover_tags": { - "description": "Discover tags configuration", - "type": "boolean" - }, - "git_clone_option": { - "description": "advavced git clone options", - "$ref": "#/definitions/v1alpha3.GitCloneOption" - }, - "regex_filter": { - "description": "Regex used to match the name of the branch that needs to be run", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - }, - "url": { - "description": "url of git source", - "type": "string" - } - } - }, - "v1alpha3.GithubSource": { - "properties": { - "api_uri": { - "description": "The api url can specify the location of the github apiserver.For private cloud configuration", - "type": "string" - }, - "credential_id": { - "description": "credential id to access github source", - "type": "string" - }, - "discover_branches": { - "description": "Discover branch configuration", - "type": "integer", - "format": "int32" - }, - "discover_pr_from_forks": { - "description": "Discover fork PR configuration", - "$ref": "#/definitions/v1alpha3.DiscoverPRFromForks" - }, - "discover_pr_from_origin": { - "description": "Discover origin PR configuration", - "type": "integer", - "format": "int32" - }, - "discover_tags": { - "description": "Discover tag configuration", - "type": "boolean" - }, - "git_clone_option": { - "description": "advavced git clone options", - "$ref": "#/definitions/v1alpha3.GitCloneOption" - }, - "owner": { - "description": "owner of github repo", - "type": "string" - }, - "regex_filter": { - "description": "Regex used to match the name of the branch that needs to be run", - "type": "string" - }, - "repo": { - "description": "repo name of github repo", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - } - } - }, - "v1alpha3.GitlabSource": { - "properties": { - "api_uri": { - "description": "The api url can specify the location of the gitlab apiserver.For private cloud configuration", - "type": "string" - }, - "credential_id": { - "description": "credential id to access gitlab source", - "type": "string" - }, - "discover_branches": { - "description": "Discover branch configuration", - "type": "integer", - "format": "int32" - }, - "discover_pr_from_forks": { - "description": "Discover fork PR configuration", - "$ref": "#/definitions/v1alpha3.DiscoverPRFromForks" - }, - "discover_pr_from_origin": { - "description": "Discover origin PR configuration", - "type": "integer", - "format": "int32" - }, - "discover_tags": { - "description": "Discover tags configuration", - "type": "boolean" - }, - "git_clone_option": { - "description": "advavced git clone options", - "$ref": "#/definitions/v1alpha3.GitCloneOption" - }, - "owner": { - "description": "owner of gitlab repo", - "type": "string" - }, - "regex_filter": { - "description": "Regex used to match the name of the branch that needs to be run", - "type": "string" - }, - "repo": { - "description": "repo name of gitlab repo", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - }, - "server_name": { - "description": "the name of gitlab server which was configured in jenkins", - "type": "string" - } - } - }, - "v1alpha3.MultiBranchJobTrigger": { - "properties": { - "create_action_job_to_trigger": { - "description": "pipeline name to trigger", - "type": "string" - }, - "delete_action_job_to_trigger": { - "description": "pipeline name to trigger", - "type": "string" - } - } - }, - "v1alpha3.MultiBranchPipeline": { - "required": [ - "name", - "source_type", - "script_path" - ], - "properties": { - "bitbucket_server_source": { - "description": "bitbucket server scm defile", - "$ref": "#/definitions/v1alpha3.BitbucketServerSource" - }, - "description": { - "description": "description of pipeline", - "type": "string" - }, - "discarder": { - "description": "Discarder of pipeline, managing when to drop a pipeline", - "$ref": "#/definitions/v1alpha3.DiscarderProperty" - }, - "git_source": { - "description": "git scm define", - "$ref": "#/definitions/v1alpha3.GitSource" - }, - "github_source": { - "description": "github scm define", - "$ref": "#/definitions/v1alpha3.GithubSource" - }, - "gitlab_source": { - "description": "gitlab scm define", - "$ref": "#/definitions/v1alpha3.GitlabSource" - }, - "multibranch_job_trigger": { - "description": "Pipeline tasks that need to be triggered when branch creation/deletion", - "$ref": "#/definitions/v1alpha3.MultiBranchJobTrigger" - }, - "name": { - "description": "name of pipeline", - "type": "string" - }, - "script_path": { - "description": "script path in scm", - "type": "string" - }, - "single_svn_source": { - "description": "single branch svn scm define", - "$ref": "#/definitions/v1alpha3.SingleSvnSource" - }, - "source_type": { - "description": "type of scm, such as github/git/svn", - "type": "string" - }, - "svn_source": { - "description": "multi branch svn scm define", - "$ref": "#/definitions/v1alpha3.SvnSource" - }, - "timer_trigger": { - "description": "Timer to trigger pipeline run", - "$ref": "#/definitions/v1alpha3.TimerTrigger" - } - } - }, - "v1alpha3.NoScmPipeline": { - "required": [ - "name" - ], - "properties": { - "description": { - "description": "description of pipeline", - "type": "string" - }, - "disable_concurrent": { - "description": "Whether to prohibit the pipeline from running in parallel", - "type": "boolean" - }, - "discarder": { - "description": "Discarder of pipeline, managing when to drop a pipeline", - "$ref": "#/definitions/v1alpha3.DiscarderProperty" - }, - "jenkinsfile": { - "description": "Jenkinsfile's content'", - "type": "string" - }, - "name": { - "description": "name of pipeline", - "type": "string" - }, - "parameters": { - "description": "Parameters define of pipeline,user could pass param when run pipeline", - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha3.Parameter" - } - }, - "remote_trigger": { - "description": "Remote api define to trigger pipeline run", - "$ref": "#/definitions/v1alpha3.RemoteTrigger" - }, - "timer_trigger": { - "description": "Timer to trigger pipeline run", - "$ref": "#/definitions/v1alpha3.TimerTrigger" - } - } - }, - "v1alpha3.Parameter": { - "required": [ - "name", - "type" - ], - "properties": { - "default_value": { - "description": "default value of param", - "type": "string" - }, - "description": { - "description": "description of pipeline", - "type": "string" - }, - "name": { - "description": "name of param", - "type": "string" - }, - "type": { - "description": "type of param", - "type": "string" - } - } - }, - "v1alpha3.Pipeline": { - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "$ref": "#/definitions/v1alpha3.PipelineSpec" - }, - "status": { - "$ref": "#/definitions/v1alpha3.PipelineStatus" - } - } - }, - "v1alpha3.PipelineSpec": { - "required": [ - "type" - ], - "properties": { - "multi_branch_pipeline": { - "description": "in scm pipeline structs", - "$ref": "#/definitions/v1alpha3.MultiBranchPipeline" - }, - "pipeline": { - "description": "no scm pipeline structs", - "$ref": "#/definitions/v1alpha3.NoScmPipeline" - }, - "type": { - "description": "type of devops pipeline, in scm or no scm", - "type": "string" - } - } - }, - "v1alpha3.PipelineStatus": {}, - "v1alpha3.RemoteTrigger": { - "properties": { - "token": { - "description": "remote trigger token", - "type": "string" - } - } - }, - "v1alpha3.SingleSvnSource": { - "properties": { - "credential_id": { - "description": "credential id to access svn source", - "type": "string" - }, - "remote": { - "description": "remote address url", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - } - } - }, - "v1alpha3.SvnSource": { - "properties": { - "credential_id": { - "description": "credential id to access svn source", - "type": "string" - }, - "excludes": { - "description": "branches do not run pipeline", - "type": "string" - }, - "includes": { - "description": "branches to run pipeline", - "type": "string" - }, - "remote": { - "description": "remote address url", - "type": "string" - }, - "scm_id": { - "description": "uid of scm", - "type": "string" - } - } - }, - "v1alpha3.TimerTrigger": { - "properties": { - "cron": { - "description": "jenkins cron script", - "type": "string" - }, - "interval": { - "description": "interval ms", - "type": "string" - } - } - }, "v1beta1.ClusterOverride": { "required": [ "path" @@ -22357,147 +20245,6 @@ } } }, - "v1beta1.HTTPIngressPath": { - "description": "HTTPIngressPath associates a path with a backend. Incoming urls matching the path are forwarded to the backend.", - "required": [ - "backend" - ], - "properties": { - "backend": { - "description": "Backend defines the referenced service endpoint to which the traffic will be forwarded to.", - "$ref": "#/definitions/v1beta1.IngressBackend" - }, - "path": { - "description": "Path is matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional \"path\" part of a URL as defined by RFC 3986. Paths must begin with a '/'. When unspecified, all paths from incoming requests are matched.", - "type": "string" - }, - "pathType": { - "description": "PathType determines the interpretation of the Path matching. PathType can be one of the following values: * Exact: Matches the URL path exactly. * Prefix: Matches based on a URL path prefix split by '/'. Matching is\n done on a path element by element basis. A path element refers is the\n list of labels in the path split by the '/' separator. A request is a\n match for path p if every p is an element-wise prefix of p of the\n request path. Note that if the last element of the path is a substring\n of the last element in request path, it is not a match (e.g. /foo/bar\n matches /foo/bar/baz, but does not match /foo/barbaz).\n* ImplementationSpecific: Interpretation of the Path matching is up to\n the IngressClass. Implementations can treat this as a separate PathType\n or treat it identically to Prefix or Exact path types.\nImplementations are required to support all path types. Defaults to ImplementationSpecific.", - "type": "string" - } - } - }, - "v1beta1.HTTPIngressRuleValue": { - "description": "HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http://\u003chost\u003e/\u003cpath\u003e?\u003csearchpart\u003e -\u003e backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'.", - "required": [ - "paths" - ], - "properties": { - "paths": { - "description": "A collection of paths that map requests to backends.", - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.HTTPIngressPath" - } - } - } - }, - "v1beta1.Ingress": { - "description": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc. DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information.", - "properties": { - "apiVersion": { - "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - "type": "string" - }, - "kind": { - "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "type": "string" - }, - "metadata": { - "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "$ref": "#/definitions/v1.ObjectMeta" - }, - "spec": { - "description": "Spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", - "$ref": "#/definitions/v1beta1.IngressSpec" - }, - "status": { - "description": "Status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status", - "$ref": "#/definitions/v1beta1.IngressStatus" - } - } - }, - "v1beta1.IngressBackend": { - "description": "IngressBackend describes all endpoints for a given service and port.", - "properties": { - "resource": { - "description": "Resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. If resource is specified, serviceName and servicePort must not be specified.", - "$ref": "#/definitions/v1.TypedLocalObjectReference" - }, - "serviceName": { - "description": "Specifies the name of the referenced service.", - "type": "string" - }, - "servicePort": { - "description": "Specifies the port of the referenced service.", - "type": "string" - } - } - }, - "v1beta1.IngressRule": { - "description": "IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.", - "properties": { - "host": { - "description": "Host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to\n the IP in the Spec of the parent Ingress.\n2. The `:` delimiter is not respected because ports are not allowed.\n\t Currently the port of an Ingress is implicitly :80 for http and\n\t :443 for https.\nBoth these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.\n\nHost can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.bar.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \"*.foo.com\"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == \"*\"). Requests will be matched against the Host field in the following way: 1. If Host is precise, the request matches this rule if the http host header is equal to Host. 2. If Host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule.", - "type": "string" - }, - "http": { - "$ref": "#/definitions/v1beta1.HTTPIngressRuleValue" - } - } - }, - "v1beta1.IngressSpec": { - "description": "IngressSpec describes the Ingress the user wishes to exist.", - "properties": { - "backend": { - "description": "A default backend capable of servicing requests that don't match any rule. At least one of 'backend' or 'rules' must be specified. This field is optional to allow the loadbalancer controller or defaulting logic to specify a global default.", - "$ref": "#/definitions/v1beta1.IngressBackend" - }, - "ingressClassName": { - "description": "IngressClassName is the name of the IngressClass cluster resource. The associated IngressClass defines which controller will implement the resource. This replaces the deprecated `kubernetes.io/ingress.class` annotation. For backwards compatibility, when that annotation is set, it must be given precedence over this field. The controller may emit a warning if the field and annotation have different values. Implementations of this API should ignore Ingresses without a class specified. An IngressClass resource may be marked as default, which can be used to set a default value for this field. For more information, refer to the IngressClass documentation.", - "type": "string" - }, - "rules": { - "description": "A list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.", - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.IngressRule" - } - }, - "tls": { - "description": "TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.", - "type": "array", - "items": { - "$ref": "#/definitions/v1beta1.IngressTLS" - } - } - } - }, - "v1beta1.IngressStatus": { - "description": "IngressStatus describe the current state of the Ingress.", - "properties": { - "loadBalancer": { - "description": "LoadBalancer contains the current status of the load-balancer.", - "$ref": "#/definitions/v1.LoadBalancerStatus" - } - } - }, - "v1beta1.IngressTLS": { - "description": "IngressTLS describes the transport layer security associated with an Ingress.", - "properties": { - "hosts": { - "description": "Hosts are a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.", - "type": "array", - "items": { - "type": "string" - } - }, - "secretName": { - "description": "SecretName is the name of the secret used to terminate SSL traffic on 443. Field is left optional to allow SSL routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing.", - "type": "string" - } - } - }, "v1beta1.WorkspaceTemplate": { "description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", "properties": { @@ -22508,6 +20255,220 @@ "$ref": "#/definitions/v1alpha1.WorkspaceSpec" } } + }, + "v2alpha1.Alert": { + "properties": { + "activeAt": { + "description": "time when alert is active", + "type": "string", + "format": "date-time" + }, + "annotations": { + "description": "annotations", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "labels": { + "description": "labels", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "ruleId": { + "description": "rule id triggering the alert", + "type": "string" + }, + "ruleName": { + "description": "rule name triggering the alert", + "type": "string" + }, + "state": { + "description": "state", + "type": "string" + }, + "value": { + "description": "the value at the last evaluation of the query expression", + "type": "string" + } + } + }, + "v2alpha1.AlertList": { + "required": [ + "items", + "total" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.Alert" + } + }, + "total": { + "type": "integer", + "format": "int32" + } + } + }, + "v2alpha1.BulkItemResponse": { + "properties": { + "error": { + "description": "It is only returned for failed operations", + "type": "string" + }, + "errorType": { + "description": "It may be bad_data, duplicate_name, not_found or server_error, and only for failed operations", + "type": "string" + }, + "result": { + "description": "It may be created, updated or deleted, and only for successful operations", + "type": "string" + }, + "ruleName": { + "type": "string" + }, + "status": { + "description": "It may be success or error", + "type": "string" + } + } + }, + "v2alpha1.BulkResponse": { + "required": [ + "errors", + "items" + ], + "properties": { + "errors": { + "description": "If true, one or more operations in the bulk request don't complete successfully", + "type": "boolean" + }, + "items": { + "description": "It contains the result of each operation in the bulk request", + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.BulkItemResponse" + } + } + } + }, + "v2alpha1.GettableAlertingRule": { + "properties": { + "alerts": { + "description": "alerts", + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.Alert" + } + }, + "annotations": { + "description": "non-identifying key/value pairs. summary, message, description are the commonly used annotation names", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "duration": { + "description": "duration an alert transitions from Pending to Firing state, which must match ^([0-9]+)(y|w|d|h|m|s|ms)$", + "type": "string" + }, + "evaluationTime": { + "description": "taken seconds for evaluation of query expression", + "type": "number", + "format": "double" + }, + "health": { + "description": "health state of a rule based on the last execution, one of ok, err, unknown", + "type": "string" + }, + "id": { + "description": "rule id is only used by built-in alerting rules", + "type": "string" + }, + "labels": { + "description": "extra labels to attach to the resulting alert sample vectors (the key string has to match [a-zA-Z_][a-zA-Z0-9_]*). eg: a typical label called severity, whose value may be info, warning, error, critical, is usually used to indicate the severity of an alert", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "lastError": { + "description": "error for the last execution", + "type": "string" + }, + "lastEvaluation": { + "description": "time for last evaluation of query expression", + "type": "string", + "format": "date-time" + }, + "name": { + "description": "rule name should be unique in one namespace for custom alerting rules", + "type": "string" + }, + "query": { + "description": "prometheus query expression, grammars of which may be referred to https://prometheus.io/docs/prometheus/latest/querying/basics/", + "type": "string" + }, + "state": { + "description": "state of a rule based on its alerts, one of firing, pending, inactive", + "type": "string" + } + } + }, + "v2alpha1.GettableAlertingRuleList": { + "required": [ + "items", + "total" + ], + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v2alpha1.GettableAlertingRule" + } + }, + "total": { + "type": "integer", + "format": "int32" + } + } + }, + "v2alpha1.PostableAlertingRule": { + "properties": { + "annotations": { + "description": "non-identifying key/value pairs. summary, message, description are the commonly used annotation names", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "duration": { + "description": "duration an alert transitions from Pending to Firing state, which must match ^([0-9]+)(y|w|d|h|m|s|ms)$", + "type": "string" + }, + "id": { + "description": "rule id is only used by built-in alerting rules", + "type": "string" + }, + "labels": { + "description": "extra labels to attach to the resulting alert sample vectors (the key string has to match [a-zA-Z_][a-zA-Z0-9_]*). eg: a typical label called severity, whose value may be info, warning, error, critical, is usually used to indicate the severity of an alert", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "description": "rule name should be unique in one namespace for custom alerting rules", + "type": "string" + }, + "query": { + "description": "prometheus query expression, grammars of which may be referred to https://prometheus.io/docs/prometheus/latest/querying/basics/", + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index eface1aa8..48526d095 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -186,7 +186,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterList" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.ClusterList" } } }, @@ -220,7 +220,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, { @@ -242,19 +242,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -422,7 +422,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -456,7 +456,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, { @@ -478,13 +478,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -625,7 +625,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -676,7 +676,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -710,7 +710,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, { @@ -732,13 +732,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -804,7 +804,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } } }, @@ -1185,7 +1185,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinaryList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinaryList" } } }, @@ -1219,7 +1219,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, { @@ -1241,19 +1241,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1421,7 +1421,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1455,7 +1455,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, { @@ -1477,13 +1477,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1624,7 +1624,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1675,7 +1675,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1709,7 +1709,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, { @@ -1731,13 +1731,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1803,7 +1803,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } } }, @@ -1914,7 +1914,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderList" } } }, @@ -1948,7 +1948,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, { @@ -1970,19 +1970,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2150,7 +2150,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2184,7 +2184,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, { @@ -2206,13 +2206,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2353,7 +2353,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2404,7 +2404,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2438,7 +2438,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, { @@ -2460,13 +2460,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2532,7 +2532,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } } }, @@ -2643,7 +2643,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateList" } } }, @@ -2677,7 +2677,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, { @@ -2699,19 +2699,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -2879,7 +2879,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -2913,7 +2913,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, { @@ -2935,13 +2935,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -3082,7 +3082,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -3133,7 +3133,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -3167,7 +3167,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, { @@ -3189,13 +3189,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -3261,7 +3261,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } } }, @@ -3372,7 +3372,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRunList" } } }, @@ -3406,7 +3406,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, { @@ -3428,19 +3428,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3608,7 +3608,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3642,7 +3642,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, { @@ -3664,13 +3664,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3811,7 +3811,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3862,7 +3862,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3896,7 +3896,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, { @@ -3918,13 +3918,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -3990,7 +3990,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } } }, @@ -4971,7 +4971,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProjectList" } } }, @@ -5005,7 +5005,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, { @@ -5027,19 +5027,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5207,7 +5207,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5241,7 +5241,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, { @@ -5263,13 +5263,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5410,7 +5410,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5461,7 +5461,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5495,7 +5495,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, { @@ -5517,13 +5517,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5589,7 +5589,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } } }, @@ -5700,7 +5700,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineList" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.PipelineList" } } }, @@ -5734,7 +5734,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, { @@ -5756,19 +5756,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -5936,7 +5936,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -5970,7 +5970,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, { @@ -5992,13 +5992,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -6139,7 +6139,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -6190,7 +6190,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -6224,7 +6224,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, { @@ -6246,13 +6246,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -6318,7 +6318,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } } }, @@ -6909,7 +6909,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolList" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPoolList" } } }, @@ -6943,7 +6943,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, { @@ -6965,19 +6965,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7145,7 +7145,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7179,7 +7179,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, { @@ -7201,13 +7201,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7348,7 +7348,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7399,7 +7399,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7433,7 +7433,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, { @@ -7455,13 +7455,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7527,7 +7527,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } } }, @@ -7638,7 +7638,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicyList" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicyList" } } }, @@ -7672,7 +7672,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, { @@ -7694,19 +7694,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -7874,7 +7874,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -7908,7 +7908,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, { @@ -7930,13 +7930,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -8077,7 +8077,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -8128,7 +8128,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -8162,7 +8162,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, { @@ -8184,13 +8184,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -8256,7 +8256,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } } }, @@ -9057,7 +9057,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceList" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.WorkspaceList" } } }, @@ -9091,7 +9091,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, { @@ -9113,19 +9113,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9293,7 +9293,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9327,7 +9327,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, { @@ -9349,13 +9349,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9496,7 +9496,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9547,7 +9547,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9581,7 +9581,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, { @@ -9603,13 +9603,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9675,7 +9675,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } } }, @@ -9969,6 +9969,11 @@ "kind": "DeleteOptions", "version": "v1" }, + { + "group": "application.kubesphere.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, { "group": "cluster.kubesphere.io", "kind": "DeleteOptions", @@ -10368,6 +10373,11 @@ "kind": "WatchEvent", "version": "v1" }, + { + "group": "application.kubesphere.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, { "group": "cluster.kubesphere.io", "kind": "WatchEvent", @@ -10414,7 +10424,7 @@ "type": "string", "format": "int-or-string" }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster": { + "io.kubesphere.api.cluster.v1alpha1.Cluster": { "description": "Cluster is the schema for the clusters API", "type": "object", "properties": { @@ -10430,10 +10440,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterSpec" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.ClusterSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterStatus" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.ClusterStatus" } }, "x-kubernetes-group-version-kind": [ @@ -10444,7 +10454,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterCondition": { + "io.kubesphere.api.cluster.v1alpha1.ClusterCondition": { "type": "object", "required": [ "type", @@ -10477,7 +10487,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterList": { + "io.kubesphere.api.cluster.v1alpha1.ClusterList": { "type": "object", "required": [ "items" @@ -10490,7 +10500,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Cluster" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Cluster" } }, "kind": { @@ -10509,12 +10519,12 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterSpec": { + "io.kubesphere.api.cluster.v1alpha1.ClusterSpec": { "type": "object", "properties": { "connection": { "description": "Connection holds info to connect to the member cluster", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Connection" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.Connection" }, "enable": { "description": "Desired state of the cluster", @@ -10530,14 +10540,14 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterStatus": { + "io.kubesphere.api.cluster.v1alpha1.ClusterStatus": { "type": "object", "properties": { "conditions": { "description": "Represents the latest available observations of a cluster's current state.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.ClusterCondition" + "$ref": "#/definitions/io.kubesphere.api.cluster.v1alpha1.ClusterCondition" } }, "configz": { @@ -10569,7 +10579,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.cluster.v1alpha1.Connection": { + "io.kubesphere.api.cluster.v1alpha1.Connection": { "type": "object", "properties": { "kubeconfig": { @@ -10605,7 +10615,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.AuthConfig": { + "io.kubesphere.api.devops.v1alpha1.AuthConfig": { "description": "AuthConfig is our abstraction of the Registry authorization information for whatever docker client we happen to be based on", "type": "object", "properties": { @@ -10626,7 +10636,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.CGroupLimits": { + "io.kubesphere.api.devops.v1alpha1.CGroupLimits": { "description": "CGroupLimits holds limits used to constrain container resources.", "type": "object", "required": [ @@ -10663,7 +10673,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.ContainerInfo": { + "io.kubesphere.api.devops.v1alpha1.ContainerInfo": { "type": "object", "properties": { "buildVolumes": { @@ -10680,7 +10690,7 @@ "runtimeArtifacts": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.VolumeSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.VolumeSpec" } }, "runtimeImage": { @@ -10688,7 +10698,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.DockerConfig": { + "io.kubesphere.api.devops.v1alpha1.DockerConfig": { "description": "DockerConfig contains the configuration for a Docker connection.", "type": "object", "required": [ @@ -10726,7 +10736,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.EnvironmentSpec": { + "io.kubesphere.api.devops.v1alpha1.EnvironmentSpec": { "description": "EnvironmentSpec specifies a single environment variable.", "type": "object", "required": [ @@ -10742,7 +10752,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.Parameter": { + "io.kubesphere.api.devops.v1alpha1.Parameter": { "type": "object", "properties": { "defaultValue": { @@ -10771,7 +10781,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.ProxyConfig": { + "io.kubesphere.api.devops.v1alpha1.ProxyConfig": { "description": "ProxyConfig holds proxy configuration.", "type": "object", "properties": { @@ -10783,7 +10793,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary": { + "io.kubesphere.api.devops.v1alpha1.S2iBinary": { "description": "S2iBinary is the Schema for the s2ibinaries API", "type": "object", "properties": { @@ -10799,10 +10809,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinarySpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinarySpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinaryStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinaryStatus" } }, "x-kubernetes-group-version-kind": [ @@ -10813,7 +10823,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinaryList": { + "io.kubesphere.api.devops.v1alpha1.S2iBinaryList": { "description": "S2iBinaryList contains a list of S2iBinary", "type": "object", "required": [ @@ -10827,7 +10837,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinary" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBinary" } }, "kind": { @@ -10846,7 +10856,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinarySpec": { + "io.kubesphere.api.devops.v1alpha1.S2iBinarySpec": { "description": "S2iBinarySpec defines the desired state of S2iBinary", "type": "object", "properties": { @@ -10872,7 +10882,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBinaryStatus": { + "io.kubesphere.api.devops.v1alpha1.S2iBinaryStatus": { "description": "S2iBinaryStatus defines the observed state of S2iBinary", "type": "object", "properties": { @@ -10882,7 +10892,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuildResult": { + "io.kubesphere.api.devops.v1alpha1.S2iBuildResult": { "type": "object", "properties": { "commandPull": { @@ -10915,7 +10925,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuildSource": { + "io.kubesphere.api.devops.v1alpha1.S2iBuildSource": { "type": "object", "properties": { "binaryName": { @@ -10957,7 +10967,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilder": { "description": "S2iBuilder is the Schema for the s2ibuilders API", "type": "object", "properties": { @@ -10973,10 +10983,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderStatus" } }, "x-kubernetes-group-version-kind": [ @@ -10987,7 +10997,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderList": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderList": { "description": "S2iBuilderList contains a list of S2iBuilder", "type": "object", "required": [ @@ -11001,7 +11011,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilder" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilder" } }, "kind": { @@ -11020,21 +11030,21 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderSpec": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderSpec": { "description": "S2iBuilderSpec defines the desired state of S2iBuilder", "type": "object", "properties": { "config": { "description": "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iConfig" }, "fromTemplate": { "description": "FromTemplate define some inputs from user", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.UserDefineTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.UserDefineTemplate" } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderStatus": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderStatus": { "description": "S2iBuilderStatus defines the observed state of S2iBuilder", "type": "object", "required": [ @@ -11060,7 +11070,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate": { "description": "S2iBuilderTemplate is the Schema for the s2ibuildertemplates API", "type": "object", "properties": { @@ -11076,10 +11086,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateStatus" } }, "x-kubernetes-group-version-kind": [ @@ -11090,7 +11100,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateList": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateList": { "description": "S2iBuilderTemplateList contains a list of S2iBuilderTemplate", "type": "object", "required": [ @@ -11104,7 +11114,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplate" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplate" } }, "kind": { @@ -11123,7 +11133,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateSpec": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateSpec": { "description": "S2iBuilderTemplateSpec defines the desired state of S2iBuilderTemplate", "type": "object", "properties": { @@ -11135,7 +11145,7 @@ "description": "Images are the images this template will use.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.ContainerInfo" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.ContainerInfo" } }, "defaultBaseImage": { @@ -11150,7 +11160,7 @@ "description": "Parameters is a set of environment variables to be passed to the image.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.Parameter" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.Parameter" } }, "iconPath": { @@ -11163,11 +11173,11 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuilderTemplateStatus": { + "io.kubesphere.api.devops.v1alpha1.S2iBuilderTemplateStatus": { "description": "S2iBuilderTemplateStatus defines the observed state of S2iBuilderTemplate", "type": "object" }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iConfig": { + "io.kubesphere.api.devops.v1alpha1.S2iConfig": { "type": "object", "required": [ "imageName", @@ -11175,7 +11185,7 @@ ], "properties": { "addHost": { - "description": "AddHost Add a line to /etc/hosts for test purpose or private use in LAN. Its format is host:IP,muliple hosts can be added by using multiple --add-host", + "description": "AddHost Add a line to /etc/hosts for test purpose or private use in LAN. Its format is host:IP,multiple hosts can be added by using multiple --add-host", "type": "array", "items": { "type": "string" @@ -11226,7 +11236,7 @@ }, "cgroupLimits": { "description": "CGroupLimits describes the cgroups limits that will be applied to any containers run by s2i.", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.CGroupLimits" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.CGroupLimits" }, "contextDir": { "description": "Specify a relative directory inside the application repository that should be used as a root directory for the application.", @@ -11246,7 +11256,7 @@ }, "dockerConfig": { "description": "DockerConfig describes how to access host docker daemon.", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.DockerConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.DockerConfig" }, "dockerNetworkMode": { "description": "DockerNetworkMode is used to set the docker network setting to --net=container:\u003cid\u003e when the builder is invoked from a container.", @@ -11263,7 +11273,7 @@ "description": "Environment is a map of environment variables to be passed to the image.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.EnvironmentSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.EnvironmentSpec" } }, "excludeRegExp": { @@ -11300,7 +11310,7 @@ }, "incrementalAuthentication": { "description": "IncrementalAuthentication holds the authentication information for pulling the previous image from private repositories", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.AuthConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.AuthConfig" }, "incrementalFromTag": { "description": "IncrementalFromTag sets an alternative image tag to look for existing artifacts. Tag is used by default if this is not set.", @@ -11310,7 +11320,7 @@ "description": "Injections specifies a list source/destination folders that are injected to the container that runs assemble. All files we inject will be truncated after the assemble script finishes.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.VolumeSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.VolumeSpec" } }, "isBinaryURL": { @@ -11365,11 +11375,11 @@ }, "pullAuthentication": { "description": "PullAuthentication holds the authentication information for pulling the Docker images from private repositories", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.AuthConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.AuthConfig" }, "pushAuthentication": { "description": "PullAuthentication holds the authentication information for pulling the Docker images from private repositories", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.AuthConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.AuthConfig" }, "removePreviousImage": { "description": "RemovePreviousImage describes if previous image should be removed after successful build. This applies only to incremental builds.", @@ -11387,12 +11397,12 @@ "description": "RuntimeArtifacts specifies a list of source/destination pairs that will be copied from builder to a runtime image. Source can be a file or directory. Destination must be a directory. Regardless whether it is an absolute or relative path, it will be placed into image's WORKDIR. Destination also can be empty or equals to \".\", in this case it just refers to a root of WORKDIR. In case it's empty, S2I will try to get this list from io.openshift.s2i.assemble-input-files label on a RuntimeImage.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.VolumeSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.VolumeSpec" } }, "runtimeAuthentication": { "description": "RuntimeAuthentication holds the authentication information for pulling the runtime Docker images from private repositories.", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.AuthConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.AuthConfig" }, "runtimeImage": { "description": "RuntimeImage specifies the image that will be a base for resulting image and will be used for running an application. By default, BuilderImage is used for building and running, but the latter may be overridden.", @@ -11404,7 +11414,7 @@ }, "scriptDownloadProxyConfig": { "description": "ScriptDownloadProxyConfig optionally specifies the http and https proxy to use when downloading scripts", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.ProxyConfig" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.ProxyConfig" }, "scriptsUrl": { "description": "ScriptsURL is a URL describing where to fetch the S2I scripts from during build process. This url can be a reference within the builder image if the scheme is specified as image://", @@ -11447,7 +11457,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun": { + "io.kubesphere.api.devops.v1alpha1.S2iRun": { "description": "S2iRun is the Schema for the s2iruns API", "type": "object", "properties": { @@ -11463,10 +11473,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRunSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRunStatus" } }, "x-kubernetes-group-version-kind": [ @@ -11477,7 +11487,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunList": { + "io.kubesphere.api.devops.v1alpha1.S2iRunList": { "description": "S2iRunList contains a list of S2iRun", "type": "object", "required": [ @@ -11491,7 +11501,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRun" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iRun" } }, "kind": { @@ -11510,7 +11520,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunSpec": { + "io.kubesphere.api.devops.v1alpha1.S2iRunSpec": { "description": "S2iRunSpec defines the desired state of S2iRun", "type": "object", "required": [ @@ -11545,7 +11555,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iRunStatus": { + "io.kubesphere.api.devops.v1alpha1.S2iRunStatus": { "description": "S2iRunStatus defines the observed state of S2iRun", "type": "object", "properties": { @@ -11567,11 +11577,11 @@ }, "s2iBuildResult": { "description": "S2i build result info.", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuildResult" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuildResult" }, "s2iBuildSource": { "description": "S2i build source info.", - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.S2iBuildSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.S2iBuildSource" }, "startTime": { "description": "StartTime represent when this run began", @@ -11579,7 +11589,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.UserDefineTemplate": { + "io.kubesphere.api.devops.v1alpha1.UserDefineTemplate": { "type": "object", "properties": { "builderImage": { @@ -11594,12 +11604,12 @@ "description": "Parameters must use with `template`, fill some parameters which template will use", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.Parameter" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha1.Parameter" } } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha1.VolumeSpec": { + "io.kubesphere.api.devops.v1alpha1.VolumeSpec": { "description": "VolumeSpec represents a single volume mount point.", "type": "object", "properties": { @@ -11617,7 +11627,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.BitbucketServerSource": { + "io.kubesphere.api.devops.v1alpha3.BitbucketServerSource": { "type": "object", "properties": { "api_uri": { @@ -11631,14 +11641,14 @@ "format": "int32" }, "discover_pr_from_forks": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscoverPRFromForks" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DiscoverPRFromForks" }, "discover_pr_from_origin": { "type": "integer", "format": "int32" }, "git_clone_option": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitCloneOption" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.GitCloneOption" }, "owner": { "type": "string" @@ -11654,7 +11664,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject": { + "io.kubesphere.api.devops.v1alpha3.DevOpsProject": { "description": "DevOpsProject is the Schema for the devopsprojects API", "type": "object", "properties": { @@ -11670,10 +11680,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProjectSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProjectStatus" } }, "x-kubernetes-group-version-kind": [ @@ -11684,7 +11694,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectList": { + "io.kubesphere.api.devops.v1alpha3.DevOpsProjectList": { "description": "DevOpsProjectList contains a list of DevOpsProject", "type": "object", "required": [ @@ -11698,7 +11708,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProject" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DevOpsProject" } }, "kind": { @@ -11717,11 +11727,11 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectSpec": { + "io.kubesphere.api.devops.v1alpha3.DevOpsProjectSpec": { "description": "DevOpsProjectSpec defines the desired state of DevOpsProject", "type": "object" }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DevOpsProjectStatus": { + "io.kubesphere.api.devops.v1alpha3.DevOpsProjectStatus": { "description": "DevOpsProjectStatus defines the observed state of DevOpsProject", "type": "object", "properties": { @@ -11731,7 +11741,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscarderProperty": { + "io.kubesphere.api.devops.v1alpha3.DiscarderProperty": { "type": "object", "properties": { "days_to_keep": { @@ -11742,7 +11752,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscoverPRFromForks": { + "io.kubesphere.api.devops.v1alpha3.DiscoverPRFromForks": { "type": "object", "properties": { "strategy": { @@ -11755,7 +11765,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitCloneOption": { + "io.kubesphere.api.devops.v1alpha3.GitCloneOption": { "type": "object", "properties": { "depth": { @@ -11771,7 +11781,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitSource": { + "io.kubesphere.api.devops.v1alpha3.GitSource": { "type": "object", "properties": { "credential_id": { @@ -11781,7 +11791,7 @@ "type": "boolean" }, "git_clone_option": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitCloneOption" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.GitCloneOption" }, "regex_filter": { "type": "string" @@ -11794,7 +11804,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GithubSource": { + "io.kubesphere.api.devops.v1alpha3.GithubSource": { "type": "object", "properties": { "api_uri": { @@ -11808,14 +11818,14 @@ "format": "int32" }, "discover_pr_from_forks": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscoverPRFromForks" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DiscoverPRFromForks" }, "discover_pr_from_origin": { "type": "integer", "format": "int32" }, "git_clone_option": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitCloneOption" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.GitCloneOption" }, "owner": { "type": "string" @@ -11831,7 +11841,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.MultiBranchJobTrigger": { + "io.kubesphere.api.devops.v1alpha3.MultiBranchJobTrigger": { "type": "object", "properties": { "create_action_job_to_trigger": { @@ -11842,7 +11852,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.MultiBranchPipeline": { + "io.kubesphere.api.devops.v1alpha3.MultiBranchPipeline": { "type": "object", "required": [ "name", @@ -11851,22 +11861,22 @@ ], "properties": { "bitbucket_server_source": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.BitbucketServerSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.BitbucketServerSource" }, "description": { "type": "string" }, "discarder": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscarderProperty" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DiscarderProperty" }, "git_source": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GitSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.GitSource" }, "github_source": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.GithubSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.GithubSource" }, "multibranch_job_trigger": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.MultiBranchJobTrigger" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.MultiBranchJobTrigger" }, "name": { "type": "string" @@ -11875,20 +11885,20 @@ "type": "string" }, "single_svn_source": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.SingleSvnSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.SingleSvnSource" }, "source_type": { "type": "string" }, "svn_source": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.SvnSource" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.SvnSource" }, "timer_trigger": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.TimerTrigger" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.TimerTrigger" } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.NoScmPipeline": { + "io.kubesphere.api.devops.v1alpha3.NoScmPipeline": { "type": "object", "required": [ "name" @@ -11901,7 +11911,7 @@ "type": "boolean" }, "discarder": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.DiscarderProperty" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.DiscarderProperty" }, "jenkinsfile": { "type": "string" @@ -11912,18 +11922,18 @@ "parameters": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Parameter" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Parameter" } }, "remote_trigger": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.RemoteTrigger" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.RemoteTrigger" }, "timer_trigger": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.TimerTrigger" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.TimerTrigger" } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Parameter": { + "io.kubesphere.api.devops.v1alpha3.Parameter": { "type": "object", "required": [ "name", @@ -11944,7 +11954,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline": { + "io.kubesphere.api.devops.v1alpha3.Pipeline": { "description": "Pipeline is the Schema for the pipelines API", "type": "object", "properties": { @@ -11960,10 +11970,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineSpec" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.PipelineSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineStatus" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.PipelineStatus" } }, "x-kubernetes-group-version-kind": [ @@ -11974,7 +11984,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineList": { + "io.kubesphere.api.devops.v1alpha3.PipelineList": { "description": "PipelineList contains a list of Pipeline", "type": "object", "required": [ @@ -11988,7 +11998,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.Pipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.Pipeline" } }, "kind": { @@ -12007,7 +12017,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineSpec": { + "io.kubesphere.api.devops.v1alpha3.PipelineSpec": { "description": "PipelineSpec defines the desired state of Pipeline", "type": "object", "required": [ @@ -12015,10 +12025,10 @@ ], "properties": { "multi_branch_pipeline": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.MultiBranchPipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.MultiBranchPipeline" }, "pipeline": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.NoScmPipeline" + "$ref": "#/definitions/io.kubesphere.api.devops.v1alpha3.NoScmPipeline" }, "type": { "description": "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"make\" to regenerate code after modifying this file", @@ -12026,11 +12036,11 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.PipelineStatus": { + "io.kubesphere.api.devops.v1alpha3.PipelineStatus": { "description": "PipelineStatus defines the observed state of Pipeline", "type": "object" }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.RemoteTrigger": { + "io.kubesphere.api.devops.v1alpha3.RemoteTrigger": { "type": "object", "properties": { "token": { @@ -12038,7 +12048,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.SingleSvnSource": { + "io.kubesphere.api.devops.v1alpha3.SingleSvnSource": { "type": "object", "properties": { "credential_id": { @@ -12052,7 +12062,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.SvnSource": { + "io.kubesphere.api.devops.v1alpha3.SvnSource": { "type": "object", "properties": { "credential_id": { @@ -12072,7 +12082,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.devops.v1alpha3.TimerTrigger": { + "io.kubesphere.api.devops.v1alpha3.TimerTrigger": { "type": "object", "properties": { "cron": { @@ -12085,7 +12095,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.DNS": { + "io.kubesphere.api.network.v1alpha1.DNS": { "description": "DNS contains values interesting for DNS resolvers", "type": "object", "properties": { @@ -12112,7 +12122,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool": { + "io.kubesphere.api.network.v1alpha1.IPPool": { "type": "object", "properties": { "apiVersion": { @@ -12127,10 +12137,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolSpec" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPoolSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolStatus" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPoolStatus" } }, "x-kubernetes-group-version-kind": [ @@ -12141,7 +12151,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolList": { + "io.kubesphere.api.network.v1alpha1.IPPoolList": { "type": "object", "required": [ "items" @@ -12154,7 +12164,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPool" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.IPPool" } }, "kind": { @@ -12173,7 +12183,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolSpec": { + "io.kubesphere.api.network.v1alpha1.IPPoolSpec": { "type": "object", "required": [ "type", @@ -12194,14 +12204,11 @@ "type": "boolean" }, "dns": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.DNS" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.DNS" }, "gateway": { "type": "string" }, - "namespace": { - "type": "string" - }, "rangeEnd": { "description": "The last ip, inclusive", "type": "string" @@ -12213,22 +12220,24 @@ "routes": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.Route" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.Route" } }, "type": { "type": "string" }, "vlanConfig": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.VLANConfig" - }, - "workspace": { - "type": "string" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.VLANConfig" } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.IPPoolStatus": { + "io.kubesphere.api.network.v1alpha1.IPPoolStatus": { "type": "object", + "required": [ + "unallocated", + "allocations", + "capacity" + ], "properties": { "allocations": { "type": "integer", @@ -12248,10 +12257,16 @@ "unallocated": { "type": "integer", "format": "int32" + }, + "workspaces": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.WorkspaceStatus" + } } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy": { + "io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy": { "description": "NamespaceNetworkPolicy is the Schema for the namespacenetworkpolicies API", "type": "object", "properties": { @@ -12267,7 +12282,7 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicySpec" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicySpec" } }, "x-kubernetes-group-version-kind": [ @@ -12278,7 +12293,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicyList": { + "io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicyList": { "description": "NamespaceNetworkPolicyList contains a list of NamespaceNetworkPolicy", "type": "object", "required": [ @@ -12292,7 +12307,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicy" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicy" } }, "kind": { @@ -12311,7 +12326,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceNetworkPolicySpec": { + "io.kubesphere.api.network.v1alpha1.NamespaceNetworkPolicySpec": { "description": "NamespaceNetworkPolicySpec provides the specification of a NamespaceNetworkPolicy", "type": "object", "properties": { @@ -12319,14 +12334,14 @@ "description": "List of egress rules to be applied to the selected pods. Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyEgressRule" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NetworkPolicyEgressRule" } }, "ingress": { "description": "List of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyIngressRule" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NetworkPolicyIngressRule" } }, "policyTypes": { @@ -12338,7 +12353,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceSelector": { + "io.kubesphere.api.network.v1alpha1.NamespaceSelector": { "type": "object", "required": [ "name" @@ -12349,7 +12364,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyEgressRule": { + "io.kubesphere.api.network.v1alpha1.NetworkPolicyEgressRule": { "description": "NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. This type is beta-level in 1.8", "type": "object", "properties": { @@ -12364,12 +12379,12 @@ "description": "List of destinations for outgoing traffic of pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all destinations (traffic not restricted by destination). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the to list.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyPeer" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NetworkPolicyPeer" } } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyIngressRule": { + "io.kubesphere.api.network.v1alpha1.NetworkPolicyIngressRule": { "description": "NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from.", "type": "object", "properties": { @@ -12377,7 +12392,7 @@ "description": "List of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least one item, this rule allows traffic only if the traffic matches at least one item in the from list.", "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyPeer" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NetworkPolicyPeer" } }, "ports": { @@ -12389,7 +12404,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NetworkPolicyPeer": { + "io.kubesphere.api.network.v1alpha1.NetworkPolicyPeer": { "description": "NetworkPolicyPeer describes a peer to allow traffic from. Only certain combinations of fields are allowed", "type": "object", "properties": { @@ -12398,14 +12413,14 @@ "$ref": "#/definitions/io.k8s.api.networking.v1.IPBlock" }, "namespace": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.NamespaceSelector" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.NamespaceSelector" }, "service": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.ServiceSelector" + "$ref": "#/definitions/io.kubesphere.api.network.v1alpha1.ServiceSelector" } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.Route": { + "io.kubesphere.api.network.v1alpha1.Route": { "type": "object", "properties": { "dst": { @@ -12416,7 +12431,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.ServiceSelector": { + "io.kubesphere.api.network.v1alpha1.ServiceSelector": { "type": "object", "required": [ "name", @@ -12431,7 +12446,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.network.v1alpha1.VLANConfig": { + "io.kubesphere.api.network.v1alpha1.VLANConfig": { "type": "object", "required": [ "vlanId", @@ -12447,7 +12462,19 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace": { + "io.kubesphere.api.network.v1alpha1.WorkspaceStatus": { + "type": "object", + "required": [ + "allocations" + ], + "properties": { + "allocations": { + "type": "integer", + "format": "int32" + } + } + }, + "io.kubesphere.api.tenant.v1alpha1.Workspace": { "description": "Workspace is the Schema for the workspaces API", "type": "object", "properties": { @@ -12463,10 +12490,10 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceSpec" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.WorkspaceSpec" }, "status": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceStatus" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.WorkspaceStatus" } }, "x-kubernetes-group-version-kind": [ @@ -12477,7 +12504,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceList": { + "io.kubesphere.api.tenant.v1alpha1.WorkspaceList": { "description": "WorkspaceList contains a list of Workspace", "type": "object", "required": [ @@ -12491,7 +12518,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.Workspace" + "$ref": "#/definitions/io.kubesphere.api.tenant.v1alpha1.Workspace" } }, "kind": { @@ -12510,7 +12537,7 @@ } ] }, - "io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceSpec": { + "io.kubesphere.api.tenant.v1alpha1.WorkspaceSpec": { "description": "WorkspaceSpec defines the desired state of Workspace", "type": "object", "properties": { @@ -12522,7 +12549,7 @@ } } }, - "io.kubesphere.kubesphere.pkg.apis.tenant.v1alpha1.WorkspaceStatus": { + "io.kubesphere.api.tenant.v1alpha1.WorkspaceStatus": { "description": "WorkspaceStatus defines the observed state of Workspace", "type": "object" } diff --git a/cmd/controller-manager/app/controllers.go b/cmd/controller-manager/app/controllers.go index 4b25ecc8b..1678ab2b4 100644 --- a/cmd/controller-manager/app/controllers.go +++ b/cmd/controller-manager/app/controllers.go @@ -30,8 +30,6 @@ import ( "kubesphere.io/kubesphere/pkg/controller/cluster" "kubesphere.io/kubesphere/pkg/controller/clusterrolebinding" "kubesphere.io/kubesphere/pkg/controller/destinationrule" - "kubesphere.io/kubesphere/pkg/controller/devopscredential" - "kubesphere.io/kubesphere/pkg/controller/devopsproject" "kubesphere.io/kubesphere/pkg/controller/globalrole" "kubesphere.io/kubesphere/pkg/controller/globalrolebinding" "kubesphere.io/kubesphere/pkg/controller/group" @@ -42,9 +40,6 @@ import ( "kubesphere.io/kubesphere/pkg/controller/network/nsnetworkpolicy" "kubesphere.io/kubesphere/pkg/controller/network/nsnetworkpolicy/provider" "kubesphere.io/kubesphere/pkg/controller/notification" - "kubesphere.io/kubesphere/pkg/controller/pipeline" - "kubesphere.io/kubesphere/pkg/controller/s2ibinary" - "kubesphere.io/kubesphere/pkg/controller/s2irun" "kubesphere.io/kubesphere/pkg/controller/storage/capability" "kubesphere.io/kubesphere/pkg/controller/storage/expansion" "kubesphere.io/kubesphere/pkg/controller/user" @@ -101,38 +96,6 @@ func addControllers( jobController := job.NewJobController(kubernetesInformer.Batch().V1().Jobs(), client.Kubernetes()) - var s2iBinaryController, s2iRunController, devopsProjectController, devopsPipelineController, devopsCredentialController manager.Runnable - if devopsClient != nil { - s2iBinaryController = s2ibinary.NewController(client.Kubernetes(), - client.KubeSphere(), - kubesphereInformer.Devops().V1alpha1().S2iBinaries(), - s3Client, - ) - - s2iRunController = s2irun.NewS2iRunController(client.Kubernetes(), - client.KubeSphere(), - kubesphereInformer.Devops().V1alpha1().S2iBinaries(), - kubesphereInformer.Devops().V1alpha1().S2iRuns()) - - devopsProjectController = devopsproject.NewController(client.Kubernetes(), - client.KubeSphere(), devopsClient, - informerFactory.KubernetesSharedInformerFactory().Core().V1().Namespaces(), - informerFactory.KubeSphereSharedInformerFactory().Devops().V1alpha3().DevOpsProjects(), - informerFactory.KubeSphereSharedInformerFactory().Tenant().V1alpha1().Workspaces()) - - devopsPipelineController = pipeline.NewController(client.Kubernetes(), - client.KubeSphere(), - devopsClient, - informerFactory.KubernetesSharedInformerFactory().Core().V1().Namespaces(), - informerFactory.KubeSphereSharedInformerFactory().Devops().V1alpha3().Pipelines()) - - devopsCredentialController = devopscredential.NewController(client.Kubernetes(), - devopsClient, - informerFactory.KubernetesSharedInformerFactory().Core().V1().Namespaces(), - informerFactory.KubernetesSharedInformerFactory().Core().V1().Secrets()) - - } - storageCapabilityController := capability.NewController( client.KubeSphere().StorageV1alpha1().StorageClassCapabilities(), kubesphereInformer.Storage().V1alpha1(), @@ -262,8 +225,6 @@ func addControllers( "virtualservice-controller": vsController, "destinationrule-controller": drController, "job-controller": jobController, - "s2ibinary-controller": s2iBinaryController, - "s2irun-controller": s2iRunController, "storagecapability-controller": storageCapabilityController, "volumeexpansion-controller": volumeExpansionController, "user-controller": userController, @@ -278,12 +239,6 @@ func addControllers( "group-controller": groupController, } - if devopsClient != nil { - controllers["pipeline-controller"] = devopsPipelineController - controllers["devopsprojects-controller"] = devopsProjectController - controllers["devopscredential-controller"] = devopsCredentialController - } - if multiClusterEnabled { controllers["globalrole-controller"] = globalRoleController notificationController, err := notification.NewController(client.Kubernetes(), mgr.GetClient(), mgr.GetCache()) diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index d0a460aa5..8979dfc00 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -256,20 +256,8 @@ func (s *APIServer) installKubeSphereAPIs() { s.Config.AuthenticationOptions)) urlruntime.Must(servicemeshv1alpha2.AddToContainer(s.Config.ServiceMeshOptions, s.container, s.KubernetesClient.Kubernetes(), s.CacheClient)) urlruntime.Must(networkv1alpha2.AddToContainer(s.container, s.Config.NetworkOptions.WeaveScopeHost)) - urlruntime.Must(devopsv1alpha2.AddToContainer(s.container, - s.InformerFactory.KubeSphereSharedInformerFactory(), - s.DevopsClient, - s.SonarClient, - s.KubernetesClient.KubeSphere(), - s.S3Client, - s.Config.DevopsOptions.Host, - rbacAuthorizer)) - urlruntime.Must(devopsv1alpha3.AddToContainer(s.container, - s.DevopsClient, - s.KubernetesClient.Kubernetes(), - s.KubernetesClient.KubeSphere(), - s.InformerFactory.KubeSphereSharedInformerFactory(), - s.InformerFactory.KubernetesSharedInformerFactory())) + urlruntime.Must(devopsv1alpha2.AddToContainer(s.container, s.Config.DevopsOptions.Endpoint)) + urlruntime.Must(devopsv1alpha3.AddToContainer(s.container, s.Config.DevopsOptions.Endpoint)) urlruntime.Must(notificationv1.AddToContainer(s.container, s.Config.NotificationOptions.Endpoint)) urlruntime.Must(alertingv1.AddToContainer(s.container, s.Config.AlertingOptions.Endpoint)) urlruntime.Must(alertingv2alpha1.AddToContainer(s.container, s.InformerFactory, diff --git a/pkg/controller/devopscredential/devopscredential_controller.go b/pkg/controller/devopscredential/devopscredential_controller.go deleted file mode 100644 index a553bab49..000000000 --- a/pkg/controller/devopscredential/devopscredential_controller.go +++ /dev/null @@ -1,333 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package devopscredential - -import ( - "context" - "fmt" - "net/http" - "reflect" - "strings" - "time" - - "github.com/emicklei/go-restful" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - corev1informer "k8s.io/client-go/informers/core/v1" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/scheme" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - corev1lister "k8s.io/client-go/listers/core/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog" - - devopsv1alpha3 "kubesphere.io/api/devops/v1alpha3" - - kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - "kubesphere.io/kubesphere/pkg/constants" - "kubesphere.io/kubesphere/pkg/controller/utils" - modelsdevops "kubesphere.io/kubesphere/pkg/models/devops" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" - "kubesphere.io/kubesphere/pkg/utils/k8sutil" - "kubesphere.io/kubesphere/pkg/utils/sliceutil" -) - -/** - DevOps project controller is used to maintain the state of the DevOps project. -*/ - -type Controller struct { - client clientset.Interface - kubesphereClient kubesphereclient.Interface - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - secretLister corev1lister.SecretLister - secretSynced cache.InformerSynced - - namespaceLister corev1lister.NamespaceLister - namespaceSynced cache.InformerSynced - - workqueue workqueue.RateLimitingInterface - - workerLoopPeriod time.Duration - - devopsClient devopsClient.Interface -} - -func NewController(client clientset.Interface, - devopsClient devopsClient.Interface, - namespaceInformer corev1informer.NamespaceInformer, - secretInformer corev1informer.SecretInformer) *Controller { - - broadcaster := record.NewBroadcaster() - broadcaster.StartLogging(func(format string, args ...interface{}) { - klog.Info(fmt.Sprintf(format, args)) - }) - broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "devopscredential-controller"}) - - v := &Controller{ - client: client, - devopsClient: devopsClient, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "devopscredential"), - secretLister: secretInformer.Lister(), - secretSynced: secretInformer.Informer().HasSynced, - namespaceLister: namespaceInformer.Lister(), - namespaceSynced: namespaceInformer.Informer().HasSynced, - workerLoopPeriod: time.Second, - } - - v.eventBroadcaster = broadcaster - v.eventRecorder = recorder - - secretInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: func(obj interface{}) { - secret, ok := obj.(*v1.Secret) - if ok && strings.HasPrefix(string(secret.Type), devopsv1alpha3.DevOpsCredentialPrefix) { - v.enqueueSecret(obj) - } - }, - UpdateFunc: func(oldObj, newObj interface{}) { - old, ook := oldObj.(*v1.Secret) - new, nok := newObj.(*v1.Secret) - if ook && nok && old.ResourceVersion == new.ResourceVersion { - return - } - if ook && nok && strings.HasPrefix(string(new.Type), devopsv1alpha3.DevOpsCredentialPrefix) { - v.enqueueSecret(newObj) - } - }, - DeleteFunc: func(obj interface{}) { - secret, ok := obj.(*v1.Secret) - if ok && strings.HasPrefix(string(secret.Type), devopsv1alpha3.DevOpsCredentialPrefix) { - v.enqueueSecret(obj) - } - }, - }) - return v -} - -// enqueueSecret takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work workqueue. This method should *not* be -// passed resources of any type other than DevOpsProject. -func (c *Controller) enqueueSecret(obj interface{}) { - var key string - var err error - if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - utilruntime.HandleError(err) - return - } - c.workqueue.Add(key) -} - -func (c *Controller) processNextWorkItem() bool { - obj, shutdown := c.workqueue.Get() - - if shutdown { - return false - } - - err := func(obj interface{}) error { - defer c.workqueue.Done(obj) - var key string - var ok bool - - if key, ok = obj.(string); !ok { - c.workqueue.Forget(obj) - utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) - return nil - } - if err := c.syncHandler(key); err != nil { - c.workqueue.AddRateLimited(key) - return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error()) - } - c.workqueue.Forget(obj) - klog.V(5).Infof("Successfully synced '%s'", key) - return nil - }(obj) - - if err != nil { - klog.Error(err, "could not reconcile devopsProject") - utilruntime.HandleError(err) - return true - } - - return true -} - -func (c *Controller) worker() { - - for c.processNextWorkItem() { - } -} - -func (c *Controller) Start(stopCh <-chan struct{}) error { - return c.Run(1, stopCh) -} - -func (c *Controller) Run(workers int, stopCh <-chan struct{}) error { - defer utilruntime.HandleCrash() - defer c.workqueue.ShutDown() - - klog.Info("starting devopscredential controller") - defer klog.Info("shutting down devopscredential controller") - - if !cache.WaitForCacheSync(stopCh, c.secretSynced) { - return fmt.Errorf("failed to wait for caches to sync") - } - - for i := 0; i < workers; i++ { - go wait.Until(c.worker, c.workerLoopPeriod, stopCh) - } - - <-stopCh - return nil -} - -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the secret resource -// with the current status of the resource. -func (c *Controller) syncHandler(key string) error { - nsName, name, err := cache.SplitMetaNamespaceKey(key) - if err != nil { - klog.Error(err, fmt.Sprintf("could not split copySecret meta %s ", key)) - return nil - } - namespace, err := c.namespaceLister.Get(nsName) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("namespace '%s' in work queue no longer exists ", key)) - return nil - } - klog.Error(err, fmt.Sprintf("could not get namespace %s ", key)) - return err - } - if !isDevOpsProjectAdminNamespace(namespace) { - err := fmt.Errorf("cound not create or update credential '%s' in normal namespaces %s", name, namespace.Name) - klog.Warning(err) - return err - } - - secret, err := c.secretLister.Secrets(nsName).Get(name) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("secret '%s' in work queue no longer exists ", key)) - return nil - } - klog.Error(err, fmt.Sprintf("could not get secret %s ", key)) - return err - } - - copySecret := secret.DeepCopy() - // DeletionTimestamp.IsZero() means copySecret has not been deleted. - if copySecret.ObjectMeta.DeletionTimestamp.IsZero() { - // make sure Annotations is not nil - if copySecret.Annotations == nil { - copySecret.Annotations = map[string]string{} - } - - //If the sync is successful, return handle - if state, ok := copySecret.Annotations[devopsv1alpha3.CredentialSyncStatusAnnoKey]; ok && state == modelsdevops.StatusSuccessful { - specHash := utils.ComputeHash(copySecret.Data) - oldHash, _ := copySecret.Annotations[devopsv1alpha3.DevOpsCredentialDataHash] // don't need to check if it's nil, only compare if they're different - if specHash == oldHash { - // it was synced successfully, and there's any change with the Pipeline spec, skip this round - return nil - } else { - copySecret.Annotations[devopsv1alpha3.DevOpsCredentialDataHash] = specHash - } - } - - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#finalizers - if !sliceutil.HasString(secret.ObjectMeta.Finalizers, devopsv1alpha3.CredentialFinalizerName) { - copySecret.ObjectMeta.Finalizers = append(copySecret.ObjectMeta.Finalizers, devopsv1alpha3.CredentialFinalizerName) - } - // Check secret config exists, otherwise we will create it. - // if secret exists, update config - _, err := c.devopsClient.GetCredentialInProject(nsName, copySecret.Name) - if err == nil { - if _, ok := copySecret.Annotations[devopsv1alpha3.CredentialAutoSyncAnnoKey]; ok { - _, err := c.devopsClient.UpdateCredentialInProject(nsName, copySecret) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update secret %s ", key)) - return err - } - } - } else { - _, err = c.devopsClient.CreateCredentialInProject(nsName, copySecret) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to create secret %s ", key)) - return err - } - } - //If there is no early return, then the sync is successful. - copySecret.Annotations[devopsv1alpha3.CredentialSyncStatusAnnoKey] = modelsdevops.StatusSuccessful - } else { - // Finalizers processing logic - if sliceutil.HasString(copySecret.ObjectMeta.Finalizers, devopsv1alpha3.CredentialFinalizerName) { - delSuccess := false - if _, err := c.devopsClient.DeleteCredentialInProject(nsName, secret.Name); err != nil { - // the status code should be 404 if the credential does not exists - if srvErr, ok := err.(restful.ServiceError); ok { - delSuccess = srvErr.Code == http.StatusNotFound - } else if srvErr, ok := err.(*devopsClient.ErrorResponse); ok { - delSuccess = srvErr.Response.StatusCode == http.StatusNotFound - } else { - klog.Error(fmt.Sprintf("unexpected error type: %v, should be *restful.ServiceError", err)) - } - - klog.V(8).Info(err, fmt.Sprintf("failed to delete secret %s in devops", key)) - } else { - delSuccess = true - } - - if delSuccess { - copySecret.ObjectMeta.Finalizers = sliceutil.RemoveString(copySecret.ObjectMeta.Finalizers, func(item string) bool { - return item == devopsv1alpha3.CredentialFinalizerName - }) - } else { - // make sure the corresponding Jenkins credentials can be clean - // You can remove the finalizer via kubectl manually in a very special case that Jenkins might be not able to available anymore - return fmt.Errorf("failed to remove devops credential finalizer due to bad communication with Jenkins") - } - - } - } - if !reflect.DeepEqual(secret, copySecret) { - _, err = c.client.CoreV1().Secrets(nsName).Update(context.Background(), copySecret, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update secret %s ", key)) - return err - } - } - return nil -} - -func isDevOpsProjectAdminNamespace(namespace *v1.Namespace) bool { - _, ok := namespace.Labels[constants.DevOpsProjectLabelKey] - - return ok && k8sutil.IsControlledBy(namespace.OwnerReferences, - devopsv1alpha3.ResourceKindDevOpsProject, "") - -} diff --git a/pkg/controller/devopscredential/devopscredential_controller_test.go b/pkg/controller/devopscredential/devopscredential_controller_test.go deleted file mode 100644 index 35009d667..000000000 --- a/pkg/controller/devopscredential/devopscredential_controller_test.go +++ /dev/null @@ -1,403 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package devopscredential - -import ( - "reflect" - "testing" - "time" - - modelsdevops "kubesphere.io/kubesphere/pkg/models/devops" - - v1 "k8s.io/api/core/v1" - - "kubesphere.io/kubesphere/pkg/constants" - fakeDevOps "kubesphere.io/kubesphere/pkg/simple/client/devops/fake" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - kubeinformers "k8s.io/client-go/informers" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - - devops "kubesphere.io/api/devops/v1alpha3" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - kubeclient *k8sfake.Clientset - namespaceLister []*v1.Namespace - secretLister []*v1.Secret - kubeactions []core.Action - - kubeobjects []runtime.Object - // Objects from here preloaded into NewSimpleFake. - objects []runtime.Object - // Objects from here preloaded into devops - initDevOpsProject string - initCredential []*v1.Secret - expectCredential []*v1.Secret -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - return f -} - -func newNamespace(name string, projectName string) *v1.Namespace { - ns := &v1.Namespace{ - TypeMeta: metav1.TypeMeta{ - Kind: "Namespace", - APIVersion: v1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{constants.DevOpsProjectLabelKey: projectName}, - }, - } - TRUE := true - ns.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ - { - APIVersion: devops.SchemeGroupVersion.String(), - Kind: devops.ResourceKindDevOpsProject, - Name: projectName, - BlockOwnerDeletion: &TRUE, - Controller: &TRUE, - }, - } - - return ns -} - -func newSecret(namespace, name string, data map[string][]byte, withFinalizers bool, autoSync bool, syncOk bool) *v1.Secret { - secret := &v1.Secret{ - TypeMeta: metav1.TypeMeta{ - Kind: devops.ResourceKindPipeline, - APIVersion: devops.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - Annotations: map[string]string{}, - }, - Data: data, - Type: devops.DevOpsCredentialPrefix + "test", - } - if withFinalizers { - secret.Finalizers = append(secret.Finalizers, devops.CredentialFinalizerName) - } - if autoSync { - secret.Annotations[devops.CredentialAutoSyncAnnoKey] = "true" - } - if syncOk { - secret.Annotations[devops.CredentialSyncStatusAnnoKey] = modelsdevops.StatusSuccessful - } - return secret -} - -func newDeletingSecret(namespace, name string) *v1.Secret { - now := metav1.Now() - pipeline := &v1.Secret{ - TypeMeta: metav1.TypeMeta{ - Kind: devops.ResourceKindPipeline, - APIVersion: devops.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - DeletionTimestamp: &now, - }, - Type: devops.DevOpsCredentialPrefix + "test", - } - pipeline.Finalizers = append(pipeline.Finalizers, devops.CredentialFinalizerName) - - return pipeline -} - -func (f *fixture) newController() (*Controller, kubeinformers.SharedInformerFactory, *fakeDevOps.Devops) { - f.kubeclient = k8sfake.NewSimpleClientset(f.kubeobjects...) - - k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc()) - dI := fakeDevOps.NewWithCredentials(f.initDevOpsProject, f.initCredential...) - - c := NewController(f.kubeclient, dI, k8sI.Core().V1().Namespaces(), - k8sI.Core().V1().Secrets()) - - c.secretSynced = alwaysReady - c.eventRecorder = &record.FakeRecorder{} - for _, f := range f.secretLister { - k8sI.Core().V1().Secrets().Informer().GetIndexer().Add(f) - } - - for _, d := range f.namespaceLister { - k8sI.Core().V1().Namespaces().Informer().GetIndexer().Add(d) - } - - return c, k8sI, dI -} - -func (f *fixture) run(fooName string) { - f.runController(fooName, true, false) -} - -func (f *fixture) runExpectError(fooName string) { - f.runController(fooName, true, true) -} - -func (f *fixture) runController(name string, startInformers bool, expectError bool) { - c, k8sI, dI := f.newController() - if startInformers { - stopCh := make(chan struct{}) - defer close(stopCh) - k8sI.Start(stopCh) - } - - err := c.syncHandler(name) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - k8sActions := filterInformerActions(f.kubeclient.Actions()) - - if len(f.kubeactions) > len(k8sActions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.kubeactions)-len(k8sActions), f.kubeactions[len(k8sActions):]) - } - - if len(dI.Credentials[f.initDevOpsProject]) != len(f.expectCredential) { - f.t.Errorf(" unexpected objects: %v", dI.Projects) - } - for _, credential := range f.expectCredential { - actualCredential := dI.Credentials[f.initDevOpsProject][credential.Name] - if !reflect.DeepEqual(actualCredential, credential) { - f.t.Errorf(" credential %+v not match \n %+v", credential, actualCredential) - } - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", "secrets") || - action.Matches("watch", "secrets") || - action.Matches("list", "namespaces") || - action.Matches("watch", "namespaces")) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectUpdateSecretAction(p *v1.Secret) { - action := core.NewUpdateAction(schema.GroupVersionResource{ - Version: "v1", - Resource: "secrets", - }, p.Namespace, p) - f.kubeactions = append(f.kubeactions, action) -} - -func getKey(p *v1.Secret, t *testing.T) string { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(p) - if err != nil { - t.Errorf("Unexpected error getting key for pipeline %v: %v", p.Name, err) - return "" - } - return key -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - secret := newSecret(nsName, secretName, nil, true, true, false) - expectSecret := newSecret(nsName, secretName, nil, true, true, true) - - f.secretLister = append(f.secretLister, secret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, secret) - f.initDevOpsProject = nsName - f.initCredential = []*v1.Secret{secret} - f.expectCredential = []*v1.Secret{expectSecret} - - f.run(getKey(secret, t)) -} - -func TestAddCredentialFinalizers(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - secret := newSecret(nsName, secretName, nil, false, true, false) - - expectSecret := newSecret(nsName, secretName, nil, true, true, true) - - f.secretLister = append(f.secretLister, secret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, secret) - f.initDevOpsProject = nsName - f.initCredential = []*v1.Secret{secret} - f.expectCredential = []*v1.Secret{expectSecret} - f.expectUpdateSecretAction(expectSecret) - f.run(getKey(secret, t)) -} - -func TestCreateCredential(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - secret := newSecret(nsName, secretName, nil, true, true, false) - expectSecret := newSecret(nsName, secretName, nil, true, true, true) - - f.secretLister = append(f.secretLister, secret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, secret) - f.initDevOpsProject = nsName - f.expectCredential = []*v1.Secret{expectSecret} - f.run(getKey(secret, t)) -} - -func TestDeleteCredential(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - secret := newDeletingSecret(nsName, secretName) - - expectSecret := secret.DeepCopy() - expectSecret.Finalizers = []string{} - f.secretLister = append(f.secretLister, secret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, secret) - f.initDevOpsProject = nsName - f.initCredential = []*v1.Secret{secret} - f.expectCredential = []*v1.Secret{} - f.expectUpdateSecretAction(expectSecret) - f.run(getKey(secret, t)) -} - -func TestUpdateCredential(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - initSecret := newSecret(nsName, secretName, nil, true, true, false) - modifiedSecret := newSecret(nsName, secretName, map[string][]byte{"a": []byte("aa")}, true, true, false) - expectSecret := newSecret(nsName, secretName, map[string][]byte{"a": []byte("aa")}, true, true, true) - f.secretLister = append(f.secretLister, modifiedSecret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, modifiedSecret) - f.initDevOpsProject = nsName - f.initCredential = []*v1.Secret{initSecret} - f.expectCredential = []*v1.Secret{expectSecret} - f.run(getKey(modifiedSecret, t)) -} - -func TestNotUpdateCredential(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - secretName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - initSecret := newSecret(nsName, secretName, nil, true, false, false) - expectSecret := newSecret(nsName, secretName, map[string][]byte{"a": []byte("aa")}, true, false, true) - f.secretLister = append(f.secretLister, expectSecret) - f.namespaceLister = append(f.namespaceLister, ns) - f.kubeobjects = append(f.kubeobjects, expectSecret) - f.initDevOpsProject = nsName - f.initCredential = []*v1.Secret{initSecret} - f.expectCredential = []*v1.Secret{initSecret} - f.run(getKey(expectSecret, t)) -} diff --git a/pkg/controller/devopsproject/devopsproject_controller.go b/pkg/controller/devopsproject/devopsproject_controller.go deleted file mode 100644 index 39e9d1a14..000000000 --- a/pkg/controller/devopsproject/devopsproject_controller.go +++ /dev/null @@ -1,445 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package devopsproject - -import ( - "context" - "fmt" - "net/http" - "reflect" - "time" - - "github.com/emicklei/go-restful" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - corev1informer "k8s.io/client-go/informers/core/v1" - clientset "k8s.io/client-go/kubernetes" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - corev1lister "k8s.io/client-go/listers/core/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - - devopsv1alpha3 "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/scheme" - tenantv1alpha1informers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/tenant/v1alpha1" - tenantv1alpha1listers "kubesphere.io/kubesphere/pkg/client/listers/tenant/v1alpha1" - "kubesphere.io/kubesphere/pkg/constants" - modelsdevops "kubesphere.io/kubesphere/pkg/models/devops" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" - "kubesphere.io/kubesphere/pkg/utils/k8sutil" - "kubesphere.io/kubesphere/pkg/utils/sliceutil" - - kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - devopsinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha3" - devopslisters "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha3" -) - -/** - DevOps project controller is used to maintain the state of the DevOps project. -*/ - -type Controller struct { - client clientset.Interface - kubesphereClient kubesphereclient.Interface - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - devOpsProjectLister devopslisters.DevOpsProjectLister - devOpsProjectSynced cache.InformerSynced - - namespaceLister corev1lister.NamespaceLister - namespaceSynced cache.InformerSynced - - workspaceLister tenantv1alpha1listers.WorkspaceLister - workspaceSynced cache.InformerSynced - - workqueue workqueue.RateLimitingInterface - - workerLoopPeriod time.Duration - - devopsClient devopsClient.Interface -} - -func NewController(client clientset.Interface, - kubesphereClient kubesphereclient.Interface, - devopsClinet devopsClient.Interface, - namespaceInformer corev1informer.NamespaceInformer, - devopsInformer devopsinformers.DevOpsProjectInformer, - workspaceInformer tenantv1alpha1informers.WorkspaceInformer) *Controller { - - broadcaster := record.NewBroadcaster() - broadcaster.StartLogging(func(format string, args ...interface{}) { - klog.Info(fmt.Sprintf(format, args)) - }) - broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "devopsproject-controller"}) - - v := &Controller{ - client: client, - devopsClient: devopsClinet, - kubesphereClient: kubesphereClient, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "devopsproject"), - devOpsProjectLister: devopsInformer.Lister(), - devOpsProjectSynced: devopsInformer.Informer().HasSynced, - namespaceLister: namespaceInformer.Lister(), - namespaceSynced: namespaceInformer.Informer().HasSynced, - workspaceLister: workspaceInformer.Lister(), - workspaceSynced: workspaceInformer.Informer().HasSynced, - workerLoopPeriod: time.Second, - } - - v.eventBroadcaster = broadcaster - v.eventRecorder = recorder - - devopsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: v.enqueueDevOpsProject, - UpdateFunc: func(oldObj, newObj interface{}) { - old := oldObj.(*devopsv1alpha3.DevOpsProject) - new := newObj.(*devopsv1alpha3.DevOpsProject) - if old.ResourceVersion == new.ResourceVersion { - return - } - v.enqueueDevOpsProject(newObj) - }, - DeleteFunc: v.enqueueDevOpsProject, - }) - return v -} - -// enqueueDevOpsProject takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work workqueue. This method should *not* be -// passed resources of any type other than DevOpsProject. -func (c *Controller) enqueueDevOpsProject(obj interface{}) { - var key string - var err error - if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - utilruntime.HandleError(err) - return - } - c.workqueue.Add(key) -} - -func (c *Controller) processNextWorkItem() bool { - obj, shutdown := c.workqueue.Get() - - if shutdown { - return false - } - - err := func(obj interface{}) error { - defer c.workqueue.Done(obj) - var key string - var ok bool - - if key, ok = obj.(string); !ok { - c.workqueue.Forget(obj) - utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) - return nil - } - if err := c.syncHandler(key); err != nil { - c.workqueue.AddRateLimited(key) - return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error()) - } - c.workqueue.Forget(obj) - klog.V(5).Infof("Successfully synced '%s'", key) - return nil - }(obj) - - if err != nil { - klog.Error(err, "could not reconcile devopsProject") - utilruntime.HandleError(err) - return true - } - - return true -} - -func (c *Controller) worker() { - - for c.processNextWorkItem() { - } -} - -func (c *Controller) Start(stopCh <-chan struct{}) error { - return c.Run(1, stopCh) -} - -func (c *Controller) Run(workers int, stopCh <-chan struct{}) error { - defer utilruntime.HandleCrash() - defer c.workqueue.ShutDown() - - klog.Info("starting devops project controller") - defer klog.Info("shutting down devops project controller") - - if !cache.WaitForCacheSync(stopCh, c.devOpsProjectSynced, c.devOpsProjectSynced, c.workspaceSynced) { - return fmt.Errorf("failed to wait for caches to sync") - } - - for i := 0; i < workers; i++ { - go wait.Until(c.worker, c.workerLoopPeriod, stopCh) - } - - <-stopCh - return nil -} - -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the devopsproject resource -// with the current status of the resource. -func (c *Controller) syncHandler(key string) error { - project, err := c.devOpsProjectLister.Get(key) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("devopsproject '%s' in work queue no longer exists ", key)) - return nil - } - klog.V(8).Info(err, fmt.Sprintf("could not get devopsproject %s ", key)) - return err - } - copyProject := project.DeepCopy() - // DeletionTimestamp.IsZero() means DevOps project has not been deleted. - if project.ObjectMeta.DeletionTimestamp.IsZero() { - //If the sync is successful, return handle - if state, ok := project.Annotations[devopsv1alpha3.DevOpeProjectSyncStatusAnnoKey]; ok && state == modelsdevops.StatusSuccessful { - return nil - } - - // Use Finalizers to sync DevOps status when DevOps project was deleted - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#finalizers - if !sliceutil.HasString(project.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName) { - copyProject.ObjectMeta.Finalizers = append(copyProject.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName) - } - - if project.Status.AdminNamespace != "" { - ns, err := c.namespaceLister.Get(project.Status.AdminNamespace) - if err != nil && !errors.IsNotFound(err) { - klog.V(8).Info(err, fmt.Sprintf("faild to get namespace")) - return err - } else if errors.IsNotFound(err) { - // if admin ns is not found, clean project status, rerun reconcile - copyProject.Status.AdminNamespace = "" - _, err := c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(context.Background(), copyProject, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update project %s ", key)) - return err - } - c.enqueueDevOpsProject(key) - return nil - } - // If ns exists, but the associated attributes with the project are not set correctly, - // then reset the associated attributes - if k8sutil.IsControlledBy(ns.OwnerReferences, - devopsv1alpha3.ResourceKindDevOpsProject, project.Name) && - ns.Labels[constants.DevOpsProjectLabelKey] == project.Name { - } else { - copyNs := ns.DeepCopy() - err := controllerutil.SetControllerReference(copyProject, copyNs, scheme.Scheme) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to set ownerreference %s ", key)) - return err - } - copyNs.Labels[constants.DevOpsProjectLabelKey] = project.Name - _, err = c.client.CoreV1().Namespaces().Update(context.Background(), copyNs, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update ns %s ", key)) - return err - } - } - - } else { - // list ns by devops project - namespaces, err := c.namespaceLister.List( - labels.SelectorFromSet(labels.Set{constants.DevOpsProjectLabelKey: project.Name})) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to list ns %s ", key)) - return err - } - // if there is no ns, generate new one - if len(namespaces) == 0 { - ns := c.generateNewNamespace(project) - ns, err := c.client.CoreV1().Namespaces().Create(context.Background(), ns, metav1.CreateOptions{}) - if err != nil { - // devops project name is conflict, cannot create admin namespace - if errors.IsAlreadyExists(err) { - klog.Errorf("Failed to create admin namespace for devopsproject %s, error %v", project.Name, err) - c.eventRecorder.Event(project, v1.EventTypeWarning, "CreateAdminNamespaceFailed", err.Error()) - return err - } - klog.V(8).Info(err, fmt.Sprintf("failed to create ns %s ", key)) - return err - } - copyProject.Status.AdminNamespace = ns.Name - } else if len(namespaces) != 0 { - ns := namespaces[0] - // reset ownerReferences - if !k8sutil.IsControlledBy(ns.OwnerReferences, - devopsv1alpha3.ResourceKindDevOpsProject, project.Name) { - copyNs := ns.DeepCopy() - err := controllerutil.SetControllerReference(copyProject, copyNs, scheme.Scheme) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to set ownerreference %s ", key)) - return err - } - copyNs.Labels[constants.DevOpsProjectLabelKey] = project.Name - _, err = c.client.CoreV1().Namespaces().Update(context.Background(), copyNs, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update ns %s ", key)) - return err - } - } - copyProject.Status.AdminNamespace = ns.Name - } - } - - if copyProject, err = c.bindWorkspace(copyProject); err != nil { - klog.Error(err) - return err - } - - // Check project exists, otherwise we will create it. - _, err := c.devopsClient.GetDevOpsProject(copyProject.Status.AdminNamespace) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to get project %s ", key)) - _, err := c.devopsClient.CreateDevOpsProject(copyProject.Status.AdminNamespace) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to get project %s ", key)) - return err - } - } - - //If there is no early return, then the sync is successful. - if copyProject.Annotations == nil { - copyProject.Annotations = map[string]string{} - } - copyProject.Annotations[devopsv1alpha3.DevOpeProjectSyncStatusAnnoKey] = modelsdevops.StatusSuccessful - if !reflect.DeepEqual(copyProject, project) { - copyProject, err = c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(context.Background(), copyProject, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update ns %s ", key)) - return err - } - } - - } else { - // Finalizers processing logic - if sliceutil.HasString(project.ObjectMeta.Finalizers, devopsv1alpha3.DevOpsProjectFinalizerName) { - delSuccess := false - if err := c.deleteDevOpsProjectInDevOps(project); err != nil { - // the status code should be 404 if the job does not exists - if srvErr, ok := err.(restful.ServiceError); ok { - delSuccess = srvErr.Code == http.StatusNotFound - } else if srvErr, ok := err.(*devopsClient.ErrorResponse); ok { - delSuccess = srvErr.Response.StatusCode == http.StatusNotFound - } else { - klog.Error(fmt.Sprintf("unexpected error type: %v, should be *restful.ServiceError", err)) - } - - klog.V(8).Info(err, fmt.Sprintf("failed to delete resource %s in devops", key)) - } else { - delSuccess = true - } - - if delSuccess { - project.ObjectMeta.Finalizers = sliceutil.RemoveString(project.ObjectMeta.Finalizers, func(item string) bool { - return item == devopsv1alpha3.DevOpsProjectFinalizerName - }) - } else { - // make sure the corresponding Jenkins job can be clean - // You can remove the finalizer via kubectl manually in a very special case that Jenkins might be not able to available anymore - return fmt.Errorf("failed to remove devopsproject finalizer due to bad communication with Jenkins") - } - - _, err = c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(context.Background(), project, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update project %s ", key)) - return err - } - } - } - - return nil -} - -func (c *Controller) bindWorkspace(project *devopsv1alpha3.DevOpsProject) (*devopsv1alpha3.DevOpsProject, error) { - - workspaceName := project.Labels[constants.WorkspaceLabelKey] - - if workspaceName == "" { - return project, nil - } - - workspace, err := c.workspaceLister.Get(workspaceName) - - if err != nil { - // skip if workspace not found - if errors.IsNotFound(err) { - return project, nil - } - klog.Error(err) - return nil, err - } - - if !metav1.IsControlledBy(project, workspace) { - project.OwnerReferences = nil - if err := controllerutil.SetControllerReference(workspace, project, scheme.Scheme); err != nil { - klog.Error(err) - return nil, err - } - - return c.kubesphereClient.DevopsV1alpha3().DevOpsProjects().Update(context.Background(), project, metav1.UpdateOptions{}) - } - - return project, nil -} - -func (c *Controller) deleteDevOpsProjectInDevOps(project *devopsv1alpha3.DevOpsProject) (err error) { - err = c.devopsClient.DeleteDevOpsProject(project.Status.AdminNamespace) - return -} - -func (c *Controller) generateNewNamespace(project *devopsv1alpha3.DevOpsProject) *v1.Namespace { - // devops project name and admin namespace name should be the same - // solve the access control problem of devops API v1alpha2 and v1alpha3 - ns := &v1.Namespace{ - TypeMeta: metav1.TypeMeta{ - Kind: "Namespace", - APIVersion: v1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: project.Name, - Labels: map[string]string{ - constants.DevOpsProjectLabelKey: project.Name, - }, - }, - } - - if creator := project.Annotations[constants.CreatorAnnotationKey]; creator != "" { - ns.Annotations = map[string]string{constants.CreatorAnnotationKey: creator} - } - - controllerutil.SetControllerReference(project, ns, scheme.Scheme) - return ns -} diff --git a/pkg/controller/devopsproject/devopsproject_controller_test.go b/pkg/controller/devopsproject/devopsproject_controller_test.go deleted file mode 100644 index 9b367475f..000000000 --- a/pkg/controller/devopsproject/devopsproject_controller_test.go +++ /dev/null @@ -1,412 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package devopsproject - -import ( - "reflect" - "testing" - "time" - - v1 "k8s.io/api/core/v1" - - devopsprojects "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/constants" - fakeDevOps "kubesphere.io/kubesphere/pkg/simple/client/devops/fake" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - kubeinformers "k8s.io/client-go/informers" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - - devops "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" - informers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - client *fake.Clientset - kubeclient *k8sfake.Clientset - // Objects to put in the store. - devopsProjectLister []*devops.DevOpsProject - namespaceLister []*v1.Namespace - actions []core.Action - kubeactions []core.Action - - kubeobjects []runtime.Object - // Objects from here preloaded into NewSimpleFake. - objects []runtime.Object - // Objects from here preloaded into devops - initDevOpsProject []string - expectDevOpsProject []string -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - return f -} - -func newDevOpsProject(name string, nsName string, withFinalizers bool, withStatus bool) *devopsprojects.DevOpsProject { - project := &devopsprojects.DevOpsProject{ - TypeMeta: metav1.TypeMeta{APIVersion: devopsprojects.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - } - if withFinalizers { - project.Finalizers = []string{devopsprojects.DevOpsProjectFinalizerName} - } - if withStatus { - project.Status = devops.DevOpsProjectStatus{AdminNamespace: nsName} - } - return project -} - -func newNamespace(name string, projectName string, useGenerateName, withOwnerReference bool) *v1.Namespace { - ns := &v1.Namespace{ - TypeMeta: metav1.TypeMeta{ - Kind: "Namespace", - APIVersion: v1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{constants.DevOpsProjectLabelKey: projectName}, - }, - } - if useGenerateName { - ns.ObjectMeta.Name = "" - ns.ObjectMeta.GenerateName = projectName - } - if withOwnerReference { - TRUE := true - ns.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ - { - APIVersion: devops.SchemeGroupVersion.String(), - Kind: devops.ResourceKindDevOpsProject, - Name: projectName, - BlockOwnerDeletion: &TRUE, - Controller: &TRUE, - }, - } - } - return ns -} - -func newDeletingDevOpsProject(name string) *devopsprojects.DevOpsProject { - now := metav1.Now() - return &devopsprojects.DevOpsProject{ - TypeMeta: metav1.TypeMeta{APIVersion: devopsprojects.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - DeletionTimestamp: &now, - Finalizers: []string{devopsprojects.DevOpsProjectFinalizerName}, - }, - } -} - -func (f *fixture) newController() (*Controller, informers.SharedInformerFactory, kubeinformers.SharedInformerFactory, *fakeDevOps.Devops) { - f.client = fake.NewSimpleClientset(f.objects...) - f.kubeclient = k8sfake.NewSimpleClientset(f.kubeobjects...) - - i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) - k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc()) - dI := fakeDevOps.New(f.initDevOpsProject...) - - c := NewController(f.kubeclient, f.client, dI, - k8sI.Core().V1().Namespaces(), - i.Devops().V1alpha3().DevOpsProjects(), - i.Tenant().V1alpha1().Workspaces()) - - c.devOpsProjectSynced = alwaysReady - c.eventRecorder = &record.FakeRecorder{} - - for _, f := range f.devopsProjectLister { - i.Devops().V1alpha3().DevOpsProjects().Informer().GetIndexer().Add(f) - } - - for _, d := range f.namespaceLister { - k8sI.Core().V1().Namespaces().Informer().GetIndexer().Add(d) - } - - return c, i, k8sI, dI -} - -func (f *fixture) run(fooName string) { - f.runController(fooName, true, false) -} - -func (f *fixture) runExpectError(fooName string) { - f.runController(fooName, true, true) -} - -func (f *fixture) runController(projectName string, startInformers bool, expectError bool) { - c, i, k8sI, dI := f.newController() - if startInformers { - stopCh := make(chan struct{}) - defer close(stopCh) - i.Start(stopCh) - k8sI.Start(stopCh) - } - - err := c.syncHandler(projectName) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - actions := filterInformerActions(f.client.Actions()) - k8sActions := filterInformerActions(f.kubeclient.Actions()) - if len(f.kubeactions) > len(k8sActions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.kubeactions)-len(k8sActions), f.kubeactions[len(k8sActions):]) - } - - if len(f.actions) > len(actions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.actions)-len(actions), f.actions[len(actions):]) - } - if len(dI.Projects) != len(f.expectDevOpsProject) { - f.t.Errorf(" unexpected objects: %v", dI.Projects) - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", devopsprojects.ResourcePluralDevOpsProject) || - action.Matches("watch", devopsprojects.ResourcePluralDevOpsProject) || - action.Matches("list", "namespaces") || - action.Matches("watch", "namespaces") || - action.Matches("watch", "workspaces") || - action.Matches("list", "workspaces")) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectUpdateDevOpsProjectAction(p *devopsprojects.DevOpsProject) { - action := core.NewUpdateAction(schema.GroupVersionResource{Resource: devopsprojects.ResourcePluralDevOpsProject}, - p.Namespace, p) - f.actions = append(f.actions, action) -} - -func (f *fixture) expectUpdateNamespaceAction(p *v1.Namespace) { - action := core.NewUpdateAction(schema.GroupVersionResource{ - Version: "v1", - Resource: "namespaces", - }, p.Namespace, p) - f.kubeactions = append(f.kubeactions, action) -} - -func (f *fixture) expectCreateNamespaceAction(p *v1.Namespace) { - action := core.NewCreateAction(schema.GroupVersionResource{ - Version: "v1", - Resource: "namespaces", - }, p.Namespace, p) - f.kubeactions = append(f.kubeactions, action) -} - -func getKey(p *devopsprojects.DevOpsProject, t *testing.T) string { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(p) - if err != nil { - t.Errorf("Unexpected error getting key for devopsprojects %v: %v", p.Name, err) - return "" - } - return key -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - projectName := "test" - project := newDevOpsProject(projectName, nsName, true, true) - ns := newNamespace(nsName, projectName, false, true) - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, project) - f.initDevOpsProject = []string{ns.Name} - f.expectDevOpsProject = []string{ns.Name} - - f.run(getKey(project, t)) -} - -func TestUpdateProjectFinalizers(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - projectName := "test" - project := newDevOpsProject(projectName, nsName, false, true) - ns := newNamespace(nsName, projectName, false, true) - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, project) - f.kubeobjects = append(f.kubeobjects, ns) - f.initDevOpsProject = []string{ns.Name} - f.expectDevOpsProject = []string{ns.Name} - expectUpdateProject := project.DeepCopy() - expectUpdateProject.Finalizers = []string{devops.DevOpsProjectFinalizerName} - f.expectUpdateDevOpsProjectAction(expectUpdateProject) - f.run(getKey(project, t)) -} - -func TestUpdateProjectStatus(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - projectName := "test" - project := newDevOpsProject(projectName, nsName, true, false) - ns := newNamespace(nsName, projectName, false, true) - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, project) - f.kubeobjects = append(f.kubeobjects, ns) - f.initDevOpsProject = []string{ns.Name} - f.expectDevOpsProject = []string{ns.Name} - expectUpdateProject := project.DeepCopy() - expectUpdateProject.Status.AdminNamespace = nsName - f.expectUpdateDevOpsProjectAction(expectUpdateProject) - f.run(getKey(project, t)) -} - -func TestUpdateNsOwnerReference(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - projectName := "test" - project := newDevOpsProject(projectName, nsName, true, true) - ns := newNamespace(nsName, projectName, false, false) - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, project) - f.kubeobjects = append(f.kubeobjects, ns) - f.initDevOpsProject = []string{ns.Name} - f.expectDevOpsProject = []string{ns.Name} - expectUpdateNs := newNamespace(nsName, projectName, false, true) - - f.expectUpdateNamespaceAction(expectUpdateNs) - f.run(getKey(project, t)) -} - -func TestCreateDevOpsProjects(t *testing.T) { - f := newFixture(t) - project := newDevOpsProject("test", "", true, false) - ns := newNamespace("test", "test", false, true) - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.objects = append(f.objects, project) - f.expectDevOpsProject = []string{""} - expect := project.DeepCopy() - expect.Status.AdminNamespace = "test" - f.expectUpdateDevOpsProjectAction(expect) - f.expectCreateNamespaceAction(ns) - f.run(getKey(project, t)) -} - -func TestDeleteDevOpsProjects(t *testing.T) { - f := newFixture(t) - project := newDeletingDevOpsProject("test") - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.objects = append(f.objects, project) - f.initDevOpsProject = []string{project.Name} - f.expectDevOpsProject = []string{project.Name} - expectProject := project.DeepCopy() - expectProject.Finalizers = []string{} - f.expectUpdateDevOpsProjectAction(expectProject) - f.run(getKey(project, t)) -} - -func TestDeleteDevOpsProjectsWithNull(t *testing.T) { - f := newFixture(t) - project := newDeletingDevOpsProject("test") - - f.devopsProjectLister = append(f.devopsProjectLister, project) - f.objects = append(f.objects, project) - f.expectDevOpsProject = []string{} - expectProject := project.DeepCopy() - expectProject.Finalizers = []string{} - f.expectUpdateDevOpsProjectAction(expectProject) - f.run(getKey(project, t)) -} diff --git a/pkg/controller/pipeline/pipeline_controller.go b/pkg/controller/pipeline/pipeline_controller.go deleted file mode 100644 index 0169da131..000000000 --- a/pkg/controller/pipeline/pipeline_controller.go +++ /dev/null @@ -1,328 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pipeline - -import ( - "context" - "fmt" - "net/http" - "reflect" - "time" - - "github.com/emicklei/go-restful" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - corev1informer "k8s.io/client-go/informers/core/v1" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/scheme" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - corev1lister "k8s.io/client-go/listers/core/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog" - - devopsv1alpha3 "kubesphere.io/api/devops/v1alpha3" - - kubesphereclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - devopsinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha3" - devopslisters "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha3" - "kubesphere.io/kubesphere/pkg/constants" - "kubesphere.io/kubesphere/pkg/controller/utils" - modelsdevops "kubesphere.io/kubesphere/pkg/models/devops" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" - "kubesphere.io/kubesphere/pkg/utils/k8sutil" - "kubesphere.io/kubesphere/pkg/utils/sliceutil" -) - -/** - DevOps project controller is used to maintain the state of the DevOps project. -*/ - -type Controller struct { - client clientset.Interface - kubesphereClient kubesphereclient.Interface - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - devOpsProjectLister devopslisters.PipelineLister - pipelineSynced cache.InformerSynced - - namespaceLister corev1lister.NamespaceLister - namespaceSynced cache.InformerSynced - - workqueue workqueue.RateLimitingInterface - - workerLoopPeriod time.Duration - - devopsClient devopsClient.Interface -} - -func NewController(client clientset.Interface, - kubesphereClient kubesphereclient.Interface, - devopsClinet devopsClient.Interface, - namespaceInformer corev1informer.NamespaceInformer, - devopsInformer devopsinformers.PipelineInformer) *Controller { - - broadcaster := record.NewBroadcaster() - broadcaster.StartLogging(func(format string, args ...interface{}) { - klog.Info(fmt.Sprintf(format, args)) - }) - broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "pipeline-controller"}) - - v := &Controller{ - client: client, - devopsClient: devopsClinet, - kubesphereClient: kubesphereClient, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pipeline"), - devOpsProjectLister: devopsInformer.Lister(), - pipelineSynced: devopsInformer.Informer().HasSynced, - namespaceLister: namespaceInformer.Lister(), - namespaceSynced: namespaceInformer.Informer().HasSynced, - workerLoopPeriod: time.Second, - } - - v.eventBroadcaster = broadcaster - v.eventRecorder = recorder - - devopsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: v.enqueuePipeline, - UpdateFunc: func(oldObj, newObj interface{}) { - oldPipeline := oldObj.(*devopsv1alpha3.Pipeline) - newPipeline := newObj.(*devopsv1alpha3.Pipeline) - if oldPipeline.ResourceVersion == newPipeline.ResourceVersion { - return - } - v.enqueuePipeline(newObj) - }, - DeleteFunc: v.enqueuePipeline, - }) - return v -} - -// enqueuePipeline takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work workqueue. This method should *not* be -// passed resources of any type other than DevOpsProject. -func (c *Controller) enqueuePipeline(obj interface{}) { - var key string - var err error - if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - utilruntime.HandleError(err) - return - } - c.workqueue.Add(key) -} - -func (c *Controller) processNextWorkItem() bool { - obj, shutdown := c.workqueue.Get() - - if shutdown { - return false - } - - err := func(obj interface{}) error { - defer c.workqueue.Done(obj) - var key string - var ok bool - - if key, ok = obj.(string); !ok { - c.workqueue.Forget(obj) - utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) - return nil - } - if err := c.syncHandler(key); err != nil { - c.workqueue.AddRateLimited(key) - return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error()) - } - c.workqueue.Forget(obj) - klog.V(5).Infof("Successfully synced '%s'", key) - return nil - }(obj) - - if err != nil { - klog.Error(err, "could not reconcile devopsProject") - utilruntime.HandleError(err) - return true - } - - return true -} - -func (c *Controller) worker() { - - for c.processNextWorkItem() { - } -} - -func (c *Controller) Start(stopCh <-chan struct{}) error { - return c.Run(1, stopCh) -} - -func (c *Controller) Run(workers int, stopCh <-chan struct{}) error { - defer utilruntime.HandleCrash() - defer c.workqueue.ShutDown() - - klog.Info("starting pipeline controller") - defer klog.Info("shutting down pipeline controller") - - if !cache.WaitForCacheSync(stopCh, c.pipelineSynced) { - return fmt.Errorf("failed to wait for caches to sync") - } - - for i := 0; i < workers; i++ { - go wait.Until(c.worker, c.workerLoopPeriod, stopCh) - } - - <-stopCh - return nil -} - -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the pipeline resource -// with the current status of the resource. -func (c *Controller) syncHandler(key string) error { - nsName, name, err := cache.SplitMetaNamespaceKey(key) - if err != nil { - klog.Error(err, fmt.Sprintf("could not split copyPipeline meta %s ", key)) - return nil - } - namespace, err := c.namespaceLister.Get(nsName) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("namespace '%s' in work queue no longer exists ", key)) - return nil - } - klog.V(8).Info(err, fmt.Sprintf("could not get namespace %s ", key)) - return err - } - if !isDevOpsProjectAdminNamespace(namespace) { - err := fmt.Errorf("cound not create copyPipeline in normal namespaces %s", namespace.Name) - klog.Warning(err) - return err - } - - pipeline, err := c.devOpsProjectLister.Pipelines(nsName).Get(name) - if err != nil { - if errors.IsNotFound(err) { - klog.V(8).Info(fmt.Sprintf("copyPipeline '%s' in work queue no longer exists ", key)) - return nil - } - klog.Error(err, fmt.Sprintf("could not get copyPipeline %s ", key)) - return err - } - - copyPipeline := pipeline.DeepCopy() - // DeletionTimestamp.IsZero() means copyPipeline has not been deleted. - if copyPipeline.ObjectMeta.DeletionTimestamp.IsZero() { - // make sure Annotations is not nil - if copyPipeline.Annotations == nil { - copyPipeline.Annotations = map[string]string{} - } - - //If the sync is successful, return handle - if state, ok := copyPipeline.Annotations[devopsv1alpha3.PipelineSyncStatusAnnoKey]; ok && state == modelsdevops.StatusSuccessful { - specHash := utils.ComputeHash(copyPipeline.Spec) - oldHash, _ := copyPipeline.Annotations[devopsv1alpha3.PipelineSpecHash] // don't need to check if it's nil, only compare if they're different - if specHash == oldHash { - // it was synced successfully, and there's any change with the Pipeline spec, skip this round - return nil - } else { - copyPipeline.Annotations[devopsv1alpha3.PipelineSpecHash] = specHash - } - } - - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#finalizers - if !sliceutil.HasString(copyPipeline.ObjectMeta.Finalizers, devopsv1alpha3.PipelineFinalizerName) { - copyPipeline.ObjectMeta.Finalizers = append(copyPipeline.ObjectMeta.Finalizers, devopsv1alpha3.PipelineFinalizerName) - } - - // Check pipeline config exists, otherwise we will create it. - // if pipeline exists, check & update config - jenkinsPipeline, err := c.devopsClient.GetProjectPipelineConfig(nsName, pipeline.Name) - if err == nil { - if !reflect.DeepEqual(jenkinsPipeline.Spec, copyPipeline.Spec) { - _, err := c.devopsClient.UpdateProjectPipeline(nsName, copyPipeline) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update pipeline config %s ", key)) - return err - } - } else { - klog.V(8).Info(fmt.Sprintf("nothing was changed, pipeline '%v'", copyPipeline.Spec)) - } - } else { - _, err := c.devopsClient.CreateProjectPipeline(nsName, copyPipeline) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to create copyPipeline %s ", key)) - return err - } - } - - //If there is no early return, then the sync is successful. - copyPipeline.Annotations[devopsv1alpha3.PipelineSyncStatusAnnoKey] = modelsdevops.StatusSuccessful - } else { - // Finalizers processing logic - if sliceutil.HasString(copyPipeline.ObjectMeta.Finalizers, devopsv1alpha3.PipelineFinalizerName) { - delSuccess := false - if _, err := c.devopsClient.DeleteProjectPipeline(nsName, pipeline.Name); err != nil { - // the status code should be 404 if the job does not exists - if srvErr, ok := err.(restful.ServiceError); ok { - delSuccess = srvErr.Code == http.StatusNotFound - } else if srvErr, ok := err.(*devopsClient.ErrorResponse); ok { - delSuccess = srvErr.Response.StatusCode == http.StatusNotFound - } else { - klog.Error(fmt.Sprintf("unexpected error type: %v, should be *restful.ServiceError", err)) - } - - klog.V(8).Info(err, fmt.Sprintf("failed to delete pipeline %s in devops", key)) - } else { - delSuccess = true - } - - if delSuccess { - copyPipeline.ObjectMeta.Finalizers = sliceutil.RemoveString(copyPipeline.ObjectMeta.Finalizers, func(item string) bool { - return item == devopsv1alpha3.PipelineFinalizerName - }) - } else { - // make sure the corresponding Jenkins job can be clean - // You can remove the finalizer via kubectl manually in a very special case that Jenkins might be not able to available anymore - return fmt.Errorf("failed to remove pipeline job finalizer due to bad communication with Jenkins") - } - } - } - - if !reflect.DeepEqual(pipeline, copyPipeline) { - _, err = c.kubesphereClient.DevopsV1alpha3().Pipelines(nsName).Update(context.Background(), copyPipeline, metav1.UpdateOptions{}) - if err != nil { - klog.V(8).Info(err, fmt.Sprintf("failed to update pipeline %s ", key)) - return err - } - } - return nil -} - -func isDevOpsProjectAdminNamespace(namespace *v1.Namespace) bool { - _, ok := namespace.Labels[constants.DevOpsProjectLabelKey] - - return ok && k8sutil.IsControlledBy(namespace.OwnerReferences, - devopsv1alpha3.ResourceKindDevOpsProject, "") - -} diff --git a/pkg/controller/pipeline/pipeline_controller_test.go b/pkg/controller/pipeline/pipeline_controller_test.go deleted file mode 100644 index a7718c5c3..000000000 --- a/pkg/controller/pipeline/pipeline_controller_test.go +++ /dev/null @@ -1,423 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pipeline - -import ( - "reflect" - "testing" - "time" - - v1 "k8s.io/api/core/v1" - - "kubesphere.io/kubesphere/pkg/constants" - modelsdevops "kubesphere.io/kubesphere/pkg/models/devops" - fakeDevOps "kubesphere.io/kubesphere/pkg/simple/client/devops/fake" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - kubeinformers "k8s.io/client-go/informers" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - - devops "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" - informers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - client *fake.Clientset - kubeclient *k8sfake.Clientset - namespaceLister []*v1.Namespace - pipelineLister []*devops.Pipeline - actions []core.Action - kubeactions []core.Action - - kubeobjects []runtime.Object - // Objects from here preloaded into NewSimpleFake. - objects []runtime.Object - // Objects from here preloaded into devops - initDevOpsProject string - initPipeline []*devops.Pipeline - expectPipeline []*devops.Pipeline -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - return f -} - -func newNamespace(name string, projectName string) *v1.Namespace { - ns := &v1.Namespace{ - TypeMeta: metav1.TypeMeta{ - Kind: "Namespace", - APIVersion: v1.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{constants.DevOpsProjectLabelKey: projectName}, - }, - } - TRUE := true - ns.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ - { - APIVersion: devops.SchemeGroupVersion.String(), - Kind: devops.ResourceKindDevOpsProject, - Name: projectName, - BlockOwnerDeletion: &TRUE, - Controller: &TRUE, - }, - } - - return ns -} - -func newPipeline(namespace, name string, spec devops.PipelineSpec, withFinalizers bool, syncOk bool) *devops.Pipeline { - pipeline := &devops.Pipeline{ - TypeMeta: metav1.TypeMeta{ - Kind: devops.ResourceKindPipeline, - APIVersion: devops.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - Annotations: map[string]string{}, - }, - Spec: spec, - Status: devops.PipelineStatus{}, - } - if withFinalizers { - pipeline.Finalizers = append(pipeline.Finalizers, devops.PipelineFinalizerName) - } - if syncOk { - pipeline.Annotations[devops.PipelineSyncStatusAnnoKey] = modelsdevops.StatusSuccessful - } - return pipeline -} - -func newDeletingPipeline(namespace, name string) *devops.Pipeline { - now := metav1.Now() - pipeline := &devops.Pipeline{ - TypeMeta: metav1.TypeMeta{ - Kind: devops.ResourceKindPipeline, - APIVersion: devops.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - DeletionTimestamp: &now, - }, - } - pipeline.Finalizers = append(pipeline.Finalizers, devops.PipelineFinalizerName) - - return pipeline -} - -func (f *fixture) newController() (*Controller, informers.SharedInformerFactory, kubeinformers.SharedInformerFactory, *fakeDevOps.Devops) { - f.client = fake.NewSimpleClientset(f.objects...) - f.kubeclient = k8sfake.NewSimpleClientset(f.kubeobjects...) - - i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) - k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc()) - dI := fakeDevOps.NewWithPipelines(f.initDevOpsProject, f.initPipeline...) - - c := NewController(f.kubeclient, f.client, dI, k8sI.Core().V1().Namespaces(), - i.Devops().V1alpha3().Pipelines()) - - c.pipelineSynced = alwaysReady - c.eventRecorder = &record.FakeRecorder{} - - for _, f := range f.pipelineLister { - i.Devops().V1alpha3().Pipelines().Informer().GetIndexer().Add(f) - } - - for _, d := range f.namespaceLister { - k8sI.Core().V1().Namespaces().Informer().GetIndexer().Add(d) - } - - return c, i, k8sI, dI -} - -func (f *fixture) run(fooName string) { - f.runController(fooName, true, false) -} - -func (f *fixture) runExpectError(fooName string) { - f.runController(fooName, true, true) -} - -func (f *fixture) runController(projectName string, startInformers bool, expectError bool) { - c, i, k8sI, dI := f.newController() - if startInformers { - stopCh := make(chan struct{}) - defer close(stopCh) - i.Start(stopCh) - k8sI.Start(stopCh) - } - - err := c.syncHandler(projectName) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - actions := filterInformerActions(f.client.Actions()) - k8sActions := filterInformerActions(f.kubeclient.Actions()) - for i, action := range k8sActions { - if len(f.kubeactions) < i+1 { - f.t.Errorf("%d unexpected actions: %+v", len(k8sActions)-len(f.kubeactions), k8sActions[i:]) - break - } - - expectedAction := f.kubeactions[i] - checkAction(expectedAction, action, f.t) - } - - if len(f.kubeactions) > len(k8sActions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.kubeactions)-len(k8sActions), f.kubeactions[len(k8sActions):]) - } - - if len(f.actions) > len(actions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.actions)-len(actions), f.actions[len(actions):]) - } - if len(dI.Pipelines[f.initDevOpsProject]) != len(f.expectPipeline) { - f.t.Errorf(" unexpected objects: %v", dI.Projects) - } - for _, pipeline := range f.expectPipeline { - actualPipeline := dI.Pipelines[f.initDevOpsProject][pipeline.Name] - if !reflect.DeepEqual(actualPipeline, pipeline) { - f.t.Errorf(" pipeline %+v not match %+v", pipeline, actualPipeline) - } - - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", devops.ResourcePluralPipeline) || - action.Matches("watch", devops.ResourcePluralPipeline) || - action.Matches("list", "namespaces") || - action.Matches("watch", "namespaces")) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectUpdatePipelineAction(p *devops.Pipeline) { - action := core.NewUpdateAction(schema.GroupVersionResource{ - Version: devops.SchemeGroupVersion.Version, - Resource: devops.ResourcePluralPipeline, - Group: devops.SchemeGroupVersion.Group, - }, p.Namespace, p) - f.actions = append(f.actions, action) -} - -func getKey(p *devops.Pipeline, t *testing.T) string { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(p) - if err != nil { - t.Errorf("Unexpected error getting key for pipeline %v: %v", p.Name, err) - return "" - } - return key -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - pipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, true, true) - - f.pipelineLister = append(f.pipelineLister, pipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, pipeline) - f.initDevOpsProject = nsName - f.initPipeline = []*devops.Pipeline{pipeline} - f.expectPipeline = []*devops.Pipeline{pipeline} - - f.run(getKey(pipeline, t)) -} - -func TestAddPipelineFinalizers(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - pipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, false, false) - - expectPipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, true, true) - - f.pipelineLister = append(f.pipelineLister, pipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, pipeline) - f.initDevOpsProject = nsName - f.initPipeline = []*devops.Pipeline{pipeline} - f.expectPipeline = []*devops.Pipeline{pipeline} - f.expectUpdatePipelineAction(expectPipeline) - f.run(getKey(pipeline, t)) -} - -func TestCreatePipeline(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - pipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, false, false) - expectPipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, true, true) - f.pipelineLister = append(f.pipelineLister, pipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, pipeline) - f.initDevOpsProject = nsName - f.expectPipeline = []*devops.Pipeline{expectPipeline} - f.run(getKey(pipeline, t)) -} - -func TestDeletePipeline(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - pipeline := newDeletingPipeline(nsName, pipelineName) - - expectPipeline := pipeline.DeepCopy() - expectPipeline.Finalizers = []string{} - f.pipelineLister = append(f.pipelineLister, pipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, pipeline) - f.initDevOpsProject = nsName - f.initPipeline = []*devops.Pipeline{pipeline} - f.expectPipeline = []*devops.Pipeline{} - f.expectUpdatePipelineAction(expectPipeline) - f.run(getKey(pipeline, t)) -} - -func TestDeleteNotExistPipeline(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - pipeline := newDeletingPipeline(nsName, pipelineName) - - expectPipeline := pipeline.DeepCopy() - expectPipeline.Finalizers = []string{} - f.pipelineLister = append(f.pipelineLister, pipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, pipeline) - f.initDevOpsProject = nsName - f.initPipeline = []*devops.Pipeline{} - f.expectPipeline = []*devops.Pipeline{} - f.expectUpdatePipelineAction(expectPipeline) - f.run(getKey(pipeline, t)) -} - -func TestUpdatePipelineConfig(t *testing.T) { - f := newFixture(t) - nsName := "test-123" - pipelineName := "test" - projectName := "test_project" - - ns := newNamespace(nsName, projectName) - initPipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{}, true, false) - modifiedPipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{Type: "aa"}, true, false) - expectPipeline := newPipeline(nsName, pipelineName, devops.PipelineSpec{Type: "aa"}, true, true) - f.pipelineLister = append(f.pipelineLister, modifiedPipeline) - f.namespaceLister = append(f.namespaceLister, ns) - f.objects = append(f.objects, modifiedPipeline) - f.initDevOpsProject = nsName - f.initPipeline = []*devops.Pipeline{initPipeline} - f.expectPipeline = []*devops.Pipeline{expectPipeline} - f.run(getKey(modifiedPipeline, t)) -} diff --git a/pkg/controller/s2ibinary/OWNERS b/pkg/controller/s2ibinary/OWNERS deleted file mode 100644 index d55442117..000000000 --- a/pkg/controller/s2ibinary/OWNERS +++ /dev/null @@ -1,13 +0,0 @@ -approvers: - - shaowenchen - - linuxsuren - -reviewers: - - runzexia - - soulseen - - shaowenchen - - linuxsuren - -labels: - - area/controller - - area/devops diff --git a/pkg/controller/s2ibinary/s2ibinary_controller.go b/pkg/controller/s2ibinary/s2ibinary_controller.go deleted file mode 100644 index f39238c84..000000000 --- a/pkg/controller/s2ibinary/s2ibinary_controller.go +++ /dev/null @@ -1,242 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package s2ibinary - -import ( - "context" - "fmt" - "time" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/scheme" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog" - - "kubesphere.io/kubesphere/pkg/simple/client/s3" - "kubesphere.io/kubesphere/pkg/utils/sliceutil" - - devopsv1alpha1 "kubesphere.io/api/devops/v1alpha1" - - devopsclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - devopsinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha1" - devopslisters "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha1" -) - -/** -s2ibinary-controller used to handle s2ibinary's delete logic. -s2ibinary creation and file upload provided by kubesphere/kapis -*/ -type Controller struct { - client clientset.Interface - devopsClient devopsclient.Interface - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - s2iBinaryLister devopslisters.S2iBinaryLister - s2iBinarySynced cache.InformerSynced - - workqueue workqueue.RateLimitingInterface - - workerLoopPeriod time.Duration - - s3Client s3.Interface -} - -func NewController(client clientset.Interface, - devopsclientset devopsclient.Interface, - s2ibinInformer devopsinformers.S2iBinaryInformer, - s3Client s3.Interface) *Controller { - - broadcaster := record.NewBroadcaster() - broadcaster.StartLogging(func(format string, args ...interface{}) { - klog.Info(fmt.Sprintf(format, args)) - }) - broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "s2ibinary-controller"}) - - v := &Controller{ - client: client, - devopsClient: devopsclientset, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "s2ibinary"), - s2iBinaryLister: s2ibinInformer.Lister(), - s2iBinarySynced: s2ibinInformer.Informer().HasSynced, - workerLoopPeriod: time.Second, - s3Client: s3Client, - } - - v.eventBroadcaster = broadcaster - v.eventRecorder = recorder - - s2ibinInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: v.enqueueS2iBinary, - UpdateFunc: func(oldObj, newObj interface{}) { - old := oldObj.(*devopsv1alpha1.S2iBinary) - new := newObj.(*devopsv1alpha1.S2iBinary) - if old.ResourceVersion == new.ResourceVersion { - return - } - v.enqueueS2iBinary(newObj) - }, - DeleteFunc: v.enqueueS2iBinary, - }) - return v -} - -// enqueueS2iBinary takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work workqueue. This method should *not* be -// passed resources of any type other than S2iBinary. -func (c *Controller) enqueueS2iBinary(obj interface{}) { - var key string - var err error - if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - utilruntime.HandleError(err) - return - } - c.workqueue.Add(key) -} - -func (c *Controller) processNextWorkItem() bool { - obj, shutdown := c.workqueue.Get() - - if shutdown { - return false - } - - err := func(obj interface{}) error { - defer c.workqueue.Done(obj) - var key string - var ok bool - - if key, ok = obj.(string); !ok { - c.workqueue.Forget(obj) - utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) - return nil - } - if err := c.syncHandler(key); err != nil { - c.workqueue.AddRateLimited(key) - return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error()) - } - c.workqueue.Forget(obj) - klog.V(5).Infof("Successfully synced '%s'", key) - return nil - }(obj) - - if err != nil { - klog.Error(err, "could not reconcile s2ibinary") - utilruntime.HandleError(err) - return true - } - - return true -} - -func (c *Controller) worker() { - - for c.processNextWorkItem() { - } -} - -func (c *Controller) Start(stopCh <-chan struct{}) error { - return c.Run(1, stopCh) -} - -func (c *Controller) Run(workers int, stopCh <-chan struct{}) error { - defer utilruntime.HandleCrash() - defer c.workqueue.ShutDown() - - klog.Info("starting s2ibinary controller") - defer klog.Info("shutting down s2ibinary controller") - - if !cache.WaitForCacheSync(stopCh, c.s2iBinarySynced) { - return fmt.Errorf("failed to wait for caches to sync") - } - - for i := 0; i < workers; i++ { - go wait.Until(c.worker, c.workerLoopPeriod, stopCh) - } - - <-stopCh - return nil -} - -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the Foo resource -// with the current status of the resource. -func (c *Controller) syncHandler(key string) error { - namespace, name, err := cache.SplitMetaNamespaceKey(key) - if err != nil { - klog.Error(err, fmt.Sprintf("could not split s2ibin meta %s ", key)) - return nil - } - s2ibin, err := c.s2iBinaryLister.S2iBinaries(namespace).Get(name) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("s2ibin '%s' in work queue no longer exists ", key)) - return nil - } - klog.Error(err, fmt.Sprintf("could not get s2ibin %s ", key)) - return err - } - if s2ibin.ObjectMeta.DeletionTimestamp.IsZero() { - if !sliceutil.HasString(s2ibin.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) { - s2ibin.ObjectMeta.Finalizers = append(s2ibin.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) - _, err := c.devopsClient.DevopsV1alpha1().S2iBinaries(namespace).Update(context.Background(), s2ibin, metav1.UpdateOptions{}) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to update s2ibin %s ", key)) - return err - } - } - - } else { - if sliceutil.HasString(s2ibin.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) { - if err := c.deleteBinaryInS3(s2ibin); err != nil { - klog.Error(err, fmt.Sprintf("failed to delete resource %s in s3", key)) - return err - } - s2ibin.ObjectMeta.Finalizers = sliceutil.RemoveString(s2ibin.ObjectMeta.Finalizers, func(item string) bool { - return item == devopsv1alpha1.S2iBinaryFinalizerName - }) - _, err := c.devopsClient.DevopsV1alpha1().S2iBinaries(namespace).Update(context.Background(), s2ibin, metav1.UpdateOptions{}) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to update s2ibin %s ", key)) - return err - } - } - } - - return nil -} - -func (c *Controller) deleteBinaryInS3(s2ibin *devopsv1alpha1.S2iBinary) error { - - key := fmt.Sprintf("%s-%s", s2ibin.Namespace, s2ibin.Name) - err := c.s3Client.Delete(key) - if err != nil { - klog.Errorf("error happened while deleting %s, %v", key, err) - } - - return nil -} diff --git a/pkg/controller/s2ibinary/s2ibinary_controller_test.go b/pkg/controller/s2ibinary/s2ibinary_controller_test.go deleted file mode 100644 index ca173bcef..000000000 --- a/pkg/controller/s2ibinary/s2ibinary_controller_test.go +++ /dev/null @@ -1,254 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package s2ibinary - -import ( - "reflect" - "testing" - "time" - - fakes3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - - s2i "kubesphere.io/api/devops/v1alpha1" - - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" - informers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - client *fake.Clientset - kubeclient *k8sfake.Clientset - // Objects to put in the store. - s2ibinaryLister []*s2i.S2iBinary - actions []core.Action - // Objects from here preloaded into NewSimpleFake. - objects []runtime.Object - // Objects from here preloaded into s3 - initS3Objects []*fakes3.Object - expectS3Objects []*fakes3.Object -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - return f -} - -func newS2iBinary(name string, spec s2i.S2iBinarySpec) *s2i.S2iBinary { - return &s2i.S2iBinary{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - }, - Spec: spec, - } -} -func newDeletingS2iBinary(name string) *s2i.S2iBinary { - deleteTime := metav1.Now() - return &s2i.S2iBinary{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - Finalizers: []string{s2i.S2iBinaryFinalizerName}, - DeletionTimestamp: &deleteTime, - }, - } -} - -func (f *fixture) newController() (*Controller, informers.SharedInformerFactory, *fakes3.FakeS3) { - f.client = fake.NewSimpleClientset(f.objects...) - f.kubeclient = k8sfake.NewSimpleClientset() - - i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) - s3I := fakes3.NewFakeS3(f.expectS3Objects...) - - c := NewController(f.kubeclient, f.client, i.Devops().V1alpha1().S2iBinaries(), s3I) - - c.s2iBinarySynced = alwaysReady - c.eventRecorder = &record.FakeRecorder{} - - for _, f := range f.s2ibinaryLister { - i.Devops().V1alpha1().S2iBinaries().Informer().GetIndexer().Add(f) - } - - return c, i, s3I -} - -func (f *fixture) run(fooName string) { - f.runController(fooName, true, false) -} - -func (f *fixture) runExpectError(fooName string) { - f.runController(fooName, true, true) -} - -func (f *fixture) runController(s2iBinaryName string, startInformers bool, expectError bool) { - c, i, s3I := f.newController() - if startInformers { - stopCh := make(chan struct{}) - defer close(stopCh) - i.Start(stopCh) - } - - err := c.syncHandler(s2iBinaryName) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - actions := filterInformerActions(f.client.Actions()) - for i, action := range actions { - if len(f.actions) < i+1 { - f.t.Errorf("%d unexpected actions: %+v", len(actions)-len(f.actions), actions[i:]) - break - } - - expectedAction := f.actions[i] - checkAction(expectedAction, action, f.t) - } - - if len(f.actions) > len(actions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.actions)-len(actions), f.actions[len(actions):]) - } - if len(s3I.Storage) != len(f.expectS3Objects) { - f.t.Errorf(" unexpected objects: %v", s3I.Storage) - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", s2i.ResourcePluralS2iBinary) || - action.Matches("watch", s2i.ResourcePluralS2iBinary)) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectUpdateS2iBinaryAction(s2ibinary *s2i.S2iBinary) { - action := core.NewUpdateAction(schema.GroupVersionResource{Resource: s2i.ResourcePluralS2iBinary}, s2ibinary.Namespace, s2ibinary) - f.actions = append(f.actions, action) -} - -func getKey(s2ibinary *s2i.S2iBinary, t *testing.T) string { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(s2ibinary) - if err != nil { - t.Errorf("Unexpected error getting key for s2ibinary %v: %v", s2ibinary.Name, err) - return "" - } - return key -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - s2iBinary := newS2iBinary("test", s2i.S2iBinarySpec{}) - - f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary) - f.objects = append(f.objects, s2iBinary) - - f.expectUpdateS2iBinaryAction(s2iBinary) - f.run(getKey(s2iBinary, t)) -} - -func TestDeleteS3Object(t *testing.T) { - f := newFixture(t) - s2iBinary := newDeletingS2iBinary("test") - - f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary) - f.objects = append(f.objects, s2iBinary) - f.initS3Objects = []*fakes3.Object{{ - Key: "default-test", - }} - f.expectS3Objects = []*fakes3.Object{} - f.expectUpdateS2iBinaryAction(s2iBinary) - f.run(getKey(s2iBinary, t)) - -} diff --git a/pkg/controller/s2irun/OWNERS b/pkg/controller/s2irun/OWNERS deleted file mode 100644 index d55442117..000000000 --- a/pkg/controller/s2irun/OWNERS +++ /dev/null @@ -1,13 +0,0 @@ -approvers: - - shaowenchen - - linuxsuren - -reviewers: - - runzexia - - soulseen - - shaowenchen - - linuxsuren - -labels: - - area/controller - - area/devops diff --git a/pkg/controller/s2irun/s2irun_controller.go b/pkg/controller/s2irun/s2irun_controller.go deleted file mode 100644 index 4680e1c5c..000000000 --- a/pkg/controller/s2irun/s2irun_controller.go +++ /dev/null @@ -1,304 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package s2irun - -import ( - "context" - "fmt" - "time" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/kubernetes/scheme" - v1core "k8s.io/client-go/kubernetes/typed/core/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog" - - "kubesphere.io/kubesphere/pkg/utils/sliceutil" - - devopsv1alpha1 "kubesphere.io/api/devops/v1alpha1" - - devopsclient "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - devopsinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions/devops/v1alpha1" - devopslisters "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha1" -) - -/** - s2irun-controller used to handle s2irun's delete logic. - s2irun creation and operation provided by s2ioperator -*/ -type Controller struct { - client clientset.Interface - - devopsClient devopsclient.Interface - - eventBroadcaster record.EventBroadcaster - eventRecorder record.EventRecorder - - s2iRunLister devopslisters.S2iRunLister - s2iRunSynced cache.InformerSynced - - s2iBinaryLister devopslisters.S2iBinaryLister - s2iBinarySynced cache.InformerSynced - - workqueue workqueue.RateLimitingInterface - - workerLoopPeriod time.Duration -} - -func NewS2iRunController( - client clientset.Interface, - devopsClientSet devopsclient.Interface, - s2iBinInformer devopsinformers.S2iBinaryInformer, - s2iRunInformer devopsinformers.S2iRunInformer) *Controller { - - broadcaster := record.NewBroadcaster() - broadcaster.StartLogging(func(format string, args ...interface{}) { - klog.Info(fmt.Sprintf(format, args)) - }) - broadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "s2irun-controller"}) - - v := &Controller{ - client: client, - devopsClient: devopsClientSet, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "s2irun"), - s2iBinaryLister: s2iBinInformer.Lister(), - s2iBinarySynced: s2iBinInformer.Informer().HasSynced, - s2iRunLister: s2iRunInformer.Lister(), - s2iRunSynced: s2iRunInformer.Informer().HasSynced, - workerLoopPeriod: time.Second, - } - - v.eventBroadcaster = broadcaster - v.eventRecorder = recorder - - s2iRunInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: v.enqueueS2iRun, - UpdateFunc: func(oldObj, newObj interface{}) { - old := oldObj.(*devopsv1alpha1.S2iRun) - new := newObj.(*devopsv1alpha1.S2iRun) - if old.ResourceVersion == new.ResourceVersion { - return - } - v.enqueueS2iRun(newObj) - }, - DeleteFunc: v.enqueueS2iRun, - }) - return v -} - -// enqueueFoo takes a Foo resource and converts it into a namespace/name -// string which is then put onto the work workqueue. This method should *not* be -// passed resources of any type other than Foo. -func (c Controller) enqueueS2iRun(obj interface{}) { - var key string - var err error - if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - utilruntime.HandleError(err) - return - } - c.workqueue.Add(key) -} - -func (c Controller) processNextWorkItem() bool { - obj, shutdown := c.workqueue.Get() - - if shutdown { - return false - } - - err := func(obj interface{}) error { - defer c.workqueue.Done(obj) - var key string - var ok bool - if key, ok = obj.(string); !ok { - c.workqueue.Forget(obj) - utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) - return nil - } - if err := c.syncHandler(key); err != nil { - c.workqueue.AddRateLimited(key) - return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error()) - } - c.workqueue.Forget(obj) - klog.V(5).Infof("Successfully synced '%s'", key) - return nil - }(obj) - - if err != nil { - klog.Error(err, "could not reconcile s2irun") - utilruntime.HandleError(err) - return true - } - - return true -} - -func (c Controller) worker() { - - for c.processNextWorkItem() { - } -} - -func (c Controller) Start(stopCh <-chan struct{}) error { - return c.Run(1, stopCh) -} - -func (c Controller) Run(workers int, stopCh <-chan struct{}) error { - defer utilruntime.HandleCrash() - defer c.workqueue.ShutDown() - - klog.Info("starting s2irun controller") - defer klog.Info("shutting down s2irun controller") - - if !cache.WaitForCacheSync(stopCh, c.s2iBinarySynced) { - return fmt.Errorf("failed to wait for caches to sync") - } - - for i := 0; i < workers; i++ { - go wait.Until(c.worker, c.workerLoopPeriod, stopCh) - } - - <-stopCh - return nil -} - -// syncHandler compares the actual state with the desired, and attempts to -// converge the two. It then updates the Status block of the Foo resource -// with the current status of the resource. -func (c Controller) syncHandler(key string) error { - namespace, name, err := cache.SplitMetaNamespaceKey(key) - if err != nil { - klog.Error(err, fmt.Sprintf("could not split s2irun meta %s ", key)) - return nil - } - s2irun, err := c.s2iRunLister.S2iRuns(namespace).Get(name) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("s2irun '%s' in work queue no longer exists ", key)) - return nil - } - klog.Error(err, fmt.Sprintf("could not get s2irun %s ", key)) - return err - } - if s2irun.Labels != nil { - _, ok := s2irun.Labels[devopsv1alpha1.S2iBinaryLabelKey] - if ok { - if s2irun.ObjectMeta.DeletionTimestamp.IsZero() { - if !sliceutil.HasString(s2irun.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) { - s2irun.ObjectMeta.Finalizers = append(s2irun.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) - _, err = c.devopsClient.DevopsV1alpha1().S2iRuns(namespace).Update(context.Background(), s2irun, metav1.UpdateOptions{}) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to update s2irun %s", key)) - return err - } - } - - } else { - if sliceutil.HasString(s2irun.ObjectMeta.Finalizers, devopsv1alpha1.S2iBinaryFinalizerName) { - if err := c.DeleteS2iBinary(s2irun); err != nil { - klog.Error(err, fmt.Sprintf("failed to delete s2ibin %s in", key)) - return err - } - s2irun.ObjectMeta.Finalizers = sliceutil.RemoveString(s2irun.ObjectMeta.Finalizers, func(item string) bool { - return item == devopsv1alpha1.S2iBinaryFinalizerName - }) - _, err = c.devopsClient.DevopsV1alpha1().S2iRuns(namespace).Update(context.Background(), s2irun, metav1.UpdateOptions{}) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to update s2irun %s ", key)) - return err - } - } - } - } - } - - return nil -} - -/** - DeleteS2iBinary mainly cleans up two parts of S2iBinary - 1. s2ibinary bound to s2irun - 2. s2ibinary that has been created for more than 24 hours but has not been used -*/ -func (c Controller) DeleteS2iBinary(s2irun *devopsv1alpha1.S2iRun) error { - s2iBinName := s2irun.Labels[devopsv1alpha1.S2iBinaryLabelKey] - s2iBin, err := c.s2iBinaryLister.S2iBinaries(s2irun.Namespace).Get(s2iBinName) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("s2ibin '%s/%s' has been delted ", s2irun.Namespace, s2iBinName)) - return nil - } - klog.Error(err, fmt.Sprintf("failed to get s2ibin %s/%s ", s2irun.Namespace, s2iBinName)) - return err - } - err = c.devopsClient.DevopsV1alpha1().S2iBinaries(s2iBin.Namespace).Delete(context.Background(), s2iBinName, metav1.DeleteOptions{}) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("s2ibin '%s/%s' has been delted ", s2irun.Namespace, s2iBinName)) - return nil - } - klog.Error(err, fmt.Sprintf("failed to delete s2ibin %s/%s ", s2irun.Namespace, s2iBinName)) - return err - } - if err = c.cleanOtherS2iBinary(s2irun.Namespace); err != nil { - klog.Error(err, fmt.Sprintf("failed to clean s2ibinary in %s", s2irun.Namespace)) - } - - return nil -} - -// cleanOtherS2iBinary clean up s2ibinary created for more than 24 hours without associated s2irun -func (c Controller) cleanOtherS2iBinary(namespace string) error { - s2iBins, err := c.s2iBinaryLister.S2iBinaries(namespace).List(labels.Everything()) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to list s2ibin in %s ", namespace)) - return err - } - now := time.Now() - dayBefore := metav1.NewTime(now.Add(time.Hour * 24 * -1)) - for _, s2iBin := range s2iBins { - if s2iBin.Status.Phase != devopsv1alpha1.StatusReady && s2iBin.CreationTimestamp.Before(&dayBefore) { - - runs, err := c.s2iRunLister.S2iRuns(namespace).List(labels.SelectorFromSet(labels.Set{devopsv1alpha1.S2iBinaryLabelKey: s2iBin.Name})) - if err != nil { - klog.Error(err, fmt.Sprintf("failed to list s2irun in %s ", namespace)) - return err - } - if len(runs) == 0 { - err = c.devopsClient.DevopsV1alpha1().S2iBinaries(namespace).Delete(context.Background(), s2iBin.Name, metav1.DeleteOptions{}) - if err != nil { - if errors.IsNotFound(err) { - klog.Info(fmt.Sprintf("s2ibin '%s/%s' has been deleted ", namespace, s2iBin.Name)) - return nil - } - klog.Error(err, fmt.Sprintf("failed to delete s2ibin %s/%s ", namespace, s2iBin.Name)) - return err - } - } - } - } - return nil -} diff --git a/pkg/controller/s2irun/s2irun_controller_test.go b/pkg/controller/s2irun/s2irun_controller_test.go deleted file mode 100644 index bd62f56bc..000000000 --- a/pkg/controller/s2irun/s2irun_controller_test.go +++ /dev/null @@ -1,323 +0,0 @@ -/* -Copyright 2020 KubeSphere Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package s2irun - -import ( - "reflect" - "testing" - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/diff" - k8sfake "k8s.io/client-go/kubernetes/fake" - core "k8s.io/client-go/testing" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - - s2i "kubesphere.io/api/devops/v1alpha1" - - "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake" - informers "kubesphere.io/kubesphere/pkg/client/informers/externalversions" -) - -var ( - alwaysReady = func() bool { return true } - noResyncPeriodFunc = func() time.Duration { return 0 } -) - -type fixture struct { - t *testing.T - - client *fake.Clientset - kubeclient *k8sfake.Clientset - // Objects to put in the store. - s2ibinaryLister []*s2i.S2iBinary - s2irunLister []*s2i.S2iRun - actions []core.Action - // Objects from here preloaded into NewSimpleFake. - objects []runtime.Object -} - -func newFixture(t *testing.T) *fixture { - f := &fixture{} - f.t = t - f.objects = []runtime.Object{} - return f -} - -func newS2iBinary(name string) *s2i.S2iBinary { - return &s2i.S2iBinary{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - }, - Spec: s2i.S2iBinarySpec{}, - } -} - -func newS2iBinaryWithCreateTime(name string, createTime metav1.Time) *s2i.S2iBinary { - return &s2i.S2iBinary{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - CreationTimestamp: createTime, - }, - Spec: s2i.S2iBinarySpec{}, - } -} - -func newS2iRun(name string, s2iBinaryName string) *s2i.S2iRun { - return &s2i.S2iRun{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - Labels: map[string]string{ - s2i.S2iBinaryLabelKey: s2iBinaryName, - }, - }, - } -} - -func newDeletetingS2iRun(name string, s2iBinaryName string) *s2i.S2iRun { - now := metav1.Now() - return &s2i.S2iRun{ - TypeMeta: metav1.TypeMeta{APIVersion: s2i.SchemeGroupVersion.String()}, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceDefault, - Labels: map[string]string{ - s2i.S2iBinaryLabelKey: s2iBinaryName, - }, - Finalizers: []string{s2i.S2iBinaryFinalizerName}, - DeletionTimestamp: &now, - }, - } -} - -func (f *fixture) newController() (*Controller, informers.SharedInformerFactory) { - f.client = fake.NewSimpleClientset(f.objects...) - f.kubeclient = k8sfake.NewSimpleClientset() - - i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) - - c := NewS2iRunController(f.kubeclient, f.client, - i.Devops().V1alpha1().S2iBinaries(), i.Devops().V1alpha1().S2iRuns()) - - c.s2iBinarySynced = alwaysReady - c.eventRecorder = &record.FakeRecorder{} - - for _, f := range f.s2ibinaryLister { - i.Devops().V1alpha1().S2iBinaries().Informer().GetIndexer().Add(f) - } - for _, f := range f.s2irunLister { - i.Devops().V1alpha1().S2iRuns().Informer().GetIndexer().Add(f) - } - - return c, i -} - -func (f *fixture) run(fooName string) { - f.runController(fooName, true, false) -} - -func (f *fixture) runExpectError(fooName string) { - f.runController(fooName, true, true) -} - -func (f *fixture) runController(s2iRunName string, startInformers bool, expectError bool) { - c, i := f.newController() - if startInformers { - stopCh := make(chan struct{}) - defer close(stopCh) - i.Start(stopCh) - } - - err := c.syncHandler(s2iRunName) - if !expectError && err != nil { - f.t.Errorf("error syncing foo: %v", err) - } else if expectError && err == nil { - f.t.Error("expected error syncing foo, got nil") - } - - actions := filterInformerActions(f.client.Actions()) - for i, action := range actions { - if len(f.actions) < i+1 { - f.t.Errorf("%d unexpected actions: %+v", len(actions)-len(f.actions), actions[i:]) - break - } - - expectedAction := f.actions[i] - checkAction(expectedAction, action, f.t) - } - - if len(f.actions) > len(actions) { - f.t.Errorf("%d additional expected actions:%+v", len(f.actions)-len(actions), f.actions[len(actions):]) - } -} - -// checkAction verifies that expected and actual actions are equal and both have -// same attached resources -func checkAction(expected, actual core.Action, t *testing.T) { - if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) { - t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual) - return - } - - if reflect.TypeOf(actual) != reflect.TypeOf(expected) { - t.Errorf("Action has wrong type. Expected: %t. Got: %t", expected, actual) - return - } - - switch a := actual.(type) { - case core.CreateActionImpl: - e, _ := expected.(core.CreateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.UpdateActionImpl: - e, _ := expected.(core.UpdateActionImpl) - expObject := e.GetObject() - object := a.GetObject() - - if !reflect.DeepEqual(expObject, object) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) - } - case core.PatchActionImpl: - e, _ := expected.(core.PatchActionImpl) - expPatch := e.GetPatch() - patch := a.GetPatch() - - if !reflect.DeepEqual(expPatch, patch) { - t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) - } - case core.DeleteActionImpl: - e, _ := expected.(core.DeleteActionImpl) - - expName := e.GetName() - objectName := a.GetName() - - if !reflect.DeepEqual(expName, objectName) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expName, objectName)) - } - expNamespace := e.GetNamespace() - objectNamespace := a.GetNamespace() - if !reflect.DeepEqual(expNamespace, objectNamespace) { - t.Errorf("Action %s %s has wrong object\nDiff:\n %s", - a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expNamespace, objectNamespace)) - } - default: - t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it", - actual.GetVerb(), actual.GetResource().Resource) - } -} - -// filterInformerActions filters list and watch actions for testing resources. -// Since list and watch don't change resource state we can filter it to lower -// nose level in our tests. -func filterInformerActions(actions []core.Action) []core.Action { - ret := []core.Action{} - for _, action := range actions { - if len(action.GetNamespace()) == 0 && - (action.Matches("list", s2i.ResourcePluralS2iRun) || - action.Matches("watch", s2i.ResourcePluralS2iRun) || - action.Matches("list", s2i.ResourcePluralS2iBinary) || - action.Matches("watch", s2i.ResourcePluralS2iBinary)) { - continue - } - ret = append(ret, action) - } - - return ret -} - -func (f *fixture) expectUpdateS2iRunAction(s2iRun *s2i.S2iRun) { - action := core.NewUpdateAction(schema.GroupVersionResource{Resource: s2i.ResourcePluralS2iRun}, s2iRun.Namespace, s2iRun) - f.actions = append(f.actions, action) -} - -func (f *fixture) expectDeleteS2iBinaryAction(s2iBinary *s2i.S2iBinary) { - action := core.NewDeleteAction(schema.GroupVersionResource{Resource: s2i.ResourcePluralS2iBinary}, s2iBinary.Namespace, s2iBinary.Name) - f.actions = append(f.actions, action) -} - -func getKey(s2i *s2i.S2iRun, t *testing.T) string { - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(s2i) - if err != nil { - t.Errorf("Unexpected error getting key for s2i %v: %v", s2i.Name, err) - return "" - } - return key -} - -func TestDoNothing(t *testing.T) { - f := newFixture(t) - s2iBinary := newS2iBinary("test") - s2iRun := newS2iRun("test", s2iBinary.Name) - - f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary) - f.s2irunLister = append(f.s2irunLister, s2iRun) - f.objects = append(f.objects, s2iBinary) - f.objects = append(f.objects, s2iRun) - - f.expectUpdateS2iRunAction(s2iRun) - f.run(getKey(s2iRun, t)) -} - -func TestDeleteS2iBinary(t *testing.T) { - f := newFixture(t) - s2iBinary := newS2iBinary("test") - s2iRun := newDeletetingS2iRun("test", s2iBinary.Name) - - f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary) - f.s2irunLister = append(f.s2irunLister, s2iRun) - f.objects = append(f.objects, s2iBinary) - f.objects = append(f.objects, s2iRun) - - f.expectDeleteS2iBinaryAction(s2iBinary) - f.expectUpdateS2iRunAction(s2iRun) - f.run(getKey(s2iRun, t)) -} - -func TestDeleteOtherS2iBinary(t *testing.T) { - f := newFixture(t) - s2iBinary := newS2iBinary("test") - s2iRun := newDeletetingS2iRun("test", s2iBinary.Name) - otherS2iBinary := newS2iBinaryWithCreateTime("test2", metav1.NewTime(time.Date(2000, 1, 1, 12, 0, 0, 0, time.UTC))) - - f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary) - f.s2ibinaryLister = append(f.s2ibinaryLister, otherS2iBinary) - f.s2irunLister = append(f.s2irunLister, s2iRun) - f.objects = append(f.objects, s2iBinary) - f.objects = append(f.objects, s2iRun) - f.objects = append(f.objects, otherS2iBinary) - f.expectDeleteS2iBinaryAction(s2iBinary) - f.expectDeleteS2iBinaryAction(otherS2iBinary) - f.expectUpdateS2iRunAction(s2iRun) - f.run(getKey(s2iRun, t)) -} diff --git a/pkg/kapis/devops/v1alpha2/devops.go b/pkg/kapis/devops/v1alpha2/devops.go deleted file mode 100644 index 93e37f2ff..000000000 --- a/pkg/kapis/devops/v1alpha2/devops.go +++ /dev/null @@ -1,908 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha2 - -import ( - "encoding/json" - "errors" - "fmt" - "net/http" - "strings" - - "github.com/emicklei/go-restful" - "k8s.io/apiserver/pkg/authentication/user" - log "k8s.io/klog" - "k8s.io/klog/v2" - - "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/api" - "kubesphere.io/kubesphere/pkg/apiserver/authorization/authorizer" - "kubesphere.io/kubesphere/pkg/apiserver/request" - "kubesphere.io/kubesphere/pkg/constants" - "kubesphere.io/kubesphere/pkg/models/devops" - "kubesphere.io/kubesphere/pkg/server/params" - clientDevOps "kubesphere.io/kubesphere/pkg/simple/client/devops" - "kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins" -) - -const jenkinsHeaderPre = "X-" - -func (h *ProjectPipelineHandler) GetPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.GetPipeline(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) getPipelinesByRequest(req *restful.Request) (api.ListResult, error) { - // this is a very trick way, but don't have a better solution for now - var ( - start int - limit int - namespace string - ) - - // parse query from the request - pipelineFilter, namespace := parseNameFilterFromQuery(req.QueryParameter("q")) - - // make sure we have an appropriate value - limit, start = params.ParsePaging(req) - return h.devopsOperator.ListPipelineObj(namespace, pipelineFilter, func(list []*v1alpha3.Pipeline, i int, j int) bool { - return strings.Compare(strings.ToUpper(list[i].Name), strings.ToUpper(list[j].Name)) < 0 - }, limit, start) -} - -func parseNameFilterFromQuery(query string) (filter devops.PipelineFilter, namespace string) { - var ( - nameFilter string - ) - - for _, val := range strings.Split(query, ";") { - if strings.HasPrefix(val, "pipeline:") { - nsAndName := strings.TrimPrefix(val, "pipeline:") - filterMeta := strings.Split(nsAndName, "/") - if len(filterMeta) >= 2 { - namespace = filterMeta[0] - nameFilter = filterMeta[1] // the format is '*keyword*' - nameFilter = strings.TrimSuffix(nameFilter, "*") - nameFilter = strings.TrimPrefix(nameFilter, "*") - } else if len(filterMeta) > 0 { - namespace = filterMeta[0] - } - } - } - - filter = func(pipeline *v1alpha3.Pipeline) bool { - return strings.Contains(pipeline.Name, nameFilter) - } - if nameFilter == "" { - filter = nil - } - return -} - -func (h *ProjectPipelineHandler) ListPipelines(req *restful.Request, resp *restful.Response) { - objs, err := h.getPipelinesByRequest(req) - if err != nil { - parseErr(err, resp) - return - } - - // get all pipelines which come from ks - pipelineList := &clientDevOps.PipelineList{ - Total: objs.TotalItems, - Items: make([]clientDevOps.Pipeline, len(objs.Items)), - } - pipelineMap := make(map[string]int, pipelineList.Total) - for i := range objs.Items { - if pipeline, ok := objs.Items[i].(v1alpha3.Pipeline); !ok { - continue - } else { - pipelineMap[pipeline.Name] = i - pipelineList.Items[i] = clientDevOps.Pipeline{ - Name: pipeline.Name, - Annotations: pipeline.Annotations, - } - } - } - - // get all pipelines which come from Jenkins - // fill out the rest fields - if query, err := jenkins.ParseJenkinsQuery(req.Request.URL.RawQuery); err == nil { - query.Set("limit", "10000") - query.Set("start", "0") - req.Request.URL.RawQuery = query.Encode() - } - res, err := h.devopsOperator.ListPipelines(req.Request) - if err != nil { - log.Error(err) - } else { - for i := range res.Items { - if index, ok := pipelineMap[res.Items[i].Name]; ok { - // keep annotations field of pipelineList - annotations := pipelineList.Items[index].Annotations - pipelineList.Items[index] = res.Items[i] - pipelineList.Items[index].Annotations = annotations - } - } - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(pipelineList) -} - -func (h *ProjectPipelineHandler) GetPipelineRun(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetPipelineRun(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ListPipelineRuns(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.ListPipelineRuns(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) StopPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.StopPipeline(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ReplayPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.ReplayPipeline(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) RunPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.RunPipeline(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetArtifacts(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetArtifacts(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetRunLog(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetRunLog(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetStepLog(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - stepId := req.PathParameter("step") - - res, header, err := h.devopsOperator.GetStepLog(projectName, pipelineName, runId, nodeId, stepId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - for k, v := range header { - if strings.HasPrefix(k, jenkinsHeaderPre) { - resp.AddHeader(k, v[0]) - } - } - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetNodeSteps(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - - res, err := h.devopsOperator.GetNodeSteps(projectName, pipelineName, runId, nodeId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetPipelineRunNodes(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetPipelineRunNodes(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -// there're two situation here: -// 1. the particular submitters exist -// the users who are the owner of this Pipeline or the submitter of this Pipeline, or has the auth to create a DevOps project -// 2. no particular submitters -// only the owner of this Pipeline can approve or reject it -func (h *ProjectPipelineHandler) approvableCheck(nodes []clientDevOps.NodesDetail, pipe pipelineParam) { - var userInfo user.Info - var ok bool - var isAdmin bool - // check if current user belong to the admin group, grant it if it's true - if userInfo, ok = request.UserFrom(pipe.Context); ok { - createAuth := authorizer.AttributesRecord{ - User: userInfo, - Verb: authorizer.VerbDelete, - Workspace: pipe.Workspace, - DevOps: pipe.ProjectName, - Resource: "devopsprojects", - ResourceRequest: true, - ResourceScope: request.DevOpsScope, - } - - if decision, _, err := h.authorizer.Authorize(createAuth); err == nil { - isAdmin = decision == authorizer.DecisionAllow - } else { - // this is an expected case, printing the debug info for troubleshooting - klog.V(8).Infof("authorize failed with '%v', error is '%v'", - createAuth, err) - } - } else { - klog.V(6).Infof("cannot get the current user when checking the approvable with pipeline '%s/%s'", - pipe.ProjectName, pipe.Name) - return - } - - var createdByCurrentUser bool // indicate if the current user is the owner - if pipeline, err := h.devopsOperator.GetPipelineObj(pipe.ProjectName, pipe.Name); err == nil { - if creator, ok := pipeline.GetAnnotations()[constants.CreatorAnnotationKey]; ok { - createdByCurrentUser = userInfo.GetName() == creator - } else { - klog.V(6).Infof("annotation '%s' is necessary but it is missing from '%s/%s'", - constants.CreatorAnnotationKey, pipe.ProjectName, pipe.Name) - } - } else { - klog.V(6).Infof("cannot find pipeline '%s/%s', error is '%v'", pipe.ProjectName, pipe.Name, err) - return - } - - // check every input steps if it's approvable - for i, node := range nodes { - if node.State != clientDevOps.StatePaused { - continue - } - - for j, step := range node.Steps { - if step.State != clientDevOps.StatePaused || step.Input == nil { - continue - } - - nodes[i].Steps[j].Approvable = isAdmin || createdByCurrentUser || step.Input.Approvable(userInfo.GetName()) - } - } -} - -func (h *ProjectPipelineHandler) createdBy(projectName string, pipelineName string, currentUserName string) bool { - if pipeline, err := h.devopsOperator.GetPipelineObj(projectName, pipelineName); err == nil { - if creator, ok := pipeline.Annotations[constants.CreatorAnnotationKey]; ok { - return creator == currentUserName - } - } else { - log.V(4).Infof("cannot get pipeline %s/%s, error %#v", projectName, pipelineName, err) - } - return false -} - -func (h *ProjectPipelineHandler) hasSubmitPermission(req *restful.Request) (hasPermit bool, err error) { - pipeParam := parsePipelineParam(req) - httpReq := &http.Request{ - URL: req.Request.URL, - Header: req.Request.Header, - Form: req.Request.Form, - PostForm: req.Request.PostForm, - } - - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - stepId := req.PathParameter("step") - branchName := req.PathParameter("branch") - - // check if current user can approve this input - var res []clientDevOps.NodesDetail - - if branchName == "" { - res, err = h.devopsOperator.GetNodesDetail(pipeParam.ProjectName, pipeParam.Name, runId, httpReq) - } else { - res, err = h.devopsOperator.GetBranchNodesDetail(pipeParam.ProjectName, pipeParam.Name, branchName, runId, httpReq) - } - - if err == nil { - h.approvableCheck(res, parsePipelineParam(req)) - - for _, node := range res { - if node.ID != nodeId { - continue - } - - for _, step := range node.Steps { - if step.ID != stepId || step.Input == nil { - continue - } - - hasPermit = step.Approvable - break - } - break - } - } else { - log.V(4).Infof("cannot get nodes detail, error: %v", err) - err = errors.New("cannot get the submitters of current pipeline run") - return - } - return -} - -func (h *ProjectPipelineHandler) SubmitInputStep(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - stepId := req.PathParameter("step") - - var response []byte - var err error - var ok bool - - if ok, err = h.hasSubmitPermission(req); !ok || err != nil { - msg := map[string]string{ - "allow": "false", - "message": fmt.Sprintf("%v", err), - } - - response, _ = json.Marshal(msg) - } else { - response, err = h.devopsOperator.SubmitInputStep(projectName, pipelineName, runId, nodeId, stepId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - } - resp.Write(response) -} - -func (h *ProjectPipelineHandler) GetNodesDetail(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetNodesDetail(projectName, pipelineName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - h.approvableCheck(res, parsePipelineParam(req)) - - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetBranchPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - - res, err := h.devopsOperator.GetBranchPipeline(projectName, pipelineName, branchName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetBranchPipelineRun(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetBranchPipelineRun(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) StopBranchPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.StopBranchPipeline(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ReplayBranchPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.ReplayBranchPipeline(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) RunBranchPipeline(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - - res, err := h.devopsOperator.RunBranchPipeline(projectName, pipelineName, branchName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetBranchArtifacts(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetBranchArtifacts(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetBranchRunLog(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetBranchRunLog(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetBranchStepLog(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - stepId := req.PathParameter("step") - - res, header, err := h.devopsOperator.GetBranchStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId, req.Request) - - if err != nil { - parseErr(err, resp) - return - } - for k, v := range header { - if strings.HasPrefix(k, jenkinsHeaderPre) { - resp.AddHeader(k, v[0]) - } - } - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetBranchNodeSteps(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - - res, err := h.devopsOperator.GetBranchNodeSteps(projectName, pipelineName, branchName, runId, nodeId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetBranchPipelineRunNodes(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetBranchPipelineRunNodes(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) SubmitBranchInputStep(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - nodeId := req.PathParameter("node") - stepId := req.PathParameter("step") - - var response []byte - var err error - var ok bool - - if ok, err = h.hasSubmitPermission(req); !ok || err != nil { - msg := map[string]string{ - "allow": "false", - "message": fmt.Sprintf("%v", err), - } - - response, _ = json.Marshal(msg) - } else { - response, err = h.devopsOperator.SubmitBranchInputStep(projectName, pipelineName, branchName, runId, nodeId, stepId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - } - - resp.Write(response) -} - -func (h *ProjectPipelineHandler) GetBranchNodesDetail(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - branchName := req.PathParameter("branch") - runId := req.PathParameter("run") - - res, err := h.devopsOperator.GetBranchNodesDetail(projectName, pipelineName, branchName, runId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - h.approvableCheck(res, parsePipelineParam(req)) - resp.WriteAsJson(res) -} - -func parsePipelineParam(req *restful.Request) pipelineParam { - return pipelineParam{ - Workspace: req.PathParameter("workspace"), - ProjectName: req.PathParameter("devops"), - Name: req.PathParameter("pipeline"), - Context: req.Request.Context(), - } -} - -func (h *ProjectPipelineHandler) GetPipelineBranch(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.GetPipelineBranch(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ScanBranch(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.ScanBranch(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetConsoleLog(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - res, err := h.devopsOperator.GetConsoleLog(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GetCrumb(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.GetCrumb(req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetSCMServers(req *restful.Request, resp *restful.Response) { - scmId := req.PathParameter("scm") - - res, err := h.devopsOperator.GetSCMServers(scmId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetSCMOrg(req *restful.Request, resp *restful.Response) { - scmId := req.PathParameter("scm") - - res, err := h.devopsOperator.GetSCMOrg(scmId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetOrgRepo(req *restful.Request, resp *restful.Response) { - scmId := req.PathParameter("scm") - organizationId := req.PathParameter("organization") - - res, err := h.devopsOperator.GetOrgRepo(scmId, organizationId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) CreateSCMServers(req *restful.Request, resp *restful.Response) { - scmId := req.PathParameter("scm") - - res, err := h.devopsOperator.CreateSCMServers(scmId, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) Validate(req *restful.Request, resp *restful.Response) { - scmId := req.PathParameter("scm") - - res, err := h.devopsOperator.Validate(scmId, req.Request) - if err != nil { - log.Error(err) - if jErr, ok := err.(*devops.JkError); ok { - if jErr.Code != http.StatusUnauthorized { - resp.WriteError(jErr.Code, err) - } else { - resp.WriteHeader(http.StatusPreconditionRequired) - } - } else { - resp.WriteError(http.StatusInternalServerError, err) - } - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetNotifyCommit(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.GetNotifyCommit(req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Write(res) -} - -func (h *ProjectPipelineHandler) PostNotifyCommit(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.GetNotifyCommit(req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Write(res) -} - -func (h *ProjectPipelineHandler) GithubWebhook(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.GithubWebhook(req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Write(res) -} - -func (h *ProjectPipelineHandler) CheckScriptCompile(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - pipelineName := req.PathParameter("pipeline") - - resBody, err := h.devopsOperator.CheckScriptCompile(projectName, pipelineName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.WriteAsJson(resBody) -} - -func (h *ProjectPipelineHandler) CheckCron(req *restful.Request, resp *restful.Response) { - projectName := req.PathParameter("devops") - - res, err := h.devopsOperator.CheckCron(projectName, req.Request) - if err != nil { - parseErr(err, resp) - return - } - - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ToJenkinsfile(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.ToJenkinsfile(req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) ToJson(req *restful.Request, resp *restful.Response) { - res, err := h.devopsOperator.ToJson(req.Request) - if err != nil { - parseErr(err, resp) - return - } - resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) - resp.WriteAsJson(res) -} - -func (h *ProjectPipelineHandler) GetProjectCredentialUsage(req *restful.Request, resp *restful.Response) { - projectId := req.PathParameter("devops") - credentialId := req.PathParameter("credential") - response, err := h.projectCredentialGetter.GetProjectCredentialUsage(projectId, credentialId) - if err != nil { - log.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - resp.WriteAsJson(response) - return - -} - -func parseErr(err error, resp *restful.Response) { - log.Error(err) - if jErr, ok := err.(*devops.JkError); ok { - resp.WriteError(jErr.Code, err) - } else { - resp.WriteError(http.StatusInternalServerError, err) - } - return -} diff --git a/pkg/kapis/devops/v1alpha2/devops_test.go b/pkg/kapis/devops/v1alpha2/devops_test.go deleted file mode 100644 index 7801f8add..000000000 --- a/pkg/kapis/devops/v1alpha2/devops_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package v1alpha2 - -import ( - "strings" - "testing" - - "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/models/devops" -) - -func TestParseNameFilterFromQuery(t *testing.T) { - table := []struct { - query string - pipeline *v1alpha3.Pipeline - expectFilter devops.PipelineFilter - expectNamespace string - message string - }{{ - query: "type:pipeline;organization:jenkins;pipeline:serverjkq4c/*", - pipeline: &v1alpha3.Pipeline{}, - expectFilter: nil, - expectNamespace: "serverjkq4c", - message: "query all pipelines with filter *", - }, { - query: "type:pipeline;organization:jenkins;pipeline:cccc/*abc*", - pipeline: &v1alpha3.Pipeline{}, - expectFilter: func(pipeline *v1alpha3.Pipeline) bool { - return strings.Contains(pipeline.Name, "abc") - }, - expectNamespace: "cccc", - message: "query all pipelines with filter abc", - }, { - query: "type:pipeline;organization:jenkins;pipeline:pai-serverjkq4c/*", - pipeline: &v1alpha3.Pipeline{}, - expectFilter: nil, - expectNamespace: "pai-serverjkq4c", - message: "query all pipelines with filter *", - }, { - query: "type:pipeline;organization:jenkins;pipeline:defdef", - pipeline: &v1alpha3.Pipeline{}, - expectFilter: nil, - expectNamespace: "defdef", - message: "query all pipelines with filter *", - }} - - for i, item := range table { - filter, ns := parseNameFilterFromQuery(item.query) - if item.expectFilter == nil { - if filter != nil { - t.Fatalf("invalid filter, index: %d, message: %s", i, item.message) - } - } else { - if filter == nil || filter(item.pipeline) != item.expectFilter(item.pipeline) { - t.Fatalf("invalid filter, index: %d, message: %s", i, item.message) - } - } - if ns != item.expectNamespace { - t.Fatalf("invalid namespace, index: %d, message: %s", i, item.message) - } - } -} diff --git a/pkg/kapis/devops/v1alpha2/handler.go b/pkg/kapis/devops/v1alpha2/handler.go deleted file mode 100644 index 586648902..000000000 --- a/pkg/kapis/devops/v1alpha2/handler.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha2 - -import ( - "kubesphere.io/kubesphere/pkg/apiserver/authorization/authorizer" - "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - "kubesphere.io/kubesphere/pkg/client/informers/externalversions" - "kubesphere.io/kubesphere/pkg/models/devops" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" - "kubesphere.io/kubesphere/pkg/simple/client/s3" - "kubesphere.io/kubesphere/pkg/simple/client/sonarqube" -) - -type ProjectPipelineHandler struct { - devopsOperator devops.DevopsOperator - projectCredentialGetter devops.ProjectCredentialGetter - authorizer authorizer.Authorizer -} - -type PipelineSonarHandler struct { - pipelineSonarGetter devops.PipelineSonarGetter -} - -func NewProjectPipelineHandler(devopsClient devopsClient.Interface, ksInformers externalversions.SharedInformerFactory, - authorizer authorizer.Authorizer) ProjectPipelineHandler { - return ProjectPipelineHandler{ - devopsOperator: devops.NewDevopsOperator(devopsClient, nil, nil, ksInformers, nil), - projectCredentialGetter: devops.NewProjectCredentialOperator(devopsClient), - authorizer: authorizer, - } -} - -func NewPipelineSonarHandler(devopsClient devopsClient.Interface, sonarClient sonarqube.SonarInterface) PipelineSonarHandler { - return PipelineSonarHandler{ - pipelineSonarGetter: devops.NewPipelineSonarGetter(devopsClient, sonarClient), - } -} - -func NewS2iBinaryHandler(client versioned.Interface, informers externalversions.SharedInformerFactory, s3Client s3.Interface) S2iBinaryHandler { - return S2iBinaryHandler{devops.NewS2iBinaryUploader(client, informers, s3Client)} -} diff --git a/pkg/kapis/devops/v1alpha2/pipeline_sonar.go b/pkg/kapis/devops/v1alpha2/pipeline_sonar.go deleted file mode 100644 index 648d43ee9..000000000 --- a/pkg/kapis/devops/v1alpha2/pipeline_sonar.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha2 - -import ( - "github.com/emicklei/go-restful" - "k8s.io/klog" - - "kubesphere.io/kubesphere/pkg/api" -) - -func (h PipelineSonarHandler) GetPipelineSonarStatusHandler(request *restful.Request, resp *restful.Response) { - projectId := request.PathParameter("devops") - pipelineId := request.PathParameter("pipeline") - sonarStatus, err := h.pipelineSonarGetter.GetPipelineSonar(projectId, pipelineId) - if err != nil { - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - resp.WriteAsJson(sonarStatus) -} - -func (h PipelineSonarHandler) GetMultiBranchesPipelineSonarStatusHandler(request *restful.Request, resp *restful.Response) { - projectId := request.PathParameter("devops") - pipelineId := request.PathParameter("pipeline") - branchId := request.PathParameter("branch") - sonarStatus, err := h.pipelineSonarGetter.GetMultiBranchPipelineSonar(projectId, pipelineId, branchId) - if err != nil { - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - resp.WriteAsJson(sonarStatus) -} diff --git a/pkg/kapis/devops/v1alpha2/register.go b/pkg/kapis/devops/v1alpha2/register.go index a06fdbd6d..3bc472f9c 100644 --- a/pkg/kapis/devops/v1alpha2/register.go +++ b/pkg/kapis/devops/v1alpha2/register.go @@ -17,745 +17,23 @@ limitations under the License. package v1alpha2 import ( - "context" - "fmt" - "net/url" - "strings" - "github.com/emicklei/go-restful" - restfulspec "github.com/emicklei/go-restful-openapi" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/proxy" - "k8s.io/klog" - devopsv1alpha1 "kubesphere.io/api/devops/v1alpha1" - - "kubesphere.io/kubesphere/pkg/apiserver/authorization/authorizer" - "kubesphere.io/kubesphere/pkg/apiserver/runtime" - "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - "kubesphere.io/kubesphere/pkg/client/informers/externalversions" - "kubesphere.io/kubesphere/pkg/constants" - "kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins" - "kubesphere.io/kubesphere/pkg/simple/client/s3" - "kubesphere.io/kubesphere/pkg/simple/client/sonarqube" - - "net/http" - - "kubesphere.io/kubesphere/pkg/simple/client/devops" + "kubesphere.io/kubesphere/pkg/kapis/generic" ) const ( GroupName = "devops.kubesphere.io" - RespOK = "ok" ) var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} -func AddToContainer(container *restful.Container, ksInformers externalversions.SharedInformerFactory, devopsClient devops.Interface, - sonarqubeClient sonarqube.SonarInterface, ksClient versioned.Interface, s3Client s3.Interface, endpoint string, - authorizer authorizer.Authorizer) error { - ws := runtime.NewWebService(GroupVersion) - - err := AddPipelineToWebService(ws, devopsClient, ksInformers, authorizer) +func AddToContainer(container *restful.Container, endpoint string) error { + proxy, err := generic.NewGenericProxy(endpoint, GroupVersion.Group, GroupVersion.Version) if err != nil { return err } - err = AddSonarToWebService(ws, devopsClient, sonarqubeClient) - if err != nil { - return err - } - - err = AddS2IToWebService(ws, ksClient, ksInformers, s3Client) - if err != nil { - return err - } - - err = AddJenkinsToContainer(ws, devopsClient, endpoint) - if err != nil { - return err - } - - container.Add(ws) - - return nil -} - -func AddPipelineToWebService(webservice *restful.WebService, devopsClient devops.Interface, ksInformers externalversions.SharedInformerFactory, - authorizer authorizer.Authorizer) error { - - projectPipelineEnable := devopsClient != nil - - if projectPipelineEnable { - projectPipelineHandler := NewProjectPipelineHandler(devopsClient, ksInformers, authorizer) - - webservice.Route(webservice.GET("/devops/{devops}/credentials/{credential}/usage"). - To(projectPipelineHandler.GetProjectCredentialUsage). - Doc("Get the specified credential usage of the DevOps project"). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsCredentialTag}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("credential", "credential's ID, e.g. dockerhub-id")). - Returns(http.StatusOK, RespOK, devops.Credential{})) - - // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}"). - To(projectPipelineHandler.GetPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get the specified pipeline of the DevOps project"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Returns(http.StatusOK, RespOK, devops.Pipeline{}). - Writes(devops.Pipeline{})) - - // match Jenkins api: "jenkins_api/blue/rest/search" - webservice.Route(webservice.GET("/search"). - To(projectPipelineHandler.ListPipelines). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Search DevOps resource. More info: https://github.com/jenkinsci/blueocean-plugin/tree/master/blueocean-rest#get-pipelines-across-organization"). - Param(webservice.QueryParameter("q", "query pipelines, condition for filtering."). - Required(true). - DataFormat("q=%s")). - Param(webservice.QueryParameter("filter", "Filter some types of jobs. e.g. no-folder,will not get a job of type folder"). - Required(false). - DataFormat("filter=%s")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "the limit item count of the search."). - Required(false). - DataFormat("limit=%d")). - Returns(http.StatusOK, RespOK, devops.PipelineList{}). - Writes(devops.PipelineList{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/{run}/ - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}"). - To(projectPipelineHandler.GetPipelineRun). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get details in the specified pipeline activity."). - Param(webservice.PathParameter("devops", "the name of devops project")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Returns(http.StatusOK, RespOK, devops.PipelineRun{}). - Writes(devops.PipelineRun{})) - - // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs"). - To(projectPipelineHandler.ListPipelineRuns). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get all runs of the specified pipeline"). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.QueryParameter("start", "the item number that the search starts from"). - Required(false). - DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "the limit item count of the search"). - Required(false). - DataFormat("limit=%d")). - Param(webservice.QueryParameter("branch", "the name of branch, same as repository branch, will be filtered by branch."). - Required(false). - DataFormat("branch=%s")). - Returns(http.StatusOK, RespOK, devops.PipelineRunList{}). - Writes(devops.PipelineRunList{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/runs/{run}/stop/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/runs/{run}/stop"). - To(projectPipelineHandler.StopPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Stop pipeline"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep."). - Required(false). - DataFormat("blocking=%t"). - DefaultValue("blocking=false")). - Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep."). - Required(false). - DataFormat("timeOutInSecs=%d"). - DefaultValue("timeOutInSecs=10")). - Returns(http.StatusOK, RespOK, devops.StopPipeline{}). - Writes(devops.StopPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/runs/{run}/Replay/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/runs/{run}/replay"). - To(projectPipelineHandler.ReplayPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Replay pipeline"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Returns(http.StatusOK, RespOK, devops.ReplayPipeline{}). - Writes(devops.ReplayPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/runs"). - To(projectPipelineHandler.RunPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Run pipeline."). - Reads(devops.RunPayload{}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Returns(http.StatusOK, RespOK, devops.RunPipeline{}). - Writes(devops.RunPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/{run}/artifacts - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/artifacts"). - To(projectPipelineHandler.GetArtifacts). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get all artifacts in the specified pipeline."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "the limit item count of the search."). - Required(false). - DataFormat("limit=%d")). - Returns(http.StatusOK, "The filed of \"Url\" in response can download artifacts", []devops.Artifacts{}). - Writes([]devops.Artifacts{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/{run}/log/?start=0 - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/log"). - To(projectPipelineHandler.GetRunLog). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get run logs of the specified pipeline activity."). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d"). - DefaultValue("start=0"))) - - // match "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/runs/{run}/nodes/{node}/steps/{step}/log/?start=0" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}/log"). - To(projectPipelineHandler.GetStepLog). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get pipelines step log."). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.PathParameter("node", "pipeline node ID, the stage in pipeline.")). - Param(webservice.PathParameter("step", "pipeline step ID, the step in pipeline.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d"). - DefaultValue("start=0"))) - - // match /blue/rest/organizations/jenkins/pipelines/%s/%s/runs/%s/nodes/%s/steps/?limit= - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps"). - To(projectPipelineHandler.GetNodeSteps). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get all steps in the specified node."). - Param(webservice.PathParameter("devops", "the name of devops project")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build")). - Param(webservice.PathParameter("node", "pipeline node ID, the stage in pipeline.")). - Returns(http.StatusOK, RespOK, []devops.NodeSteps{}). - Writes([]devops.NodeSteps{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/runs/{run}/nodes/?limit=10000 - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes"). - To(projectPipelineHandler.GetPipelineRunNodes). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get all nodes in the specified activity. node is the stage in the pipeline task"). - Param(webservice.PathParameter("devops", "the name of devops project")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build")). - Returns(http.StatusOK, RespOK, []devops.PipelineRunNodes{}). - Writes([]devops.PipelineRunNodes{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step} - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodes/{node}/steps/{step}"). - To(projectPipelineHandler.SubmitInputStep). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Proceed or Break the paused pipeline which is waiting for user input."). - Reads(devops.CheckPlayload{}). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.PathParameter("node", "pipeline node ID, the stage in pipeline.")). - Param(webservice.PathParameter("step", "pipeline step ID"))) - - // out of scm get all steps in nodes. - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/runs/{run}/nodesdetail"). - To(projectPipelineHandler.GetNodesDetail). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get steps details inside a activity node. For a node, the steps which defined inside the node."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Returns(http.StatusOK, RespOK, []devops.NodesDetail{}). - Writes(devops.NodesDetail{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/branches/{branch} - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}"). - To(projectPipelineHandler.GetBranchPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get the specified branch pipeline of the DevOps project"). - Param(webservice.PathParameter("devops", "the name of devops project")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch")). - Returns(http.StatusOK, RespOK, devops.BranchPipeline{}). - Writes(devops.BranchPipeline{})) - - // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{branch}/runs/{run}/" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}"). - To(projectPipelineHandler.GetBranchPipelineRun). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get details in the specified pipeline activity."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run id, the unique id for a pipeline once build.")). - Returns(http.StatusOK, RespOK, devops.PipelineRun{}). - Writes(devops.PipelineRun{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/stop/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/stop"). - To(projectPipelineHandler.StopBranchPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Stop the specified pipeline of the DevOps project."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep."). - Required(false). - DataFormat("blocking=%t"). - DefaultValue("blocking=false")). - Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep."). - Required(false). - DataFormat("timeOutInSecs=%d"). - DefaultValue("timeOutInSecs=10")). - Returns(http.StatusOK, RespOK, devops.StopPipeline{}). - Writes(devops.StopPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/Replay/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/replay"). - To(projectPipelineHandler.ReplayBranchPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Replay the specified pipeline of the DevOps project"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Returns(http.StatusOK, RespOK, devops.ReplayPipeline{}). - Writes(devops.ReplayPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{}/runs/ - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs"). - To(projectPipelineHandler.RunBranchPipeline). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Run the specified pipeline of the DevOps project."). - Reads(devops.RunPayload{}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Returns(http.StatusOK, RespOK, devops.RunPipeline{}). - Writes(devops.RunPipeline{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{branch}/runs/{run}/artifacts - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/artifacts"). - To(projectPipelineHandler.GetBranchArtifacts). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get all artifacts generated from the specified run of the pipeline branch."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "the limit item count of the search."). - Required(false). - DataFormat("limit=%d")). - Returns(http.StatusOK, "The filed of \"Url\" in response can download artifacts", []devops.Artifacts{}). - Writes([]devops.Artifacts{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{branch}/runs/{run}/log/?start=0 - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/log"). - To(projectPipelineHandler.GetBranchRunLog). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get run logs of the specified pipeline activity."). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d"). - DefaultValue("start=0"))) - - // match "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step}/log/?start=0" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step}/log"). - To(projectPipelineHandler.GetBranchStepLog). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get the step logs in the specified pipeline activity."). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run id, the unique id for a pipeline once build.")). - Param(webservice.PathParameter("node", "pipeline node id, the stage in pipeline.")). - Param(webservice.PathParameter("step", "pipeline step id, the step in pipeline.")). - Param(webservice.QueryParameter("start", "the item number that the search starts from."). - Required(false). - DataFormat("start=%d"). - DefaultValue("start=0"))) - - // match /blue/rest/organizations/jenkins/pipelines/%s/%s/branches/%s/runs/%s/nodes/%s/steps/?limit= - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps"). - To(projectPipelineHandler.GetBranchNodeSteps). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get all steps in the specified node."). - Param(webservice.PathParameter("devops", "the name of devops project")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.PathParameter("node", "pipeline node ID, the stage in pipeline.")). - Returns(http.StatusOK, RespOK, []devops.NodeSteps{}). - Writes([]devops.NodeSteps{})) - - // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/{branch}/runs/{run}/nodes" - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes"). - To(projectPipelineHandler.GetBranchPipelineRunNodes). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get run nodes."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run id, the unique id for a pipeline once build.")). - Param(webservice.QueryParameter("limit", "the limit item count of the search."). - Required(false). - DataFormat("limit=%d"). - DefaultValue("limit=10000")). - Returns(http.StatusOK, RespOK, []devops.BranchPipelineRunNodes{}). - Writes([]devops.BranchPipelineRunNodes{})) - - // /blue/rest/organizations/jenkins/pipelines/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step} - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodes/{node}/steps/{step}"). - To(projectPipelineHandler.SubmitBranchInputStep). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Proceed or Break the paused pipeline which waiting for user input."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Param(webservice.PathParameter("node", "pipeline node ID, the stage in pipeline.")). - Param(webservice.PathParameter("step", "pipeline step ID, the step in pipeline.")). - Reads(devops.CheckPlayload{}). - Produces("text/plain; charset=utf-8")) - - // in scm get all steps in nodes. - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/runs/{run}/nodesdetail"). - To(projectPipelineHandler.GetBranchNodesDetail). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get steps details in an activity node. For a node, the steps which is defined inside the node."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.PathParameter("branch", "the name of branch, same as repository branch.")). - Param(webservice.PathParameter("run", "pipeline run ID, the unique ID for a pipeline once build.")). - Returns(http.StatusOK, RespOK, []devops.NodesDetail{}). - Writes(devops.NodesDetail{})) - - // match /blue/rest/organizations/jenkins/pipelines/{devops}/{pipeline}/branches/?filter=&start&limit= - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches"). - To(projectPipelineHandler.GetPipelineBranch). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("(MultiBranchesPipeline) Get all branches in the specified pipeline."). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.QueryParameter("filter", "filter remote scm. e.g. origin"). - Required(false). - DataFormat("filter=%s")). - Param(webservice.QueryParameter("start", "the count of branches start."). - Required(false). - DataFormat("start=%d").DefaultValue("start=0")). - Param(webservice.QueryParameter("limit", "the count of branches limit."). - Required(false). - DataFormat("limit=%d").DefaultValue("limit=100")). - Returns(http.StatusOK, RespOK, []devops.PipelineBranch{}). - Writes([]devops.PipelineBranch{})) - - // match /job/{devops}/job/{pipeline}/build?delay=0 - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/scan"). - To(projectPipelineHandler.ScanBranch). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Scan remote Repository, Start a build if have new branch."). - Produces("text/html; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline")). - Param(webservice.QueryParameter("delay", "the delay time to scan").Required(false).DataFormat("delay=%d"))) - - // match /job/project-8QnvykoJw4wZ/job/test-1/indexing/consoleText - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/consolelog"). - To(projectPipelineHandler.GetConsoleLog). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get scan reponsitory logs in the specified pipeline."). - Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline"))) - - // match /crumbIssuer/api/json/ - webservice.Route(webservice.GET("/crumbissuer"). - To(projectPipelineHandler.GetCrumb). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Doc("Get crumb issuer. A CrumbIssuer represents an algorithm to generate a nonce value, known as a crumb, to counter cross site request forgery exploits. Crumbs are typically hashes incorporating information that uniquely identifies an agent that sends a request, along with a guarded secret so that the crumb value cannot be forged by a third party."). - Returns(http.StatusOK, RespOK, devops.Crumb{}). - Writes(devops.Crumb{})) - - // match "/blue/rest/organizations/jenkins/scm/%s/servers/" - webservice.Route(webservice.GET("/scms/{scm}/servers"). - To(projectPipelineHandler.GetSCMServers). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}). - Doc("List all servers in the jenkins."). - Param(webservice.PathParameter("scm", "The ID of the source configuration management (SCM).")). - Returns(http.StatusOK, RespOK, []devops.SCMServer{}). - Writes([]devops.SCMServer{})) - - // match "/blue/rest/organizations/jenkins/scm/{scm}/organizations/?credentialId=github" - webservice.Route(webservice.GET("/scms/{scm}/organizations"). - To(projectPipelineHandler.GetSCMOrg). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}). - Doc("List all organizations of the specified source configuration management (SCM) such as Github."). - Param(webservice.PathParameter("scm", "the ID of the source configuration management (SCM).")). - Param(webservice.QueryParameter("credentialId", "credential ID for source configuration management (SCM).").Required(true).DataFormat("credentialId=%s")). - Returns(http.StatusOK, RespOK, []devops.SCMOrg{}). - Writes([]devops.SCMOrg{})) - - // match "/blue/rest/organizations/jenkins/scm/{scm}/organizations/{organization}/repositories/?credentialId=&pageNumber&pageSize=" - webservice.Route(webservice.GET("/scms/{scm}/organizations/{organization}/repositories"). - To(projectPipelineHandler.GetOrgRepo). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}). - Doc("List all repositories in the specified organization."). - Param(webservice.PathParameter("scm", "The ID of the source configuration management (SCM).")). - Param(webservice.PathParameter("organization", "organization ID, such as github username.")). - Param(webservice.QueryParameter("credentialId", "credential ID for SCM.").Required(true).DataFormat("credentialId=%s")). - Param(webservice.QueryParameter("pageNumber", "page number.").Required(true).DataFormat("pageNumber=%d")). - Param(webservice.QueryParameter("pageSize", "the item count of one page.").Required(true).DataFormat("pageSize=%d")). - Returns(http.StatusOK, RespOK, devops.OrgRepo{}). - Writes(devops.OrgRepo{})) - - // match "/blue/rest/organizations/jenkins/scm/%s/servers/" create bitbucket server - webservice.Route(webservice.POST("/scms/{scm}/servers"). - To(projectPipelineHandler.CreateSCMServers). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}). - Doc("Create scm server if it does not exist in the Jenkins."). - Param(webservice.PathParameter("scm", "The ID of the source configuration management (SCM).")). - Reads(devops.CreateScmServerReq{}). - Returns(http.StatusOK, RespOK, devops.SCMServer{}). - Writes(devops.SCMServer{})) - - // match "/blue/rest/organizations/jenkins/scm/github/validate/" - webservice.Route(webservice.POST("/scms/{scm}/verify"). - To(projectPipelineHandler.Validate). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsScmTag}). - Doc("Validate the access token of the specified source configuration management (SCM) such as Github"). - Param(webservice.PathParameter("scm", "the ID of the source configuration management (SCM).")). - Returns(http.StatusOK, RespOK, devops.Validates{}). - Writes(devops.Validates{})) - - // match /git/notifyCommit/?url= - webservice.Route(webservice.GET("/webhook/git"). - To(projectPipelineHandler.GetNotifyCommit). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsWebhookTag}). - Doc("Get commit notification by HTTP GET method. Git webhook will request here."). - Produces("text/plain; charset=utf-8"). - Param(webservice.QueryParameter("url", "Git url").Required(true).DataFormat("url=%s"))) - - // Gitlab or some other scm managers can only use HTTP method. match /git/notifyCommit/?url= - webservice.Route(webservice.POST("/webhook/git"). - To(projectPipelineHandler.PostNotifyCommit). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsWebhookTag}). - Doc("Get commit notification by HTTP POST method. Git webhook will request here."). - Consumes("application/json"). - Produces("text/plain; charset=utf-8"). - Param(webservice.QueryParameter("url", "Git url").Required(true).DataFormat("url=%s"))) - - webservice.Route(webservice.POST("/webhook/github"). - To(projectPipelineHandler.GithubWebhook). - Consumes("application/x-www-form-urlencoded", "application/json"). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsWebhookTag}). - Doc("Get commit notification. Github webhook will request here.")) - - webservice.Route(webservice.POST("/devops/{devops}/pipelines/{pipeline}/checkScriptCompile"). - To(projectPipelineHandler.CheckScriptCompile). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of the CI/CD pipeline").DataFormat("pipeline=%s")). - Consumes("application/x-www-form-urlencoded", "charset=utf-8"). - Produces("application/json", "charset=utf-8"). - Doc("Check pipeline script compile."). - Reads(devops.ReqScript{}). - Returns(http.StatusOK, RespOK, devops.CheckScript{}). - Writes(devops.CheckScript{})) - - webservice.Route(webservice.POST("/devops/{devops}/checkCron"). - To(projectPipelineHandler.CheckCron). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Produces("application/json", "charset=utf-8"). - Doc("Check cron script compile."). - Reads(devops.CronData{}). - Returns(http.StatusOK, RespOK, devops.CheckCronRes{}). - Writes(devops.CheckCronRes{})) - - // match /pipeline-model-converter/toJenkinsfile - webservice.Route(webservice.POST("/tojenkinsfile"). - To(projectPipelineHandler.ToJenkinsfile). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsJenkinsfileTag}). - Consumes("application/x-www-form-urlencoded"). - Produces("application/json", "charset=utf-8"). - Doc("Convert json to jenkinsfile format."). - Reads(devops.ReqJson{}). - Returns(http.StatusOK, RespOK, devops.ResJenkinsfile{}). - Writes(devops.ResJenkinsfile{})) - - // match /pipeline-model-converter/toJson - /* - * Considering the following reasons, we use a generic data struct here. - * - A fixed go struct might need to change again once Jenkins has new features. - * - No refer requirement for the specific data struct - * Please read the official document if you want to know more details - * https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/fc8d22192d7d3a17badc3b8af7191a84bb7fd4ca/EXTENDING.md#conversion-to-json-representation-from-jenkinsfile - */ - webservice.Route(webservice.POST("/tojson"). - To(projectPipelineHandler.ToJson). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsJenkinsfileTag}). - Consumes("application/x-www-form-urlencoded"). - Produces("application/json", "charset=utf-8"). - Doc("Convert jenkinsfile to json format. Usually the frontend uses json to show or edit pipeline"). - Reads(devops.ReqJenkinsfile{}). - Returns(http.StatusOK, RespOK, map[string]interface{}{}). - Writes(map[string]interface{}{})) - } - return nil -} - -func AddSonarToWebService(webservice *restful.WebService, devopsClient devops.Interface, sonarClient sonarqube.SonarInterface) error { - sonarEnable := devopsClient != nil && sonarClient != nil - if sonarEnable { - sonarHandler := NewPipelineSonarHandler(devopsClient, sonarClient) - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/sonarstatus"). - To(sonarHandler.GetPipelineSonarStatusHandler). - Doc("Get the sonar quality information for the specified pipeline of the DevOps project. More info: https://docs.sonarqube.org/7.4/user-guide/metric-definitions/"). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of pipeline, e.g. sample-pipeline")). - Returns(http.StatusOK, RespOK, []sonarqube.SonarStatus{}). - Writes([]sonarqube.SonarStatus{})) - - webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipeline}/branches/{branch}/sonarstatus"). - To(sonarHandler.GetMultiBranchesPipelineSonarStatusHandler). - Doc("Get the sonar quality check information for the specified pipeline branch of the DevOps project. More info: https://docs.sonarqube.org/7.4/user-guide/metric-definitions/"). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag}). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - Param(webservice.PathParameter("pipeline", "the name of pipeline, e.g. sample-pipeline")). - Param(webservice.PathParameter("branch", "branch name, e.g. master")). - Returns(http.StatusOK, RespOK, []sonarqube.SonarStatus{}). - Writes([]sonarqube.SonarStatus{})) - } - return nil -} - -func AddS2IToWebService(webservice *restful.WebService, ksClient versioned.Interface, - ksInformer externalversions.SharedInformerFactory, s3Client s3.Interface) error { - s2iEnable := ksClient != nil && ksInformer != nil && s3Client != nil - - if s2iEnable { - s2iHandler := NewS2iBinaryHandler(ksClient, ksInformer, s3Client) - webservice.Route(webservice.PUT("/namespaces/{namespace}/s2ibinaries/{s2ibinary}/file"). - To(s2iHandler.UploadS2iBinaryHandler). - Consumes("multipart/form-data"). - Produces(restful.MIME_JSON). - Doc("Upload S2iBinary file"). - Param(webservice.PathParameter("namespace", "the name of namespaces")). - Param(webservice.PathParameter("s2ibinary", "the name of s2ibinary")). - Param(webservice.FormParameter("s2ibinary", "file to upload")). - Param(webservice.FormParameter("md5", "md5 of file")). - Returns(http.StatusOK, RespOK, devopsv1alpha1.S2iBinary{})) - - webservice.Route(webservice.GET("/namespaces/{namespace}/s2ibinaries/{s2ibinary}/file/{file}"). - To(s2iHandler.DownloadS2iBinaryHandler). - Produces(restful.MIME_OCTET). - Doc("Download S2iBinary file"). - Param(webservice.PathParameter("namespace", "the name of namespaces")). - Param(webservice.PathParameter("s2ibinary", "the name of s2ibinary")). - Param(webservice.PathParameter("file", "the name of binary file")). - Returns(http.StatusOK, RespOK, nil)) - } - return nil -} - -func AddJenkinsToContainer(webservice *restful.WebService, devopsClient devops.Interface, endpoint string) error { - if devopsClient == nil { - return nil - } - parse, err := url.Parse(endpoint) - if err != nil { - return err - } - parse.Path = strings.Trim(parse.Path, "/") - // this API does not belong any kind of auth scope, it should be removed in the future version - // see also pkg/apiserver/request/requestinfo.go - // Deprecated: Please use /devops/{devops}/jenkins/{path:*} instead - webservice.Route(webservice.GET("/jenkins/{path:*}"). - Param(webservice.PathParameter("path", "Path stands for any suffix path.")). - To(func(request *restful.Request, response *restful.Response) { - u := request.Request.URL - u.Host = parse.Host - u.Scheme = parse.Scheme - jenkins.SetBasicBearTokenHeader(&request.Request.Header) - u.Path = strings.Replace(request.Request.URL.Path, fmt.Sprintf("/kapis/%s/%s/jenkins", GroupVersion.Group, GroupVersion.Version), "", 1) - httpProxy := proxy.NewUpgradeAwareHandler(u, http.DefaultTransport, false, false, &errorResponder{}) - httpProxy.ServeHTTP(response, request.Request) - }). - Returns(http.StatusOK, RespOK, nil). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsJenkinsTag})) - - handlerWithDevOps := func(request *restful.Request, response *restful.Response) { - u := request.Request.URL - devops := request.PathParameter("devops") - u.Host = parse.Host - u.Scheme = parse.Scheme - jenkins.SetBasicBearTokenHeader(&request.Request.Header) - u.Path = strings.Replace(request.Request.URL.Path, fmt.Sprintf("/kapis/%s/%s/devops/%s/jenkins", - GroupVersion.Group, GroupVersion.Version, devops), "", 1) - httpProxy := proxy.NewUpgradeAwareHandler(u, http.DefaultTransport, false, false, &errorResponder{}) - httpProxy.ServeHTTP(response, request.Request) - } - // some Jenkins API against with POST method - webservice.Route(webservice.GET("/devops/{devops}/jenkins/{path:*}"). - Param(webservice.PathParameter("path", "Path stands for any suffix path.")). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - To(handlerWithDevOps). - Returns(http.StatusOK, RespOK, nil). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsJenkinsTag})) - webservice.Route(webservice.POST("/devops/{devops}/jenkins/{path:*}"). - Param(webservice.PathParameter("path", "Path stands for any suffix path.")). - Param(webservice.PathParameter("devops", "DevOps project's ID, e.g. project-RRRRAzLBlLEm")). - To(handlerWithDevOps). - Returns(http.StatusOK, RespOK, nil). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsJenkinsTag})) - return nil -} - -type pipelineParam struct { - Workspace string - ProjectName string - Name string - - Context context.Context -} - -type errorResponder struct{} - -func (e *errorResponder) Error(w http.ResponseWriter, req *http.Request, err error) { - klog.Error(err) + return proxy.AddToContainer(container) } diff --git a/pkg/kapis/devops/v1alpha2/s2ibinary.go b/pkg/kapis/devops/v1alpha2/s2ibinary.go deleted file mode 100644 index ac2aff78e..000000000 --- a/pkg/kapis/devops/v1alpha2/s2ibinary.go +++ /dev/null @@ -1,109 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha2 - -import ( - "fmt" - "net/http" - - "code.cloudfoundry.org/bytefmt" - "github.com/emicklei/go-restful" - "k8s.io/klog" - - "kubesphere.io/kubesphere/pkg/api" - "kubesphere.io/kubesphere/pkg/models/devops" - "kubesphere.io/kubesphere/pkg/utils/hashutil" -) - -type S2iBinaryHandler struct { - s2iUploader devops.S2iBinaryUploader -} - -func (h S2iBinaryHandler) UploadS2iBinaryHandler(req *restful.Request, resp *restful.Response) { - ns := req.PathParameter("namespace") - name := req.PathParameter("s2ibinary") - - err := req.Request.ParseMultipartForm(bytefmt.MEGABYTE * 20) - if err != nil { - klog.Errorf("%+v", err) - api.HandleBadRequest(resp, nil, err) - return - } - if len(req.Request.MultipartForm.File) == 0 { - err := restful.NewError(http.StatusBadRequest, "could not get file from form") - klog.Errorf("%+v", err) - api.HandleBadRequest(resp, nil, err) - return - } - if len(req.Request.MultipartForm.File["s2ibinary"]) == 0 { - err := restful.NewError(http.StatusBadRequest, "could not get file from form") - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - if len(req.Request.MultipartForm.File["s2ibinary"]) > 1 { - err := restful.NewError(http.StatusBadRequest, "s2ibinary should only have one file") - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - defer req.Request.MultipartForm.RemoveAll() - file, err := req.Request.MultipartForm.File["s2ibinary"][0].Open() - if err != nil { - klog.Error(err) - api.HandleInternalError(resp, nil, err) - return - } - filemd5, err := hashutil.GetMD5(file) - if err != nil { - klog.Error(err) - api.HandleInternalError(resp, nil, err) - return - } - md5, ok := req.Request.MultipartForm.Value["md5"] - if ok && len(req.Request.MultipartForm.Value["md5"]) > 0 { - if md5[0] != filemd5 { - err := restful.NewError(http.StatusBadRequest, fmt.Sprintf("md5 not match, origin: %+v, calculate: %+v", md5[0], filemd5)) - klog.Error(err) - api.HandleInternalError(resp, nil, err) - return - } - } - - s2ibin, err := h.s2iUploader.UploadS2iBinary(ns, name, filemd5, req.Request.MultipartForm.File["s2ibinary"][0]) - if err != nil { - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - resp.WriteAsJson(s2ibin) - -} - -func (h S2iBinaryHandler) DownloadS2iBinaryHandler(req *restful.Request, resp *restful.Response) { - ns := req.PathParameter("namespace") - name := req.PathParameter("s2ibinary") - fileName := req.PathParameter("file") - url, err := h.s2iUploader.DownloadS2iBinary(ns, name, fileName) - if err != nil { - klog.Errorf("%+v", err) - api.HandleInternalError(resp, nil, err) - return - } - http.Redirect(resp.ResponseWriter, req.Request, url, http.StatusFound) - return -} diff --git a/pkg/kapis/devops/v1alpha3/handler.go b/pkg/kapis/devops/v1alpha3/handler.go deleted file mode 100644 index 66e7c60ac..000000000 --- a/pkg/kapis/devops/v1alpha3/handler.go +++ /dev/null @@ -1,383 +0,0 @@ -/* -Copyright 2020 The KubeSphere Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha3 - -import ( - "github.com/emicklei/go-restful" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/client-go/informers" - "k8s.io/client-go/kubernetes" - "k8s.io/klog" - - "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/api" - "kubesphere.io/kubesphere/pkg/apiserver/query" - kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - "kubesphere.io/kubesphere/pkg/client/informers/externalversions" - "kubesphere.io/kubesphere/pkg/models/devops" - servererr "kubesphere.io/kubesphere/pkg/server/errors" - "kubesphere.io/kubesphere/pkg/server/params" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" -) - -type devopsHandler struct { - devops devops.DevopsOperator -} - -func newDevOpsHandler(devopsClient devopsClient.Interface, k8sclient kubernetes.Interface, ksclient kubesphere.Interface, - ksInformers externalversions.SharedInformerFactory, - k8sInformers informers.SharedInformerFactory) *devopsHandler { - - return &devopsHandler{ - devops: devops.NewDevopsOperator(devopsClient, k8sclient, ksclient, ksInformers, k8sInformers), - } -} - -// devopsproject handler about get/list/post/put/delete -func (h *devopsHandler) GetDevOpsProject(request *restful.Request, response *restful.Response) { - workspace := request.PathParameter("workspace") - devops := request.PathParameter("devops") - - project, err := h.devops.GetDevOpsProject(workspace, devops) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(project) -} - -func (h *devopsHandler) ListDevOpsProject(request *restful.Request, response *restful.Response) { - workspace := request.PathParameter("workspace") - limit, offset := params.ParsePaging(request) - - projectList, err := h.devops.ListDevOpsProject(workspace, limit, offset) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(projectList) -} - -func (h *devopsHandler) CreateDevOpsProject(request *restful.Request, response *restful.Response) { - workspace := request.PathParameter("workspace") - var devOpsProject v1alpha3.DevOpsProject - err := request.ReadEntity(&devOpsProject) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - created, err := h.devops.CreateDevOpsProject(workspace, &devOpsProject) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } else if errors.IsConflict(err) { - api.HandleConflict(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(created) -} - -func (h *devopsHandler) UpdateDevOpsProject(request *restful.Request, response *restful.Response) { - workspace := request.PathParameter("workspace") - var devOpsProject v1alpha3.DevOpsProject - err := request.ReadEntity(&devOpsProject) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - project, err := h.devops.UpdateDevOpsProject(workspace, &devOpsProject) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(project) -} - -func (h *devopsHandler) DeleteDevOpsProject(request *restful.Request, response *restful.Response) { - workspace := request.PathParameter("workspace") - devops := request.PathParameter("devops") - - err := h.devops.DeleteDevOpsProject(workspace, devops) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(servererr.None) -} - -// pipeline handler about get/list/post/put/delete -func (h *devopsHandler) GetPipeline(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - pipeline := request.PathParameter("pipeline") - - obj, err := h.devops.GetPipelineObj(devops, pipeline) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(obj) -} - -func (h *devopsHandler) ListPipeline(request *restful.Request, response *restful.Response) { - devopsProject := request.PathParameter("devops") - limit, offset := params.ParsePaging(request) - - objs, err := h.devops.ListPipelineObj(devopsProject, nil, nil, limit, offset) - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(objs) -} - -func (h *devopsHandler) CreatePipeline(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - var pipeline v1alpha3.Pipeline - err := request.ReadEntity(&pipeline) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - created, err := h.devops.CreatePipelineObj(devops, &pipeline) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(created) -} - -func (h *devopsHandler) UpdatePipeline(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - - var pipeline v1alpha3.Pipeline - err := request.ReadEntity(&pipeline) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - obj, err := h.devops.UpdatePipelineObj(devops, &pipeline) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(obj) -} - -func (h *devopsHandler) DeletePipeline(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - pipeline := request.PathParameter("pipeline") - - klog.V(8).Infof("ready to delete pipeline %s/%s", devops, pipeline) - err := h.devops.DeletePipelineObj(devops, pipeline) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(servererr.None) -} - -//credential handler about get/list/post/put/delete -func (h *devopsHandler) GetCredential(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - credential := request.PathParameter("credential") - - obj, err := h.devops.GetCredentialObj(devops, credential) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(obj) -} - -func (h *devopsHandler) ListCredential(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - query := query.ParseQueryParameter(request) - objs, err := h.devops.ListCredentialObj(devops, query) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(objs) -} - -func (h *devopsHandler) CreateCredential(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - var obj v1.Secret - err := request.ReadEntity(&obj) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - created, err := h.devops.CreateCredentialObj(devops, &obj) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(created) -} - -func (h *devopsHandler) UpdateCredential(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - var obj v1.Secret - err := request.ReadEntity(&obj) - - if err != nil { - klog.Error(err) - api.HandleBadRequest(response, request, err) - return - } - - updated, err := h.devops.UpdateCredentialObj(devops, &obj) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(updated) -} - -func (h *devopsHandler) DeleteCredential(request *restful.Request, response *restful.Response) { - devops := request.PathParameter("devops") - credential := request.PathParameter("credential") - - err := h.devops.DeleteCredentialObj(devops, credential) - - if err != nil { - klog.Error(err) - if errors.IsNotFound(err) { - api.HandleNotFound(response, request, err) - return - } - api.HandleBadRequest(response, request, err) - return - } - - response.WriteEntity(servererr.None) -} diff --git a/pkg/kapis/devops/v1alpha3/register.go b/pkg/kapis/devops/v1alpha3/register.go index 7e9deadf7..f496be6ba 100644 --- a/pkg/kapis/devops/v1alpha3/register.go +++ b/pkg/kapis/devops/v1alpha3/register.go @@ -19,173 +19,23 @@ package v1alpha3 import ( - "net/http" - "github.com/emicklei/go-restful" - restfulspec "github.com/emicklei/go-restful-openapi" - v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/informers" - "k8s.io/client-go/kubernetes" - "kubesphere.io/api/devops/v1alpha3" - - "kubesphere.io/kubesphere/pkg/api" - "kubesphere.io/kubesphere/pkg/apiserver/query" - "kubesphere.io/kubesphere/pkg/apiserver/runtime" - kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned" - "kubesphere.io/kubesphere/pkg/client/informers/externalversions" - "kubesphere.io/kubesphere/pkg/constants" - "kubesphere.io/kubesphere/pkg/server/params" - devopsClient "kubesphere.io/kubesphere/pkg/simple/client/devops" + "kubesphere.io/kubesphere/pkg/kapis/generic" ) const ( GroupName = "devops.kubesphere.io" - RespOK = "ok" ) var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha3"} -func AddToContainer(container *restful.Container, devopsClient devopsClient.Interface, - k8sclient kubernetes.Interface, ksclient kubesphere.Interface, - ksInformers externalversions.SharedInformerFactory, - k8sInformers informers.SharedInformerFactory) error { - devopsEnable := devopsClient != nil - if devopsEnable { - ws := runtime.NewWebService(GroupVersion) - handler := newDevOpsHandler(devopsClient, k8sclient, ksclient, ksInformers, k8sInformers) - // credential - ws.Route(ws.GET("/devops/{devops}/credentials"). - To(handler.ListCredential). - Param(ws.PathParameter("devops", "devops name")). - Param(ws.QueryParameter(query.ParameterName, "name used to do filtering").Required(false)). - Param(ws.QueryParameter(query.ParameterPage, "page").Required(false).DataFormat("page=%d").DefaultValue("page=1")). - Param(ws.QueryParameter(query.ParameterLimit, "limit").Required(false)). - Param(ws.QueryParameter(query.ParameterAscending, "sort parameters, e.g. ascending=false").Required(false).DefaultValue("ascending=false")). - Param(ws.QueryParameter(query.ParameterOrderBy, "sort parameters, e.g. orderBy=createTime")). - Doc("list the credentials of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.POST("/devops/{devops}/credentials"). - To(handler.CreateCredential). - Param(ws.PathParameter("devops", "devops name")). - Doc("create the credential of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.Pipeline{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.GET("/devops/{devops}/credentials/{credential}"). - To(handler.GetCredential). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("credential", "pipeline name")). - Doc("get the credential of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.PUT("/devops/{devops}/credentials/{credential}"). - To(handler.UpdateCredential). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("credential", "credential name")). - Doc("put the credential of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.DELETE("/devops/{devops}/credentials/{credential}"). - To(handler.DeleteCredential). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("credential", "credential name")). - Doc("delete the credential of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1.Secret{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag})) - - // pipeline - ws.Route(ws.GET("/devops/{devops}/pipelines"). - To(handler.ListPipeline). - Param(ws.PathParameter("devops", "devops name")). - Param(ws.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1"). - Required(false). - DataFormat("limit=%d,page=%d"). - DefaultValue("limit=10,page=1")). - Doc("list the pipelines of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.POST("/devops/{devops}/pipelines"). - To(handler.CreatePipeline). - Param(ws.PathParameter("devops", "devops name")). - Doc("create the pipeline of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.Pipeline{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.GET("/devops/{devops}/pipelines/{pipeline}"). - To(handler.GetPipeline). - Operation("getPipelineByName"). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("pipeline", "pipeline name")). - Doc("get the pipeline of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.Pipeline{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.PUT("/devops/{devops}/pipelines/{pipeline}"). - To(handler.UpdatePipeline). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("pipeline", "pipeline name")). - Doc("put the pipeline of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.Pipeline{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.DELETE("/devops/{devops}/pipelines/{pipeline}"). - To(handler.DeletePipeline). - Param(ws.PathParameter("devops", "project name")). - Param(ws.PathParameter("pipeline", "pipeline name")). - Doc("delete the pipeline of the specified devops for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.Pipeline{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsPipelineTag})) - - // devops - ws.Route(ws.GET("/workspaces/{workspace}/devops"). - To(handler.ListDevOpsProject). - Param(ws.PathParameter("workspace", "workspace name")). - Param(ws.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1"). - Required(false). - DataFormat("limit=%d,page=%d"). - DefaultValue("limit=10,page=1")).Doc("List the devopsproject of the specified workspace for the current user"). - Returns(http.StatusOK, api.StatusOK, api.ListResult{Items: []interface{}{}}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.POST("/workspaces/{workspace}/devops"). - To(handler.CreateDevOpsProject). - Param(ws.PathParameter("workspace", "workspace name")). - Doc("Create the devopsproject of the specified workspace for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.DevOpsProject{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.GET("/workspaces/{workspace}/devops/{devops}"). - To(handler.GetDevOpsProject). - Param(ws.PathParameter("workspace", "workspace name")). - Param(ws.PathParameter("devops", "project name")). - Doc("Get the devopsproject of the specified workspace for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.DevOpsProject{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.PUT("/workspaces/{workspace}/devops/{devops}"). - To(handler.UpdateDevOpsProject). - Param(ws.PathParameter("workspace", "workspace name")). - Param(ws.PathParameter("devops", "project name")). - Doc("Put the devopsproject of the specified workspace for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.DevOpsProject{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - ws.Route(ws.DELETE("/workspaces/{workspace}/devops/{devops}"). - To(handler.DeleteDevOpsProject). - Param(ws.PathParameter("workspace", "workspace name")). - Param(ws.PathParameter("devops", "project name")). - Doc("Get the devopsproject of the specified workspace for the current user"). - Returns(http.StatusOK, api.StatusOK, []v1alpha3.DevOpsProject{}). - Metadata(restfulspec.KeyOpenAPITags, []string{constants.DevOpsProjectTag})) - - container.Add(ws) +func AddToContainer(container *restful.Container, endpoint string) error { + proxy, err := generic.NewGenericProxy(endpoint, GroupVersion.Group, GroupVersion.Version) + if err != nil { + return err } - return nil + + return proxy.AddToContainer(container) } diff --git a/pkg/simple/client/devops/jenkins/options.go b/pkg/simple/client/devops/jenkins/options.go index 451a600d5..8532961c2 100644 --- a/pkg/simple/client/devops/jenkins/options.go +++ b/pkg/simple/client/devops/jenkins/options.go @@ -29,6 +29,7 @@ type Options struct { Username string `json:",omitempty" yaml:"username" description:"Jenkins admin username"` Password string `json:",omitempty" yaml:"password" description:"Jenkins admin password"` MaxConnections int `json:"maxConnections,omitempty" yaml:"maxConnections" description:"Maximum connections allowed to connect to Jenkins"` + Endpoint string `json:"endpoint,omitempty" yaml:"endpoint" description:"The endpoint of the ks-devops apiserver"` } // NewDevopsOptions returns a `zero` instance diff --git a/tools/cmd/doc-gen/main.go b/tools/cmd/doc-gen/main.go index 7abd3deb9..d4b60324b 100644 --- a/tools/cmd/doc-gen/main.go +++ b/tools/cmd/doc-gen/main.go @@ -59,9 +59,7 @@ import ( terminalv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/terminal/v1alpha2" "kubesphere.io/kubesphere/pkg/models/iam/group" "kubesphere.io/kubesphere/pkg/simple/client/alerting" - fakedevops "kubesphere.io/kubesphere/pkg/simple/client/devops/fake" "kubesphere.io/kubesphere/pkg/simple/client/k8s" - fakes3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake" ) var output string @@ -122,8 +120,8 @@ func generateSwaggerJson() []byte { urlruntime.Must(oauth.AddToContainer(container, nil, nil, nil, nil, nil, nil)) urlruntime.Must(clusterkapisv1alpha1.AddToContainer(container, informerFactory.KubernetesSharedInformerFactory(), informerFactory.KubeSphereSharedInformerFactory(), "", "", "")) - urlruntime.Must(devopsv1alpha2.AddToContainer(container, informerFactory.KubeSphereSharedInformerFactory(), &fakedevops.Devops{}, nil, clientsets.KubeSphere(), fakes3.NewFakeS3(), "", nil)) - urlruntime.Must(devopsv1alpha3.AddToContainer(container, &fakedevops.Devops{}, clientsets.Kubernetes(), clientsets.KubeSphere(), informerFactory.KubeSphereSharedInformerFactory(), informerFactory.KubernetesSharedInformerFactory())) + urlruntime.Must(devopsv1alpha2.AddToContainer(container, "")) + urlruntime.Must(devopsv1alpha3.AddToContainer(container, "")) urlruntime.Must(iamv1alpha2.AddToContainer(container, nil, nil, group.New(informerFactory, clientsets.KubeSphere(), clientsets.Kubernetes()), nil)) urlruntime.Must(monitoringv1alpha3.AddToContainer(container, clientsets.Kubernetes(), nil, nil, informerFactory, nil)) urlruntime.Must(openpitrixv1.AddToContainer(container, informerFactory, fake.NewSimpleClientset(), nil))