Change:
<ins> /* Copyright 2020 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 common import ( "encoding/json" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/kubernetes/test/e2e/framework" "github.com/onsi/ginkgo" ) var _ = ginkgo.Describe("[sig-architecture] PodTemplates", func() { f := framework.NewDefaultFramework("podtemplate") ginkgo.It("should run the lifecycle of PodTemplates", func() { testNamespaceName := f.Namespace.Name podTemplateName := "nginx-pod-template-" + string(uuid.NewUUID()) // get a list of PodTemplates (in all namespaces to hit endpoint) podTemplateList, err := f.ClientSet.CoreV1().PodTemplates("").List(metav1.ListOptions{ LabelSelector: "podtemplate-static=true", }) framework.ExpectNoError(err, "failed to list all PodTemplates") framework.ExpectEqual(len(podTemplateList.Items), 0, "unable to find templates") // create a PodTemplate _, err = f.ClientSet.CoreV1().PodTemplates(testNamespaceName).Create(&v1.PodTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: podTemplateName, Labels: map[string]string{ "podtemplate-static": "true", }, }, Template: v1.PodTemplateSpec{ Spec: v1.PodSpec{ Containers: []v1.Container{ {Name: "nginx", Image: "nginx"}, }, }, }, }) framework.ExpectNoError(err, "failed to create PodTemplate") // get template podTemplateRead, err := f.ClientSet.CoreV1().PodTemplates(testNamespaceName).Get(podTemplateName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get created PodTemplate") framework.ExpectEqual(podTemplateRead.ObjectMeta.Name, podTemplateName) // patch template podTemplatePatch, err := json.Marshal(map[string]interface{}{ "metadata": map[string]interface{}{ "labels": map[string]string{ "podtemplate": "patched", }, }, }) framework.ExpectNoError(err, "failed to marshal patch data") _, err = f.ClientSet.CoreV1().PodTemplates(testNamespaceName).Patch(podTemplateName, types.StrategicMergePatchType, []byte(podTemplatePatch)) framework.ExpectNoError(err, "failed to patch PodTemplate") // get template (ensure label is there) podTemplateRead, err = f.ClientSet.CoreV1().PodTemplates(testNamespaceName).Get(podTemplateName, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get PodTemplate") framework.ExpectEqual(podTemplateRead.ObjectMeta.Labels["podtemplate"], "patched", "failed to patch template, new label not found") // delete the PodTemplate err = f.ClientSet.CoreV1().PodTemplates(testNamespaceName).Delete(podTemplateName, &metav1.DeleteOptions{}) framework.ExpectNoError(err, "failed to delete PodTemplate") // list the PodTemplates podTemplateList, err = f.ClientSet.CoreV1().PodTemplates("").List(metav1.ListOptions{ LabelSelector: "podtemplate-static=true", }) framework.ExpectNoError(err, "failed to list PodTemplate") framework.ExpectEqual(len(podTemplateList.Items), 0, "PodTemplate list returned items, failed to delete PodTemplate") }) }) </ins>

Discussion:
This issue proposes the writing of a new test for the API endponts , , , and with the intention of promoting it to Conformance. This issue contains a very basic mock test in order to start the conversation about what a good e2e test would look like for this endpoint. The code below is verified to be hitting the intended endpoint, show as per the queries in APIsnoop's live view of the cluster's audit logs. According to these results from APIsnoop, we are lacking in test coverage and conformant tests for PodTemplate. We chose these three following endpoints for this mock test: - - Outline: PodTemplates, Expect no PodTemplates a PodTemplate (1), Expect no error PodTemplate (1), Ensure the same as how it was created PodTemplate (1) with label a=1, Expect no error PodTemplate (1), Expect label in returned data to be present PodTemplates by label a=1, Expect one PodTemplate PodTemplate (1) Expect no error PodTemplates, Expect no PodTemplates Fetch dependencies: This mock test is using client-go's standard functions to talk to the PodTemplate part of the API. If a test with these calls gets merged in, conformance will go up by 3 endpoints. /sig architecture /area conformance
We decided not to deprecate. We can link to that, but otherwise this is OK to write / promote.
ref: for the decision not to deprecate
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details