kubectl: API changes to support --subresource in kubectl

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>
Co-authored-by: Yuvaraj Kakaraparthi <kakaraparthy@vmware.com>
This commit is contained in:
Yuvaraj Kakaraparthi
2021-07-06 08:42:12 -07:00
committed by Madhav Jivrajani
parent 08bf54678e
commit 801c39b478
28 changed files with 437 additions and 2 deletions

View File

@@ -111,3 +111,7 @@ func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.Updat
func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
return r.store.GetResetFields()
}
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}

View File

@@ -164,6 +164,10 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
return r.store.GetResetFields()
}
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
// RollbackREST implements the REST endpoint for initiating the rollback of a deployment
type RollbackREST struct {
store *genericregistry.Store
@@ -322,6 +326,10 @@ func (r *ScaleREST) Update(ctx context.Context, name string, objInfo rest.Update
return newScale, false, nil
}
func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
return func(ctx context.Context, obj runtime.Object) error {
scale, err := scaleFromDeployment(obj.(*apps.Deployment))

View File

@@ -160,6 +160,10 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
return r.store.GetResetFields()
}
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
// ScaleREST implements a Scale for ReplicaSet.
type ScaleREST struct {
store *genericregistry.Store
@@ -224,6 +228,10 @@ func (r *ScaleREST) Update(ctx context.Context, name string, objInfo rest.Update
return newScale, false, err
}
func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
return func(ctx context.Context, obj runtime.Object) error {
scale, err := scaleFromReplicaSet(obj.(*apps.ReplicaSet))

View File

@@ -141,6 +141,10 @@ func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
return r.store.GetResetFields()
}
func (r *StatusREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
// Implement ShortNamesProvider
var _ rest.ShortNamesProvider = &REST{}
@@ -211,6 +215,10 @@ func (r *ScaleREST) Update(ctx context.Context, name string, objInfo rest.Update
return newScale, false, err
}
func (r *ScaleREST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
return r.store.ConvertToTable(ctx, object, tableOptions)
}
func toScaleCreateValidation(f rest.ValidateObjectFunc) rest.ValidateObjectFunc {
return func(ctx context.Context, obj runtime.Object) error {
scale, err := scaleFromStatefulSet(obj.(*apps.StatefulSet))