-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2119 from bskiba/add-v1
Add v1 VPA API
- Loading branch information
Showing
27 changed files
with
2,247 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: verticalpodautoscalers.autoscaling.k8s.io | ||
spec: | ||
group: autoscaling.k8s.io | ||
scope: Namespaced | ||
names: | ||
plural: verticalpodautoscalers | ||
singular: verticalpodautoscaler | ||
kind: VerticalPodAutoscaler | ||
shortNames: | ||
- vpa | ||
version: v1beta1 | ||
versions: | ||
- name: v1beta1 | ||
served: false | ||
storage: false | ||
- name: v1beta2 | ||
served: true | ||
storage: true | ||
- name: v1 | ||
served: true | ||
storage: false | ||
validation: | ||
# openAPIV3Schema is the schema for validating custom objects. | ||
openAPIV3Schema: | ||
properties: | ||
spec: | ||
required: [] | ||
properties: | ||
targetRef: | ||
type: object | ||
updatePolicy: | ||
properties: | ||
updateMode: | ||
type: string | ||
resourcePolicy: | ||
properties: | ||
containerPolicies: | ||
type: array | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: verticalpodautoscalercheckpoints.autoscaling.k8s.io | ||
spec: | ||
group: autoscaling.k8s.io | ||
scope: Namespaced | ||
names: | ||
plural: verticalpodautoscalercheckpoints | ||
singular: verticalpodautoscalercheckpoint | ||
kind: VerticalPodAutoscalerCheckpoint | ||
shortNames: | ||
- vpacheckpoint | ||
version: v1beta1 | ||
versions: | ||
- name: v1beta1 | ||
served: false | ||
storage: false | ||
- name: v1beta2 | ||
served: true | ||
storage: true | ||
- name: v1 | ||
served: true | ||
storage: false |
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
21 changes: 21 additions & 0 deletions
21
vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/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,21 @@ | ||
/* | ||
Copyright 2019 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. | ||
*/ | ||
|
||
// +k8s:deepcopy-gen=package,register | ||
|
||
// Package v1 contains definitions of Vertical Pod Autoscaler related objects. | ||
// +groupName=autoscaling.k8s.io | ||
package v1 |
58 changes: 58 additions & 0 deletions
58
vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/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,58 @@ | ||
/* | ||
Copyright 2019 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 ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: "autoscaling.k8s.io", 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 ( | ||
// SchemeBuilder points to a list of functions added to Scheme. | ||
SchemeBuilder runtime.SchemeBuilder | ||
localSchemeBuilder = &SchemeBuilder | ||
// AddToScheme applies all the stored functions to the scheme. | ||
AddToScheme = 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 api.Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&VerticalPodAutoscaler{}, | ||
&VerticalPodAutoscalerList{}, | ||
&VerticalPodAutoscalerCheckpoint{}, | ||
&VerticalPodAutoscalerCheckpointList{}, | ||
) | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
} |
Oops, something went wrong.