Skip to content

Commit 4aa3720

Browse files
Merge pull request #14676 from deads2k/agg-08-beta
update aggregator to match latest kube
2 parents 3cd55df + 3d93cfb commit 4aa3720

File tree

94 files changed

+4706
-4668
lines changed

Some content is hidden

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

94 files changed

+4706
-4668
lines changed

api/protobuf-spec/k8s_io_kubernetes_pkg_api_v1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_apps_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_authentication_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_authorization_v1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_authorization_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_autoscaling_v1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_autoscaling_v2alpha1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_batch_v1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_batch_v2alpha1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_certificates_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_extensions_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_imagepolicy_v1alpha1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_policy_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_rbac_v1alpha1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_rbac_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/protobuf-spec/k8s_io_kubernetes_pkg_apis_storage_v1beta1.proto

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/server/origin/aggregator.go

+65-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"net/http"
2626
"strings"
2727

28+
"github.com/golang/glog"
29+
2830
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2931
"k8s.io/apimachinery/pkg/labels"
3032
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -123,16 +125,74 @@ func createAggregatorServer(aggregatorConfig *aggregatorapiserver.Config, delega
123125
}
124126

125127
func makeAPIService(gv schema.GroupVersion) *apiregistration.APIService {
128+
apiServicePriority, ok := apiVersionPriorities[gv]
129+
if !ok {
130+
// if we aren't found, then we shouldn't register ourselves because it could result in a CRD group version
131+
// being permanently stuck in the APIServices list.
132+
glog.Infof("Skipping APIService creation for %v", gv)
133+
return nil
134+
}
126135
return &apiregistration.APIService{
127136
ObjectMeta: metav1.ObjectMeta{Name: gv.Version + "." + gv.Group},
128137
Spec: apiregistration.APIServiceSpec{
129-
Group: gv.Group,
130-
Version: gv.Version,
131-
Priority: 100,
138+
Group: gv.Group,
139+
Version: gv.Version,
140+
GroupPriorityMinimum: apiServicePriority.group,
141+
VersionPriority: apiServicePriority.version,
132142
},
133143
}
134144
}
135145

146+
type priority struct {
147+
group int32
148+
version int32
149+
}
150+
151+
// The proper way to resolve this letting the aggregator know the desired group and version-within-group order of the underlying servers
152+
// is to refactor the genericapiserver.DelegationTarget to include a list of priorities based on which APIs were installed.
153+
// This requires the APIGroupInfo struct to evolve and include the concept of priorities and to avoid mistakes, the core storage map there needs to be updated.
154+
// That ripples out every bit as far as you'd expect, so for 1.7 we'll include the list here instead of being built up during storage.
155+
var apiVersionPriorities = map[schema.GroupVersion]priority{
156+
{Group: "", Version: "v1"}: {group: 18000, version: 1},
157+
// extensions is above the rest for CLI compatibility, though the level of unqalified resource compatibility we
158+
// can reasonably expect seems questionable.
159+
{Group: "extensions", Version: "v1beta1"}: {group: 17900, version: 1},
160+
// to my knowledge, nothing below here collides
161+
{Group: "apps", Version: "v1beta1"}: {group: 17800, version: 1},
162+
{Group: "authentication.k8s.io", Version: "v1"}: {group: 17700, version: 15},
163+
{Group: "authentication.k8s.io", Version: "v1beta1"}: {group: 17700, version: 9},
164+
{Group: "authorization.k8s.io", Version: "v1"}: {group: 17600, version: 15},
165+
{Group: "authorization.k8s.io", Version: "v1beta1"}: {group: 17600, version: 9},
166+
{Group: "autoscaling", Version: "v1"}: {group: 17500, version: 15},
167+
{Group: "autoscaling", Version: "v2alpha1"}: {group: 17500, version: 9},
168+
{Group: "batch", Version: "v1"}: {group: 17400, version: 15},
169+
{Group: "batch", Version: "v2alpha1"}: {group: 17400, version: 9},
170+
{Group: "certificates.k8s.io", Version: "v1beta1"}: {group: 17300, version: 9},
171+
{Group: "networking.k8s.io", Version: "v1"}: {group: 17200, version: 15},
172+
{Group: "policy", Version: "v1beta1"}: {group: 17100, version: 9},
173+
{Group: "rbac.authorization.k8s.io", Version: "v1beta1"}: {group: 17000, version: 12},
174+
{Group: "rbac.authorization.k8s.io", Version: "v1alpha1"}: {group: 17000, version: 9},
175+
{Group: "settings.k8s.io", Version: "v1alpha1"}: {group: 16900, version: 9},
176+
{Group: "storage.k8s.io", Version: "v1"}: {group: 16800, version: 15},
177+
{Group: "storage.k8s.io", Version: "v1beta1"}: {group: 16800, version: 9},
178+
{Group: "apiextensions.k8s.io", Version: "v1beta1"}: {group: 16700, version: 9},
179+
180+
// arbitrarily starting openshift around 10000.
181+
// bump authorization above RBAC
182+
{Group: "authorization.openshift.io", Version: "v1"}: {group: 17050, version: 15},
183+
{Group: "build.openshift.io", Version: "v1"}: {group: 9900, version: 15},
184+
{Group: "apps.openshift.io", Version: "v1"}: {group: 9900, version: 15},
185+
{Group: "image.openshift.io", Version: "v1"}: {group: 9900, version: 15},
186+
{Group: "oauth.openshift.io", Version: "v1"}: {group: 9900, version: 15},
187+
{Group: "project.openshift.io", Version: "v1"}: {group: 9900, version: 15},
188+
{Group: "quota.openshift.io", Version: "v1"}: {group: 9900, version: 15},
189+
{Group: "route.openshift.io", Version: "v1"}: {group: 9900, version: 15},
190+
{Group: "network.openshift.io", Version: "v1"}: {group: 9900, version: 15},
191+
{Group: "security.openshift.io", Version: "v1"}: {group: 9900, version: 15},
192+
{Group: "template.openshift.io", Version: "v1"}: {group: 9900, version: 15},
193+
{Group: "user.openshift.io", Version: "v1"}: {group: 9900, version: 15},
194+
}
195+
136196
func apiServicesToRegister(delegateAPIServer genericapiserver.DelegationTarget, registration autoregister.AutoAPIServiceRegistration) []*apiregistration.APIService {
137197
apiServices := []*apiregistration.APIService{}
138198

@@ -154,14 +214,9 @@ func apiServicesToRegister(delegateAPIServer genericapiserver.DelegationTarget,
154214
}
155215

156216
apiService := makeAPIService(schema.GroupVersion{Group: tokens[2], Version: tokens[3]})
157-
158-
// TODO this is probably an indication that we need explicit and precise control over the discovery chain
159-
// but for now its a special case
160-
// apps has to come last for compatibility with 1.5 kubectl clients
161-
if apiService.Spec.Group == "apps" {
162-
apiService.Spec.Priority = 110
217+
if apiService == nil {
218+
continue
163219
}
164-
165220
registration.AddAPIServiceToSync(apiService)
166221
apiServices = append(apiServices, apiService)
167222
}

vendor/k8s.io/kubernetes/cmd/kube-apiserver/app/aggregator.go

+51-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/k8s.io/kubernetes/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)