Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extensions.jobs #15581

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pkg/api/meta/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ var resourcesToCheck = map[schema.GroupResource]schema.GroupKind{
batch.Resource("jobtemplates"): batch.Kind("JobTemplate"),

// TODO do we still need this or is cronjob sufficient?
batch.Resource("scheduledjobs"): batch.Kind("ScheduledJob"),
batch.Resource("cronjobs"): batch.Kind("CronJob"),
extensions.Resource("deployments"): extensions.Kind("Deployment"),
extensions.Resource("replicasets"): extensions.Kind("ReplicaSet"),
extensions.Resource("jobs"): extensions.Kind("Job"),
extensions.Resource("jobtemplates"): extensions.Kind("JobTemplate"),
apps.Resource("statefulsets"): apps.Kind("StatefulSet"),
batch.Resource("scheduledjobs"): batch.Kind("ScheduledJob"),
batch.Resource("cronjobs"): batch.Kind("CronJob"),
extensions.Resource("deployments"): extensions.Kind("Deployment"),
extensions.Resource("replicasets"): extensions.Kind("ReplicaSet"),
apps.Resource("statefulsets"): apps.Kind("StatefulSet"),

deployapi.Resource("deploymentconfigs"): deployapi.Kind("DeploymentConfig"),
deployapi.LegacyResource("deploymentconfigs"): deployapi.LegacyKind("DeploymentConfig"),
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/server/bootstrappolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func GetOpenshiftBootstrapClusterRoles() []authorizationapi.ClusterRole {

authorizationapi.NewRule(readWrite...).Groups(batchGroup).Resources("jobs", "scheduledjobs", "cronjobs").RuleOrDie(),

authorizationapi.NewRule(readWrite...).Groups(extensionsGroup).Resources("jobs", "horizontalpodautoscalers", "replicationcontrollers/scale",
authorizationapi.NewRule(readWrite...).Groups(extensionsGroup).Resources("horizontalpodautoscalers", "replicationcontrollers/scale",
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback", "networkpolicies").RuleOrDie(),
authorizationapi.NewRule(read...).Groups(extensionsGroup).Resources("daemonsets").RuleOrDie(),

Expand Down Expand Up @@ -400,7 +400,7 @@ func GetOpenshiftBootstrapClusterRoles() []authorizationapi.ClusterRole {

authorizationapi.NewRule(readWrite...).Groups(batchGroup).Resources("jobs", "scheduledjobs", "cronjobs").RuleOrDie(),

authorizationapi.NewRule(readWrite...).Groups(extensionsGroup).Resources("jobs", "horizontalpodautoscalers", "replicationcontrollers/scale",
authorizationapi.NewRule(readWrite...).Groups(extensionsGroup).Resources("horizontalpodautoscalers", "replicationcontrollers/scale",
"replicasets", "replicasets/scale", "deployments", "deployments/scale", "deployments/rollback").RuleOrDie(),
authorizationapi.NewRule(read...).Groups(extensionsGroup).Resources("daemonsets").RuleOrDie(),

Expand Down Expand Up @@ -457,7 +457,7 @@ func GetOpenshiftBootstrapClusterRoles() []authorizationapi.ClusterRole {

authorizationapi.NewRule(read...).Groups(batchGroup).Resources("jobs", "scheduledjobs", "cronjobs").RuleOrDie(),

authorizationapi.NewRule(read...).Groups(extensionsGroup).Resources("jobs", "horizontalpodautoscalers", "replicasets", "replicasets/scale",
authorizationapi.NewRule(read...).Groups(extensionsGroup).Resources("horizontalpodautoscalers", "replicasets", "replicasets/scale",
"deployments", "deployments/scale").RuleOrDie(),
authorizationapi.NewRule(read...).Groups(extensionsGroup).Resources("daemonsets").RuleOrDie(),

Expand Down
1 change: 0 additions & 1 deletion pkg/cmd/server/kubernetes/master/master_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func BuildStorageFactory(masterConfig configapi.MasterConfig, server *kapiserver
}

// the order here is important, it defines which version will be used for storage
storageFactory.AddCohabitatingResources(batch.Resource("jobs"), extensions.Resource("jobs"))
// keep HPAs in the autoscaling apigroup (as in upstream 1.6), but keep extension cohabitation around until origin 3.7.
storageFactory.AddCohabitatingResources(autoscaling.Resource("horizontalpodautoscalers"), extensions.Resource("horizontalpodautoscalers"))
// keep Deployments in extensions for backwards compatibility, we'll have to migrate at some point, eventually
Expand Down
11 changes: 0 additions & 11 deletions pkg/cmd/util/clientcmd/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,6 @@ func (f *Factory) PodForResource(resource string, timeout time.Duration) (string
return "", err
}
return pod.Name, nil
case extensions.Resource("jobs"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabianofranz fyi, dangers of baking types into the CLI. This is going to hurt new oc against old server, but it was already broken/hurting

kc, err := f.ClientSet()
if err != nil {
return "", err
}
// TODO/REBASE kc.Extensions() doesn't exist any more. Is this ok?
job, err := kc.Batch().Jobs(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return "", err
}
return podNameForJob(job, kc, timeout, sortBy)
case batch.Resource("jobs"):
kc, err := f.ClientSet()
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/image/admission/imagepolicy/imagepolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,7 @@ func (config resolutionConfig) FailOnResolutionFailure(gr schema.GroupResource)

var skipImageRewriteOnUpdate = map[schema.GroupResource]struct{}{
// Job template specs are immutable, they cannot be updated.
{Group: "extensions", Resource: "jobs"}: {},
{Group: "batch", Resource: "jobs"}: {},
{Group: "batch", Resource: "jobs"}: {},
// Build specs are immutable, they cannot be updated.
{Group: "", Resource: "builds"}: {},
{Group: "build.openshift.io", Resource: "builds"}: {},
Expand Down
8 changes: 4 additions & 4 deletions pkg/image/admission/imagepolicy/imagepolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,10 +1049,10 @@ func TestResolutionConfig(t *testing.T) {
config: &api.ImagePolicyConfig{
ResolveImages: api.DoNotAttempt,
ResolutionRules: []api.ImageResolutionPolicyRule{
{LocalNames: true, TargetResource: metav1.GroupResource{Group: "extensions", Resource: "jobs"}},
{LocalNames: true, TargetResource: metav1.GroupResource{Group: "batch", Resource: "jobs"}},
},
},
resource: schema.GroupResource{Group: "extensions", Resource: "jobs"},
resource: schema.GroupResource{Group: "batch", Resource: "jobs"},
update: true,
resolve: true,
rewrite: false,
Expand All @@ -1063,10 +1063,10 @@ func TestResolutionConfig(t *testing.T) {
config: &api.ImagePolicyConfig{
ResolveImages: api.DoNotAttempt,
ResolutionRules: []api.ImageResolutionPolicyRule{
{LocalNames: true, TargetResource: metav1.GroupResource{Group: "extensions", Resource: "jobs"}},
{LocalNames: true, TargetResource: metav1.GroupResource{Group: "batch", Resource: "jobs"}},
},
},
resource: schema.GroupResource{Group: "extensions", Resource: "jobs"},
resource: schema.GroupResource{Group: "batch", Resource: "jobs"},
update: false,
resolve: true,
rewrite: true,
Expand Down
6 changes: 0 additions & 6 deletions pkg/scheduler/admission/podnodeconstraints/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ func TestPodNodeConstraintsResources(t *testing.T) {
groupresource: extensions.Resource("replicasets"),
prefix: "ReplicaSet",
},
{
resource: job,
kind: extensions.Kind("Job"),
groupresource: extensions.Resource("jobs"),
prefix: "Job",
},
{
resource: job,
kind: batch.Kind("Job"),
Expand Down
3 changes: 0 additions & 3 deletions test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ items:
- deployments/rollback
- deployments/scale
- horizontalpodautoscalers
- jobs
- networkpolicies
- replicasets
- replicasets/scale
Expand Down Expand Up @@ -1174,7 +1173,6 @@ items:
- deployments/rollback
- deployments/scale
- horizontalpodautoscalers
- jobs
- replicasets
- replicasets/scale
- replicationcontrollers/scale
Expand Down Expand Up @@ -1512,7 +1510,6 @@ items:
- deployments
- deployments/scale
- horizontalpodautoscalers
- jobs
- replicasets
- replicasets/scale
verbs:
Expand Down