Skip to content

Commit 3f8bb1b

Browse files
authored
Merge pull request kubernetes#91685 from liggitt/csr-v1
CertificateSigningRequest v1 API
2 parents 3509b46 + a504445 commit 3f8bb1b

File tree

73 files changed

+6881
-685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+6881
-685
lines changed

api/openapi-spec/swagger.json

Lines changed: 2020 additions & 632 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/kazel_generated.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ tags_values_pkgs = {"openapi-gen": {
5353
"staging/src/k8s.io/api/batch/v1",
5454
"staging/src/k8s.io/api/batch/v1beta1",
5555
"staging/src/k8s.io/api/batch/v2alpha1",
56+
"staging/src/k8s.io/api/certificates/v1",
5657
"staging/src/k8s.io/api/certificates/v1beta1",
5758
"staging/src/k8s.io/api/coordination/v1",
5859
"staging/src/k8s.io/api/coordination/v1beta1",
@@ -132,6 +133,7 @@ tags_pkgs_values = {"openapi-gen": {
132133
"staging/src/k8s.io/api/batch/v1": ["true"],
133134
"staging/src/k8s.io/api/batch/v1beta1": ["true"],
134135
"staging/src/k8s.io/api/batch/v2alpha1": ["true"],
136+
"staging/src/k8s.io/api/certificates/v1": ["true"],
135137
"staging/src/k8s.io/api/certificates/v1beta1": ["true"],
136138
"staging/src/k8s.io/api/coordination/v1": ["true"],
137139
"staging/src/k8s.io/api/coordination/v1beta1": ["true"],

cmd/kube-apiserver/app/aggregator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
263263
{Group: "batch", Version: "v1"}: {group: 17400, version: 15},
264264
{Group: "batch", Version: "v1beta1"}: {group: 17400, version: 9},
265265
{Group: "batch", Version: "v2alpha1"}: {group: 17400, version: 9},
266+
{Group: "certificates.k8s.io", Version: "v1"}: {group: 17300, version: 15},
266267
{Group: "certificates.k8s.io", Version: "v1beta1"}: {group: 17300, version: 9},
267268
{Group: "networking.k8s.io", Version: "v1"}: {group: 17200, version: 15},
268269
{Group: "networking.k8s.io", Version: "v1beta1"}: {group: 17200, version: 9},

hack/lib/init.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ autoscaling/v2beta2 \
8080
batch/v1 \
8181
batch/v1beta1 \
8282
batch/v2alpha1 \
83+
certificates.k8s.io/v1 \
8384
certificates.k8s.io/v1beta1 \
8485
coordination.k8s.io/v1beta1 \
8586
coordination.k8s.io/v1 \

pkg/apis/certificates/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ filegroup(
3636
":package-srcs",
3737
"//pkg/apis/certificates/fuzzer:all-srcs",
3838
"//pkg/apis/certificates/install:all-srcs",
39+
"//pkg/apis/certificates/v1:all-srcs",
3940
"//pkg/apis/certificates/v1beta1:all-srcs",
4041
"//pkg/apis/certificates/validation:all-srcs",
4142
],

pkg/apis/certificates/install/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ go_library(
1212
deps = [
1313
"//pkg/api/legacyscheme:go_default_library",
1414
"//pkg/apis/certificates:go_default_library",
15+
"//pkg/apis/certificates/v1:go_default_library",
1516
"//pkg/apis/certificates/v1beta1:go_default_library",
1617
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
1718
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",

pkg/apis/certificates/install/install.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2424
"k8s.io/kubernetes/pkg/api/legacyscheme"
2525
"k8s.io/kubernetes/pkg/apis/certificates"
26+
v1 "k8s.io/kubernetes/pkg/apis/certificates/v1"
2627
"k8s.io/kubernetes/pkg/apis/certificates/v1beta1"
2728
)
2829

@@ -33,6 +34,8 @@ func init() {
3334
// Install registers the API group and adds types to a scheme
3435
func Install(scheme *runtime.Scheme) {
3536
utilruntime.Must(certificates.AddToScheme(scheme))
37+
utilruntime.Must(v1.AddToScheme(scheme))
3638
utilruntime.Must(v1beta1.AddToScheme(scheme))
37-
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion))
39+
// TODO(liggitt): prefer v1 in 1.20
40+
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1.SchemeGroupVersion))
3841
}

pkg/apis/certificates/v1/BUILD

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = [
6+
"conversion.go",
7+
"defaults.go",
8+
"doc.go",
9+
"helpers.go",
10+
"register.go",
11+
"zz_generated.conversion.go",
12+
"zz_generated.defaults.go",
13+
],
14+
importpath = "k8s.io/kubernetes/pkg/apis/certificates/v1",
15+
visibility = ["//visibility:public"],
16+
deps = [
17+
"//pkg/apis/certificates:go_default_library",
18+
"//pkg/apis/core:go_default_library",
19+
"//staging/src/k8s.io/api/certificates/v1:go_default_library",
20+
"//staging/src/k8s.io/api/core/v1:go_default_library",
21+
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
22+
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
23+
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
24+
],
25+
)
26+
27+
filegroup(
28+
name = "package-srcs",
29+
srcs = glob(["**"]),
30+
tags = ["automanaged"],
31+
visibility = ["//visibility:private"],
32+
)
33+
34+
filegroup(
35+
name = "all-srcs",
36+
srcs = [":package-srcs"],
37+
tags = ["automanaged"],
38+
visibility = ["//visibility:public"],
39+
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
import (
20+
"fmt"
21+
22+
"k8s.io/apimachinery/pkg/runtime"
23+
)
24+
25+
func addConversionFuncs(scheme *runtime.Scheme) error {
26+
// Add field conversion funcs.
27+
return scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.WithKind("CertificateSigningRequest"),
28+
func(label, value string) (string, string, error) {
29+
switch label {
30+
case "metadata.name",
31+
"spec.signerName":
32+
return label, value, nil
33+
default:
34+
return "", "", fmt.Errorf("field label not supported: %s", label)
35+
}
36+
},
37+
)
38+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
import (
20+
"k8s.io/apimachinery/pkg/runtime"
21+
)
22+
23+
func addDefaultingFuncs(scheme *runtime.Scheme) error {
24+
return RegisterDefaults(scheme)
25+
}

0 commit comments

Comments
 (0)