Issue 1:
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.3", GitCommit:"4957b090e9a4f6a68b4a40375408fdc74a212260", GitTreeState:"clean", BuildDate:"2016-10-16T06:36:33Z", GoVersion:"go1.7.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.3", GitCommit:"4957b090e9a4f6a68b4a40375408fdc74a212260", GitTreeState:"clean", BuildDate:"2016-10-16T06:20:04Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

Cloud provider or hardware configuration: kops-deployed running on aws

OS (e.g. from /etc/os-release): debian

What happened: when I do kubectl -f apply my-scheduled-job.yml without that job being present, everything works ok, but when I apply an already existing job, I get a "no kind "ScheduledJob" is registered for version "batch/v1"".

If you are not able to reproduce it, I can provide my job, but it's a pretty straightforward one, not a lot of options

Issue 2:
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.):

Nope!

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.):

kubectl, apply, scheduledjob, batch/v1

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

BUG REPORT

Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.1", GitCommit:"33cf7b9acbb2cb7c9c72a10d6636321fb180b159", GitTreeState:"clean", BuildDate:"2016-10-10T18:19:49Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.1", GitCommit:"33cf7b9acbb2cb7c9c72a10d6636321fb180b159", GitTreeState:"clean", BuildDate:"2016-10-10T18:13:36Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

Cloud provider or hardware configuration: AWS

OS (e.g. from /etc/os-release): Debian GNU/Linux 8 (jessie)

Kernel (e.g. uname -a): Linux ip-172-20-61-42 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux

Install tools: kops

Others: n/a

What happened:

kubectl apply emits an error when applying changes to an existing ScheduledJob.

What you expected to happen:

kubectl apply should have successfully applied changes to the existing ScheduledJob.

How to reproduce it (as minimally and precisely as possible):

Given this ScheduledJob manifest:

# scheduledjob.yaml
# From http://kubernetes.io/docs/user-guide/scheduled-jobs/#creating-a-scheduled-job
apiVersion: batch/v2alpha1
kind: ScheduledJob
metadata:
name: hello
spec:
schedule: 0/1 * * * ?
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure

The first apply succeeds:

$ kubectl apply -f scheduledjob.yaml
scheduledjob "hello" created

The second one fails:

$ kubectl apply -f scheduledjob.yaml
error: error when applying patch:

to:
&{0xc8200bd740 0xc8202f8ee0 sandbox hello scheduledjob.yaml &ScheduledJob{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:hello,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{kubectl.kubernetes.io/last-applied-configuration: ,},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:ScheduledJobSpec{Schedule:0/1 * * * ?,StartingDeadlineSeconds:nil,ConcurrencyPolicy:,Suspend:nil,JobTemplate:JobTemplateSpec{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:JobSpec{Parallelism:nil,Completions:nil,ActiveDeadlineSeconds:nil,Selector:nil,ManualSelector:nil,Template:k8s_io_kubernetes_pkg_api_v1.PodTemplateSpec{ObjectMeta:ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:PodSpec{Volumes:[],Containers:[{hello busybox [] [/bin/sh -c date; echo Hello from the Kubernetes cluster] [] [] {map[] map[]} [] nil nil nil nil false false false}],RestartPolicy:OnFailure,TerminationGracePeriodSeconds:nil,ActiveDeadlineSeconds:nil,DNSPolicy:,NodeSelector:map[string]string{},ServiceAccountName:,DeprecatedServiceAccount:,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:nil,ImagePullSecrets:[],Hostname:,Subdomain:,},},},},},Status:ScheduledJobStatus{Active:[],LastScheduleTime:<nil>,},} &TypeMeta{Kind:,APIVersion:,} 12601558 false}
for: "scheduledjob.yaml": error when serializing current configuration from:
&TypeMeta{Kind:,APIVersion:,}
for: "scheduledjob.yaml": no kind "ScheduledJob" is registered for version "batch/v1"

Anything else do we need to know:

ScheduledJob is enabled on the apiserver via --runtime-config=batch/v2alpha1=true

first reported downstream at helm/helm#1408