From cd13c41ddec7ed31931823fefcaba68daaf69061 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Fri, 18 May 2018 18:22:15 -0700 Subject: [PATCH 1/2] Add GET PATCH support for two /status: apiservices/status under apiregistration.k8s.io certificatesigningrequests/status under certificates.k8s.io --- pkg/registry/certificates/certificates/storage/storage.go | 8 ++++++++ .../kube-aggregator/pkg/registry/apiservice/etcd/etcd.go | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/registry/certificates/certificates/storage/storage.go b/pkg/registry/certificates/certificates/storage/storage.go index 507269a72b..378c6f29a0 100644 --- a/pkg/registry/certificates/certificates/storage/storage.go +++ b/pkg/registry/certificates/certificates/storage/storage.go @@ -19,6 +19,7 @@ package storage import ( "context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/generic" genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" @@ -83,11 +84,18 @@ func (r *StatusREST) New() runtime.Object { return &certificates.CertificateSigningRequest{} } +// Get retrieves the object from the storage. It is required to support Patch. +func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { + return r.store.Get(ctx, name, options) +} + // Update alters the status subset of an object. func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) { return r.store.Update(ctx, name, objInfo, createValidation, updateValidation) } +var _ = rest.Patcher(&StatusREST{}) + // ApprovalREST implements the REST endpoint for changing the approval state of a CSR. type ApprovalREST struct { store *genericregistry.Store diff --git a/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/etcd.go b/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/etcd.go index 8eca6be0a2..c7c49072a3 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/etcd.go +++ b/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/etcd.go @@ -19,6 +19,7 @@ package etcd import ( "context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/generic" genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" @@ -66,12 +67,17 @@ type StatusREST struct { store *genericregistry.Store } -var _ = rest.Updater(&StatusREST{}) +var _ = rest.Patcher(&StatusREST{}) func (r *StatusREST) New() runtime.Object { return &apiregistration.APIService{} } +// Get retrieves the object from the storage. It is required to support Patch. +func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { + return r.store.Get(ctx, name, options) +} + // Update alters the status subset of an object. func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) { return r.store.Update(ctx, name, objInfo, createValidation, updateValidation) From 4e114fd65b57039b3f94edfb7565ef3fb6064be4 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Fri, 18 May 2018 18:41:57 -0700 Subject: [PATCH 2/2] generated --- api/openapi-spec/swagger.json | 246 ++++++++++++++++ .../certificates.k8s.io_v1beta1.json | 88 ++++++ .../v1beta1/operations.html | 266 +++++++++++++++++- .../v1beta1/definitions.html | 2 +- .../scheduling.k8s.io/v1beta1/operations.html | 2 +- .../certificates/certificates/storage/BUILD | 1 + .../pkg/registry/apiservice/etcd/BUILD | 1 + 7 files changed, 589 insertions(+), 17 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index ce0f8e8a7a..3bea4f40b8 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -20984,6 +20984,41 @@ ] }, "/apis/apiregistration.k8s.io/v1/apiservices/{name}/status": { + "get": { + "description": "read status of the specified APIService", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "apiregistration_v1" + ], + "operationId": "readApiregistrationV1APIServiceStatus", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "apiregistration.k8s.io", + "kind": "APIService", + "version": "v1" + } + }, "put": { "description": "replace status of the specified APIService", "consumes": [ @@ -21035,6 +21070,53 @@ "version": "v1" } }, + "patch": { + "description": "partially update status of the specified APIService", + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "apiregistration_v1" + ], + "operationId": "patchApiregistrationV1APIServiceStatus", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIService" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "apiregistration.k8s.io", + "kind": "APIService", + "version": "v1" + } + }, "parameters": [ { "uniqueItems": true, @@ -21793,6 +21875,41 @@ ] }, "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}/status": { + "get": { + "description": "read status of the specified APIService", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "apiregistration_v1beta1" + ], + "operationId": "readApiregistrationV1beta1APIServiceStatus", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1beta1.APIService" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "apiregistration.k8s.io", + "kind": "APIService", + "version": "v1beta1" + } + }, "put": { "description": "replace status of the specified APIService", "consumes": [ @@ -21844,6 +21961,53 @@ "version": "v1beta1" } }, + "patch": { + "description": "partially update status of the specified APIService", + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "apiregistration_v1beta1" + ], + "operationId": "patchApiregistrationV1beta1APIServiceStatus", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1beta1.APIService" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "apiregistration.k8s.io", + "kind": "APIService", + "version": "v1beta1" + } + }, "parameters": [ { "uniqueItems": true, @@ -44754,6 +44918,41 @@ ] }, "/apis/certificates.k8s.io/v1beta1/certificatesigningrequests/{name}/status": { + "get": { + "description": "read status of the specified CertificateSigningRequest", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "certificates_v1beta1" + ], + "operationId": "readCertificatesV1beta1CertificateSigningRequestStatus", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.api.certificates.v1beta1.CertificateSigningRequest" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "certificates.k8s.io", + "kind": "CertificateSigningRequest", + "version": "v1beta1" + } + }, "put": { "description": "replace status of the specified CertificateSigningRequest", "consumes": [ @@ -44805,6 +45004,53 @@ "version": "v1beta1" } }, + "patch": { + "description": "partially update status of the specified CertificateSigningRequest", + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "certificates_v1beta1" + ], + "operationId": "patchCertificatesV1beta1CertificateSigningRequestStatus", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.api.certificates.v1beta1.CertificateSigningRequest" + } + }, + "401": { + "description": "Unauthorized" + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "certificates.k8s.io", + "kind": "CertificateSigningRequest", + "version": "v1beta1" + } + }, "parameters": [ { "uniqueItems": true, diff --git a/api/swagger-spec/certificates.k8s.io_v1beta1.json b/api/swagger-spec/certificates.k8s.io_v1beta1.json index 01c34cfc03..45bfd31445 100644 --- a/api/swagger-spec/certificates.k8s.io_v1beta1.json +++ b/api/swagger-spec/certificates.k8s.io_v1beta1.json @@ -764,6 +764,45 @@ "path": "/apis/certificates.k8s.io/v1beta1/certificatesigningrequests/{name}/status", "description": "API at /apis/certificates.k8s.io/v1beta1", "operations": [ + { + "type": "v1beta1.CertificateSigningRequest", + "method": "GET", + "summary": "read status of the specified CertificateSigningRequest", + "nickname": "readCertificateSigningRequestStatus", + "parameters": [ + { + "type": "string", + "paramType": "query", + "name": "pretty", + "description": "If 'true', then the output is pretty printed.", + "required": false, + "allowMultiple": false + }, + { + "type": "string", + "paramType": "path", + "name": "name", + "description": "name of the CertificateSigningRequest", + "required": true, + "allowMultiple": false + } + ], + "responseMessages": [ + { + "code": 200, + "message": "OK", + "responseModel": "v1beta1.CertificateSigningRequest" + } + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "consumes": [ + "*/*" + ] + }, { "type": "v1beta1.CertificateSigningRequest", "method": "PUT", @@ -815,6 +854,55 @@ "consumes": [ "*/*" ] + }, + { + "type": "v1beta1.CertificateSigningRequest", + "method": "PATCH", + "summary": "partially update status of the specified CertificateSigningRequest", + "nickname": "patchCertificateSigningRequestStatus", + "parameters": [ + { + "type": "string", + "paramType": "query", + "name": "pretty", + "description": "If 'true', then the output is pretty printed.", + "required": false, + "allowMultiple": false + }, + { + "type": "v1.Patch", + "paramType": "body", + "name": "body", + "description": "", + "required": true, + "allowMultiple": false + }, + { + "type": "string", + "paramType": "path", + "name": "name", + "description": "name of the CertificateSigningRequest", + "required": true, + "allowMultiple": false + } + ], + "responseMessages": [ + { + "code": 200, + "message": "OK", + "responseModel": "v1beta1.CertificateSigningRequest" + } + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json" + ] } ] }, diff --git a/docs/api-reference/certificates.k8s.io/v1beta1/operations.html b/docs/api-reference/certificates.k8s.io/v1beta1/operations.html index fca601ec99..fff9fff02b 100755 --- a/docs/api-reference/certificates.k8s.io/v1beta1/operations.html +++ b/docs/api-reference/certificates.k8s.io/v1beta1/operations.html @@ -1549,6 +1549,117 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
+

read status of the specified CertificateSigningRequest

+
+
+
GET /apis/certificates.k8s.io/v1beta1/certificatesigningrequests/{name}/status
+
+
+
+

Parameters

+ ++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeNameDescriptionRequiredSchemaDefault

QueryParameter

pretty

If true, then the output is pretty printed.

false

string

PathParameter

name

name of the CertificateSigningRequest

true

string

+ +
+
+

Responses

+ +++++ + + + + + + + + + + + + + + +
HTTP CodeDescriptionSchema

200

success

v1beta1.CertificateSigningRequest

+ +
+
+

Consumes

+
+
    +
  • +

    /

    +
  • +
+
+
+
+

Produces

+
+
    +
  • +

    application/json

    +
  • +
  • +

    application/yaml

    +
  • +
  • +

    application/vnd.kubernetes.protobuf

    +
  • +
+
+
+
+

Tags

+
+
    +
  • +

    apiscertificates.k8s.iov1beta1

    +
  • +
+
+
+
+

replace status of the specified CertificateSigningRequest

@@ -1556,7 +1667,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Parameters

+

Parameters

@@ -1606,7 +1717,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Responses

+

Responses

@@ -1636,7 +1747,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Consumes

+

Consumes

  • @@ -1646,7 +1757,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Produces

+

Produces

  • @@ -1662,7 +1773,132 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Tags

+

Tags

+
+
    +
  • +

    apiscertificates.k8s.iov1beta1

    +
  • +
+
+
+ +
+

partially update status of the specified CertificateSigningRequest

+
+
+
PATCH /apis/certificates.k8s.io/v1beta1/certificatesigningrequests/{name}/status
+
+
+
+

Parameters

+
++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeNameDescriptionRequiredSchemaDefault

QueryParameter

pretty

If true, then the output is pretty printed.

false

string

BodyParameter

body

true

v1.Patch

PathParameter

name

name of the CertificateSigningRequest

true

string

+ +
+
+

Responses

+ +++++ + + + + + + + + + + + + + + +
HTTP CodeDescriptionSchema

200

success

v1beta1.CertificateSigningRequest

+ +
+
+

Consumes

+
+
    +
  • +

    application/json-patch+json

    +
  • +
  • +

    application/merge-patch+json

    +
  • +
  • +

    application/strategic-merge-patch+json

    +
  • +
+
+
+
+

Produces

+
+
    +
  • +

    application/json

    +
  • +
  • +

    application/yaml

    +
  • +
  • +

    application/vnd.kubernetes.protobuf

    +
  • +
+
+
+
+

Tags

  • @@ -1680,7 +1916,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Parameters

+

Parameters

@@ -1779,7 +2015,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Responses

+

Responses

@@ -1804,7 +2040,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Consumes

+

Consumes

  • @@ -1814,7 +2050,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Produces

+

Produces

  • @@ -1836,7 +2072,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Tags

+

Tags

  • @@ -1854,7 +2090,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Parameters

+

Parameters

@@ -1961,7 +2197,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Responses

+

Responses

@@ -1986,7 +2222,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Consumes

+

Consumes

  • @@ -1996,7 +2232,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Produces

+

Produces

  • @@ -2018,7 +2254,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-

Tags

+

Tags

  • diff --git a/docs/api-reference/scheduling.k8s.io/v1beta1/definitions.html b/docs/api-reference/scheduling.k8s.io/v1beta1/definitions.html index f1dd21bda9..4b8adef581 100755 --- a/docs/api-reference/scheduling.k8s.io/v1beta1/definitions.html +++ b/docs/api-reference/scheduling.k8s.io/v1beta1/definitions.html @@ -1368,7 +1368,7 @@ Examples:
diff --git a/docs/api-reference/scheduling.k8s.io/v1beta1/operations.html b/docs/api-reference/scheduling.k8s.io/v1beta1/operations.html index c70d1a259d..8c9c1566c9 100755 --- a/docs/api-reference/scheduling.k8s.io/v1beta1/operations.html +++ b/docs/api-reference/scheduling.k8s.io/v1beta1/operations.html @@ -1785,7 +1785,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
diff --git a/pkg/registry/certificates/certificates/storage/BUILD b/pkg/registry/certificates/certificates/storage/BUILD index 7889ede265..35113cdd6a 100644 --- a/pkg/registry/certificates/certificates/storage/BUILD +++ b/pkg/registry/certificates/certificates/storage/BUILD @@ -15,6 +15,7 @@ go_library( "//pkg/printers/internalversion:go_default_library", "//pkg/printers/storage:go_default_library", "//pkg/registry/certificates/certificates:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library", diff --git a/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/BUILD b/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/BUILD index ea90ecbf0e..9e051a3830 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/BUILD +++ b/staging/src/k8s.io/kube-aggregator/pkg/registry/apiservice/etcd/BUILD @@ -10,6 +10,7 @@ go_library( srcs = ["etcd.go"], importpath = "k8s.io/kube-aggregator/pkg/registry/apiservice/etcd", deps = [ + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library",