forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPSTREAM: <carry>: Add host assignment plugin for CRD-based routes.
- Loading branch information
Showing
16 changed files
with
819 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
openshift-kube-apiserver/admission/route/apis/hostassignment/doc.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
|
||
// Package hostassignment is the internal version of the API. | ||
package hostassignment |
31 changes: 31 additions & 0 deletions
31
openshift-kube-apiserver/admission/route/apis/hostassignment/register.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package hostassignment | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var GroupVersion = schema.GroupVersion{Group: "route.openshift.io", Version: runtime.APIVersionInternal} | ||
|
||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind | ||
func Kind(kind string) schema.GroupKind { | ||
return GroupVersion.WithKind(kind).GroupKind() | ||
} | ||
|
||
// Resource takes an unqualified resource and returns back a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return GroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
Install = schemeBuilder.AddToScheme | ||
) | ||
|
||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(GroupVersion, | ||
&HostAssignmentAdmissionConfig{}, | ||
) | ||
return nil | ||
} |
17 changes: 17 additions & 0 deletions
17
openshift-kube-apiserver/admission/route/apis/hostassignment/types.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package hostassignment | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// HostAssignmentAdmissionConfig is the configuration for the the route host assignment plugin. | ||
type HostAssignmentAdmissionConfig struct { | ||
metav1.TypeMeta | ||
|
||
// domain is used to generate a default host name for a route when the | ||
// route's host name is empty. The generated host name will follow this | ||
// pattern: "<route-name>.<route-namespace>.<domain>". | ||
Domain string | ||
} |
5 changes: 5 additions & 0 deletions
5
openshift-kube-apiserver/admission/route/apis/hostassignment/v1/doc.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=k8s.io/kubernetes/openshift-kube-apiserver/admission/route/apis/hostassignment | ||
|
||
// Package v1 is the v1 version of the API. | ||
package v1 |
64 changes: 64 additions & 0 deletions
64
openshift-kube-apiserver/admission/route/apis/hostassignment/v1/register.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
Copyright The Kubernetes 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 v1 | ||
|
||
import ( | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// GroupName specifies the group name used to register the objects. | ||
const GroupName = "route.openshift.io" | ||
|
||
// GroupVersion specifies the group and the version used to register the objects. | ||
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1"} | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
// Deprecated: use GroupVersion instead. | ||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. | ||
SchemeBuilder runtime.SchemeBuilder | ||
localSchemeBuilder = &SchemeBuilder | ||
// Depreciated: use Install instead | ||
AddToScheme = localSchemeBuilder.AddToScheme | ||
Install = localSchemeBuilder.AddToScheme | ||
) | ||
|
||
func init() { | ||
// We only register manually written functions here. The registration of the | ||
// generated functions takes place in the generated files. The separation | ||
// makes the code compile even when the generated files are missing. | ||
localSchemeBuilder.Register(addKnownTypes) | ||
} | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&HostAssignmentAdmissionConfig{}, | ||
) | ||
// AddToGroupVersion allows the serialization of client types like ListOptions. | ||
v1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
17 changes: 17 additions & 0 deletions
17
openshift-kube-apiserver/admission/route/apis/hostassignment/v1/types.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// HostAssignmentAdmissionConfig is the configuration for the the route host assignment plugin. | ||
type HostAssignmentAdmissionConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// domain is used to generate a default host name for a route when the | ||
// route's host name is empty. The generated host name will follow this | ||
// pattern: "<route-name>.<route-namespace>.<domain>". | ||
Domain string `json:"domain"` | ||
} |
68 changes: 68 additions & 0 deletions
68
openshift-kube-apiserver/admission/route/apis/hostassignment/v1/zz_generated.conversion.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
openshift-kube-apiserver/admission/route/apis/hostassignment/v1/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
openshift-kube-apiserver/admission/route/apis/hostassignment/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.