提交 830562c1 编写于 作者: A Austin Adams 提交者: k8s-ci-robot

Fix fmt and some code (#3156)

* Vendor updates

* Fix fmt, and fix html fmt
上级 bb5073c9
此差异已折叠。
......@@ -48,7 +48,7 @@ type holder struct {
enableInsecureLogin bool
disableSettingsAuthorizer bool
disableSkipButton bool
disableSkipButton bool
}
// GetInsecurePort 'insecure-port' argument of Dashboard binary.
......
......@@ -178,12 +178,12 @@ func TestAuthManager_AuthenticationModes(t *testing.T) {
func TestAuthManager_AuthenticationSkippable(t *testing.T) {
cManager := &fakeClientManager{}
tManager := &fakeTokenManager{}
cModes := authApi.AuthenticationModes{}
cModes := authApi.AuthenticationModes{}
for _, flag := range []bool{true,false} {
for _, flag := range []bool{true, false} {
authManager := NewAuthManager(cManager, tManager, cModes, flag)
got := authManager.AuthenticationSkippable()
if (got != flag) {
if got != flag {
t.Errorf("Expected %v, but got %v.", flag, got)
}
}
......
......@@ -343,9 +343,9 @@ func CreateHTTPAPIHandler(iManager integration.IntegrationManager, cManager clie
apiV1Ws.GET("/cronjob/{namespace}/{name}/event").
To(apiHandler.handleGetCronJobEvents).
Writes(common.EventList{}))
apiV1Ws.Route(
apiV1Ws.PUT("/cronjob/{namespace}/{name}/trigger").
To(apiHandler.handleTriggerCronJob))
apiV1Ws.Route(
apiV1Ws.PUT("/cronjob/{namespace}/{name}/trigger").
To(apiHandler.handleTriggerCronJob))
apiV1Ws.Route(
apiV1Ws.POST("/namespace").
......@@ -1941,20 +1941,20 @@ func (apiHandler *APIHandler) handleGetCronJobEvents(request *restful.Request, r
}
func (apiHandler *APIHandler) handleTriggerCronJob(request *restful.Request, response *restful.Response) {
k8sClient, err := apiHandler.cManager.Client(request)
if err != nil {
kdErrors.HandleInternalError(response, err)
return
}
namespace := request.PathParameter("namespace")
name := request.PathParameter("name")
err = cronjob.TriggerCronJob(k8sClient, namespace, name)
if err != nil {
kdErrors.HandleInternalError(response, err)
return
}
response.WriteHeader(http.StatusOK)
k8sClient, err := apiHandler.cManager.Client(request)
if err != nil {
kdErrors.HandleInternalError(response, err)
return
}
namespace := request.PathParameter("namespace")
name := request.PathParameter("name")
err = cronjob.TriggerCronJob(k8sClient, namespace, name)
if err != nil {
kdErrors.HandleInternalError(response, err)
return
}
response.WriteHeader(http.StatusOK)
}
func (apiHandler *APIHandler) handleGetStorageClassList(request *restful.Request, response *restful.Response) {
......
......@@ -95,65 +95,65 @@ func GetInitContainerNames(podTemplate *v1.PodSpec) []string {
}
// GetNonduplicateContainerImages returns list of container image strings without duplicates
func GetNonduplicateContainerImages(podList []v1.Pod) []string{
var containerImages []string
for _, pod := range podList {
for _, container := range pod.Spec.Containers {
if noStringInSlice(container.Image, containerImages){
containerImages = append(containerImages, container.Image)
}
}
}
return containerImages
func GetNonduplicateContainerImages(podList []v1.Pod) []string {
var containerImages []string
for _, pod := range podList {
for _, container := range pod.Spec.Containers {
if noStringInSlice(container.Image, containerImages) {
containerImages = append(containerImages, container.Image)
}
}
}
return containerImages
}
// GetNonduplicateInitContainerImages returns list of init container image strings without duplicates
func GetNonduplicateInitContainerImages(podList []v1.Pod) []string{
var initContainerImages []string
for _, pod := range podList {
for _, initContainer := range pod.Spec.InitContainers {
if noStringInSlice(initContainer.Image, initContainerImages){
initContainerImages = append(initContainerImages, initContainer.Image)
}
}
}
return initContainerImages
func GetNonduplicateInitContainerImages(podList []v1.Pod) []string {
var initContainerImages []string
for _, pod := range podList {
for _, initContainer := range pod.Spec.InitContainers {
if noStringInSlice(initContainer.Image, initContainerImages) {
initContainerImages = append(initContainerImages, initContainer.Image)
}
}
}
return initContainerImages
}
// GetNonduplicateContainerNames returns list of container names strings without duplicates
func GetNonduplicateContainerNames(podList []v1.Pod) []string{
var containerNames []string
for _, pod := range podList {
for _, container := range pod.Spec.Containers {
if noStringInSlice(container.Name, containerNames){
containerNames = append(containerNames, container.Name)
}
}
}
return containerNames
func GetNonduplicateContainerNames(podList []v1.Pod) []string {
var containerNames []string
for _, pod := range podList {
for _, container := range pod.Spec.Containers {
if noStringInSlice(container.Name, containerNames) {
containerNames = append(containerNames, container.Name)
}
}
}
return containerNames
}
// GetNonduplicateInitContainerNames returns list of init container names strings without duplicates
func GetNonduplicateInitContainerNames(podList []v1.Pod) []string{
var initContainerNames []string
for _, pod := range podList {
for _, initContainer := range pod.Spec.InitContainers {
if noStringInSlice(initContainer.Name, initContainerNames){
initContainerNames = append(initContainerNames, initContainer.Name)
}
}
}
return initContainerNames
func GetNonduplicateInitContainerNames(podList []v1.Pod) []string {
var initContainerNames []string
for _, pod := range podList {
for _, initContainer := range pod.Spec.InitContainers {
if noStringInSlice(initContainer.Name, initContainerNames) {
initContainerNames = append(initContainerNames, initContainer.Name)
}
}
}
return initContainerNames
}
//noStringInSlice checks if string in array
func noStringInSlice(str string, array []string) bool {
for _, alreadystr := range array {
if alreadystr == str {
return false
}
}
return true
for _, alreadystr := range array {
if alreadystr == str {
return false
}
}
return true
}
// EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash]
......
......@@ -197,91 +197,91 @@ func TestGetInitContainerNames(t *testing.T) {
}
func TestGetNonduplicateContainerImages(t *testing.T) {
expected :=[]string{"Container1", "Container2", "Container3"}
pods := make([]api.Pod, 2, 2)
expected := []string{"Container1", "Container2", "Container3"}
pods := make([]api.Pod, 2, 2)
pods[0] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Image: "Container1"}, {Image: "Container2"}},
},
}
pods[0] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Image: "Container1"}, {Image: "Container2"}},
},
}
pods[1] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Image: "Container2"}, {Image: "Container3"}},
},
}
actual := GetNonduplicateContainerImages(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateContainerImages() == %+v, expected %+v",
actual, expected)
}
pods[1] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Image: "Container2"}, {Image: "Container3"}},
},
}
actual := GetNonduplicateContainerImages(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateContainerImages() == %+v, expected %+v",
actual, expected)
}
}
func TestGetNonduplicateInitContainerImages(t *testing.T) {
expected :=[]string{"initContainer1", "initContainer2", "initContainer3"}
pods := make([]api.Pod, 2, 2)
expected := []string{"initContainer1", "initContainer2", "initContainer3"}
pods := make([]api.Pod, 2, 2)
pods[0] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Image: "initContainer1"}, {Image: "initContainer2"}},
},
}
pods[0] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Image: "initContainer1"}, {Image: "initContainer2"}},
},
}
pods[1] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Image: "initContainer2"}, {Image: "initContainer3"}},
},
}
actual := GetNonduplicateInitContainerImages(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateInitContainerImages() == %+v, expected %+v",
actual, expected)
}
pods[1] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Image: "initContainer2"}, {Image: "initContainer3"}},
},
}
actual := GetNonduplicateInitContainerImages(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateInitContainerImages() == %+v, expected %+v",
actual, expected)
}
}
func TestGetNonduplicateContainerNames(t *testing.T) {
expected :=[]string{"Container1", "Container2", "Container3"}
pods := make([]api.Pod, 2, 2)
expected := []string{"Container1", "Container2", "Container3"}
pods := make([]api.Pod, 2, 2)
pods[0] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Name: "Container1"}, {Name: "Container2"}},
},
}
pods[0] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Name: "Container1"}, {Name: "Container2"}},
},
}
pods[1] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Name: "Container2"}, {Name: "Container3"}},
},
}
actual := GetNonduplicateContainerNames(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateContainerNames() == %+v, expected %+v",
actual, expected)
}
pods[1] = api.Pod{
Spec: api.PodSpec{
Containers: []api.Container{{Name: "Container2"}, {Name: "Container3"}},
},
}
actual := GetNonduplicateContainerNames(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateContainerNames() == %+v, expected %+v",
actual, expected)
}
}
func TestGetNonduplicateInitContainerNames(t *testing.T) {
expected :=[]string{"initContainer1", "initContainer2", "initContainer3"}
pods := make([]api.Pod, 2, 2)
expected := []string{"initContainer1", "initContainer2", "initContainer3"}
pods := make([]api.Pod, 2, 2)
pods[0] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Name: "initContainer1"}, {Name: "initContainer2"}},
},
}
pods[0] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Name: "initContainer1"}, {Name: "initContainer2"}},
},
}
pods[1] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Name: "initContainer2"}, {Name: "initContainer3"}},
},
}
actual := GetNonduplicateInitContainerNames(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateInitContainerNames() == %+v, expected %+v",
actual, expected)
}
pods[1] = api.Pod{
Spec: api.PodSpec{
InitContainers: []api.Container{{Name: "initContainer2"}, {Name: "initContainer3"}},
},
}
actual := GetNonduplicateInitContainerNames(pods)
if !reflect.DeepEqual(actual, expected) {
t.Errorf("GetNonduplicateInitContainerNames() == %+v, expected %+v",
actual, expected)
}
}
func TestFilterPodsForJob(t *testing.T) {
......
......@@ -71,12 +71,12 @@ func NewResourceController(ref meta.OwnerReference, namespace string, client cli
return nil, err
}
return JobController(*job), nil
case api.ResourceKindPod:
pod, err := client.CoreV1().Pods(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
return nil, err
}
return PodController(*pod), nil
case api.ResourceKindPod:
pod, err := client.CoreV1().Pods(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
return nil, err
}
return PodController(*pod), nil
case api.ResourceKindReplicaSet:
rs, err := client.AppsV1beta2().ReplicaSets(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
......@@ -143,33 +143,33 @@ func (self JobController) GetLogSources(allPods []v1.Pod) LogSources {
type PodController v1.Pod
// Get is an implementation of Get method from ResourceController interface.
func (self PodController) Get(allPods []v1.Pod, allEvents[]v1.Event) ResourceOwner {
matchingPods := common.FilterPodsByControllerRef(&self, allPods)
podInfo := common.GetPodInfo(int32(len(matchingPods)), nil, matchingPods) // Pods should not desire any Pods
podInfo.Warnings = event.GetPodsEventWarnings(allEvents, matchingPods)
return ResourceOwner{
TypeMeta: api.NewTypeMeta(api.ResourceKindPod),
ObjectMeta: api.NewObjectMeta(self.ObjectMeta),
Pods: podInfo,
ContainerImages: common.GetNonduplicateContainerImages(matchingPods),
InitContainerImages: common.GetNonduplicateInitContainerImages(matchingPods),
}
func (self PodController) Get(allPods []v1.Pod, allEvents []v1.Event) ResourceOwner {
matchingPods := common.FilterPodsByControllerRef(&self, allPods)
podInfo := common.GetPodInfo(int32(len(matchingPods)), nil, matchingPods) // Pods should not desire any Pods
podInfo.Warnings = event.GetPodsEventWarnings(allEvents, matchingPods)
return ResourceOwner{
TypeMeta: api.NewTypeMeta(api.ResourceKindPod),
ObjectMeta: api.NewObjectMeta(self.ObjectMeta),
Pods: podInfo,
ContainerImages: common.GetNonduplicateContainerImages(matchingPods),
InitContainerImages: common.GetNonduplicateInitContainerImages(matchingPods),
}
}
// UID is an implementation of UID method from ResourceController interface.
func (self PodController) UID() types.UID {
return v1.Pod(self).UID
return v1.Pod(self).UID
}
// GetLogSources is an implementation of the GetLogSources method from ResourceController interface.
func (self PodController) GetLogSources(allPods []v1.Pod) LogSources {
controlledPods := common.FilterPodsByControllerRef(&self, allPods)
return LogSources{
PodNames: getPodNames(controlledPods),
ContainerNames: common.GetNonduplicateContainerNames(controlledPods),
InitContainerNames: common.GetNonduplicateInitContainerNames(controlledPods),
}
controlledPods := common.FilterPodsByControllerRef(&self, allPods)
return LogSources{
PodNames: getPodNames(controlledPods),
ContainerNames: common.GetNonduplicateContainerNames(controlledPods),
InitContainerNames: common.GetNonduplicateInitContainerNames(controlledPods),
}
}
// ReplicaSetController is an alias-type for Kubernetes API Replica Set type. It allows to provide
......
......@@ -18,10 +18,10 @@ import (
"reflect"
"testing"
"github.com/kubernetes/dashboard/src/app/backend/api"
"k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/kubernetes/dashboard/src/app/backend/api"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/fake"
)
func TestGetPodNames(t *testing.T) {
......@@ -50,41 +50,41 @@ func TestGetPodNames(t *testing.T) {
}
func TestNewResourceController(t *testing.T) {
pod := v1.Pod{
TypeMeta: meta.TypeMeta{
Kind: "pod",
APIVersion:"v1",
},
ObjectMeta: meta.ObjectMeta{
Name: "test-name",
Namespace: "default",
}}
cli := fake.NewSimpleClientset(&pod)
pod := v1.Pod{
TypeMeta: meta.TypeMeta{
Kind: "pod",
APIVersion: "v1",
},
ObjectMeta: meta.ObjectMeta{
Name: "test-name",
Namespace: "default",
}}
cli := fake.NewSimpleClientset(&pod)
ctrl, err := NewResourceController(
meta.OwnerReference {
Kind: api.ResourceKindPod,
Name: "test-name",
}, "default", cli)
ctrl, err := NewResourceController(
meta.OwnerReference{
Kind: api.ResourceKindPod,
Name: "test-name",
}, "default", cli)
if err != nil {
t.Fatal("Returned Error finding pod")
}
podCtrl, ok := ctrl.(PodController)
if !ok {
t.Fatal("Returned value is not pod controller")
}
if podCtrl.Name != "test-name" {
t.Fatal("Returned invalid pod name")
}
NewResourceController(
meta.OwnerReference {
Kind: api.ResourceKindPod,
Name: "test-name",
}, "default", fake.NewSimpleClientset())
podCtrl.Get([]v1.Pod{pod}, []v1.Event{})
podCtrl.UID()
podCtrl.GetLogSources([]v1.Pod{pod})
if err != nil {
t.Fatal("Returned Error finding pod")
}
podCtrl, ok := ctrl.(PodController)
if !ok {
t.Fatal("Returned value is not pod controller")
}
if podCtrl.Name != "test-name" {
t.Fatal("Returned invalid pod name")
}
NewResourceController(
meta.OwnerReference{
Kind: api.ResourceKindPod,
Name: "test-name",
}, "default", fake.NewSimpleClientset())
podCtrl.Get([]v1.Pod{pod}, []v1.Event{})
podCtrl.UID()
podCtrl.GetLogSources([]v1.Pod{pod})
}
func newPod(name string) v1.Pod {
......
......@@ -56,6 +56,10 @@ func GetCronJobDetail(client k8sClient.Interface, dsQuery *dataselect.DataSelect
}
inactiveJobs, err := GetCronJobCompletedJobs(client, metricClient, dsQuery, namespace, name)
nonCriticalErrors, criticalError = errors.AppendError(err, nonCriticalErrors)
if criticalError != nil {
return nil, criticalError
}
events, err := GetCronJobEvents(client, dsQuery, namespace, name)
nonCriticalErrors, criticalError = errors.AppendError(err, nonCriticalErrors)
......
......@@ -24,8 +24,8 @@ import (
batch "k8s.io/api/batch/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/rand"
client "k8s.io/client-go/kubernetes"
"k8s.io/apimachinery/pkg/util/rand"
)
var emptyJobList = &job.JobList{
......@@ -123,47 +123,47 @@ func GetCronJobCompletedJobs(client client.Interface, metricClient metricapi.Met
// TriggerCronJob manually triggers a cron job and creates a new job.
func TriggerCronJob(client client.Interface,
namespace, name string) error {
cronJob, err := client.BatchV1beta1().CronJobs(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return err
}
annotations := make(map[string]string)
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
labels := make(map[string]string)
for k, v := range cronJob.Spec.JobTemplate.Labels {
labels[k] = v
}
//job name cannot exceed DNS1053LabelMaxLength (52 characters)
var newJobName string
if (len(cronJob.Name) < 42) {
newJobName = cronJob.Name + "-manual-" + rand.String(3)
} else {
newJobName = cronJob.Name[0:41] + "-manual-" + rand.String(3)
}
jobToCreate := &batch.Job{
ObjectMeta: metaV1.ObjectMeta{
Name: newJobName,
Namespace: namespace,
Annotations: annotations,
Labels: labels,
},
Spec: cronJob.Spec.JobTemplate.Spec,
}
_, err = client.BatchV1().Jobs(namespace).Create(jobToCreate)
if err != nil {
return err
}
return nil
namespace, name string) error {
cronJob, err := client.BatchV1beta1().CronJobs(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return err
}
annotations := make(map[string]string)
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
labels := make(map[string]string)
for k, v := range cronJob.Spec.JobTemplate.Labels {
labels[k] = v
}
//job name cannot exceed DNS1053LabelMaxLength (52 characters)
var newJobName string
if len(cronJob.Name) < 42 {
newJobName = cronJob.Name + "-manual-" + rand.String(3)
} else {
newJobName = cronJob.Name[0:41] + "-manual-" + rand.String(3)
}
jobToCreate := &batch.Job{
ObjectMeta: metaV1.ObjectMeta{
Name: newJobName,
Namespace: namespace,
Annotations: annotations,
Labels: labels,
},
Spec: cronJob.Spec.JobTemplate.Spec,
}
_, err = client.BatchV1().Jobs(namespace).Create(jobToCreate)
if err != nil {
return err
}
return nil
}
func filterJobsByOwnerUID(UID types.UID, jobs []batch.Job) (matchingJobs []batch.Job) {
......
......@@ -15,79 +15,78 @@
package cronjob_test
import (
"testing"
"github.com/kubernetes/dashboard/src/app/backend/resource/cronjob"
batch "k8s.io/api/batch/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/apimachinery/pkg/api/errors"
"strings"
"github.com/kubernetes/dashboard/src/app/backend/resource/cronjob"
batch "k8s.io/api/batch/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
"strings"
"testing"
)
func TestTriggerCronJobWithInvalidName(t *testing.T) {
client := fake.NewSimpleClientset()
client := fake.NewSimpleClientset()
err := cronjob.TriggerCronJob(client, namespace, "invalidName")
if !errors.IsNotFound(err) {
t.Error("TriggerCronJob should return error when invalid name is passed")
}
err := cronjob.TriggerCronJob(client, namespace, "invalidName")
if !errors.IsNotFound(err) {
t.Error("TriggerCronJob should return error when invalid name is passed")
}
}
//create a job from a cronjob which has a 52 character name (max length)
func TestTriggerCronJobWithLongName(t *testing.T) {
longName := strings.Repeat("test", 13)
longName := strings.Repeat("test", 13)
cron := batch.CronJob{
ObjectMeta: metaV1.ObjectMeta{
Name: longName,
Namespace: namespace,
Labels: labels,
}, TypeMeta: metaV1.TypeMeta{
Kind: "CronJob",
APIVersion: "v1",
}}
cron := batch.CronJob{
ObjectMeta: metaV1.ObjectMeta{
Name: longName,
Namespace: namespace,
Labels: labels,
}, TypeMeta: metaV1.TypeMeta{
Kind: "CronJob",
APIVersion: "v1",
}}
client := fake.NewSimpleClientset(&cron)
err := cronjob.TriggerCronJob(client, namespace, longName)
if err != nil {
t.Error(err)
}
client := fake.NewSimpleClientset(&cron)
err := cronjob.TriggerCronJob(client, namespace, longName)
if err != nil {
t.Error(err)
}
}
func TestTriggerCronJob(t *testing.T) {
cron := batch.CronJob{
ObjectMeta: metaV1.ObjectMeta{
Name: name,
Namespace: namespace,
}, TypeMeta: metaV1.TypeMeta{
Kind: "CronJob",
APIVersion: "v1",
}, Spec: batch.CronJobSpec{
Schedule: "* * * * *",
JobTemplate: batch.JobTemplateSpec{
ObjectMeta: metaV1.ObjectMeta{
Namespace: namespace,
Labels: labels,
},
},
},
}
cron := batch.CronJob{
ObjectMeta: metaV1.ObjectMeta{
Name: name,
Namespace: namespace,
}, TypeMeta: metaV1.TypeMeta{
Kind: "CronJob",
APIVersion: "v1",
}, Spec: batch.CronJobSpec{
Schedule: "* * * * *",
JobTemplate: batch.JobTemplateSpec{
ObjectMeta: metaV1.ObjectMeta{
Namespace: namespace,
Labels: labels,
},
},
},
}
client := fake.NewSimpleClientset(&cron)
client := fake.NewSimpleClientset(&cron)
err := cronjob.TriggerCronJob(client, namespace, name)
if err != nil {
t.Error(err)
}
err := cronjob.TriggerCronJob(client, namespace, name)
if err != nil {
t.Error(err)
}
//check if client has the newly triggered job
list, err := client.BatchV1().Jobs(namespace).List(metaV1.ListOptions{})
if err != nil {
t.Error(err)
}
if len(list.Items) != 1 {
t.Error(err)
}
//check if client has the newly triggered job
list, err := client.BatchV1().Jobs(namespace).List(metaV1.ListOptions{})
if err != nil {
t.Error(err)
}
if len(list.Items) != 1 {
t.Error(err)
}
}
......@@ -30,4 +30,5 @@ import {aboutState} from './state';
],
declarations: [AboutComponent, ActionbarComponent],
})
export class AboutModule {}
export class AboutModule {
}
......@@ -36,4 +36,5 @@ import {UserPanelComponent} from './userpanel/component';
NavModule,
]
})
export class ChromeModule {}
export class ChromeModule {
}
......@@ -27,4 +27,5 @@ import {NavItemComponent} from './item/component';
exports: [NavComponent, NavItemComponent, HamburgerComponent],
imports: [SharedModule, ComponentsModule, NavServiceModule]
})
export class NavModule {}
export class NavModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-actionbar',
templateUrl: './template.html',
})
export class ActionbarComponent {}
export class ActionbarComponent {
}
......@@ -21,4 +21,6 @@ import {Endpoint} from '@api/backendapi';
*/
@Component(
{selector: 'kd-external-endpoint', templateUrl: './template.html', styleUrls: ['./style.scss']})
export class ExternalEndpointComponent { @Input() endpoints: Endpoint[]; }
export class ExternalEndpointComponent {
@Input() endpoints: Endpoint[];
}
......@@ -21,4 +21,6 @@ import {Endpoint} from '@api/backendapi';
*/
@Component(
{selector: 'kd-internal-endpoint', templateUrl: './template.html', styleUrls: ['./style.scss']})
export class InternalEndpointComponent { @Input() endpoints: Endpoint[]; }
export class InternalEndpointComponent {
@Input() endpoints: Endpoint[];
}
......@@ -19,4 +19,6 @@ import {Component, Input} from '@angular/core';
templateUrl: './template.html',
styleUrls: ['./style.scss'],
})
export class HiddenPropertyComponent { @Input() hidden = true; }
export class HiddenPropertyComponent {
@Input() hidden = true;
}
......@@ -20,4 +20,6 @@ import {Event} from 'typings/backendapi';
templateUrl: 'template.html',
styleUrls: ['style.scss'],
})
export class RowDetailComponent { events: Event[] = []; }
export class RowDetailComponent {
events: Event[] = [];
}
......@@ -16,4 +16,5 @@ import {Component} from '@angular/core';
@Component(
{selector: 'kd-list-zero-state', templateUrl: './template.html', styleUrls: ['./style.scss']})
export class ListZeroStateComponent {}
export class ListZeroStateComponent {
}
......@@ -190,4 +190,5 @@ import {ZeroStateComponent} from './zerostate/component';
NamespaceChangeDialog,
]
})
export class ComponentsModule {}
export class ComponentsModule {
}
......@@ -19,4 +19,5 @@ import {Component} from '@angular/core';
templateUrl: './template.html',
styleUrls: ['./style.scss'],
})
export class PropertyComponent {}
export class PropertyComponent {
}
......@@ -17,4 +17,5 @@ import {Component} from '@angular/core';
@Component({
template: '<ui-view></ui-view>',
})
export class ProxyComponent {}
export class ProxyComponent {
}
......@@ -15,4 +15,5 @@
import {Component} from '@angular/core';
@Component({selector: 'kd-zero-state', templateUrl: './template.html', styleUrls: ['./style.scss']})
export class ZeroStateComponent {}
export class ZeroStateComponent {
}
......@@ -44,4 +44,5 @@ import {EditResourceDialog} from './editresource/dialog';
DeleteResourceDialog,
]
})
export class DialogsModule {}
export class DialogsModule {
}
......@@ -19,7 +19,9 @@ import {KdError as KdApiError, KnownErrors} from '@api/frontendapi';
/**
* Error returned as a part of backend api calls. All server errors should be in this format.
*/
export class K8SError implements K8SApiError { ErrStatus: ErrStatus; }
export class K8SError implements K8SApiError {
ErrStatus: ErrStatus;
}
/* tslint:enable */
/**
......
......@@ -22,4 +22,5 @@ import {RelativeTimeFormatter} from './relativetime';
declarations: [MemoryFormatter, CoreFormatter, RelativeTimeFormatter],
exports: [MemoryFormatter, CoreFormatter, RelativeTimeFormatter],
})
export class PipesModule {}
export class PipesModule {
}
......@@ -28,4 +28,6 @@ export class ResourceMeta {
}
@Injectable()
export class ActionbarService { onInit = new EventEmitter<ResourceMeta>(); }
export class ActionbarService {
onInit = new EventEmitter<ResourceMeta>();
}
......@@ -19,4 +19,5 @@ import {NavService} from './service';
@NgModule({
providers: [NavService],
})
export class NavServiceModule {}
export class NavServiceModule {
}
......@@ -18,4 +18,5 @@ import {NamespacedResourceService, ResourceService} from './resource';
@NgModule({
providers: [ResourceService, NamespacedResourceService],
})
export class ResourceModule {}
export class ResourceModule {
}
......@@ -19,4 +19,5 @@ import {Component} from '@angular/core';
templateUrl: './template.html',
styleUrls: ['./style.scss'],
})
export class CreateComponent {}
export class CreateComponent {
}
......@@ -29,4 +29,5 @@ import {createState} from './state';
],
declarations: [CreateComponent],
})
export class CreateModule {}
export class CreateModule {
}
......@@ -32,4 +32,5 @@ import {errorState} from './state';
providers: [{provide: ErrorHandler, useClass: GlobalErrorHandler}],
declarations: [ErrorComponent],
})
export class ErrorModule {}
export class ErrorModule {
}
......@@ -109,4 +109,5 @@ import {settingsFutureState} from './settings/state';
declarations: [RootComponent],
bootstrap: [RootComponent]
})
export class RootModule {}
export class RootModule {
}
......@@ -25,4 +25,5 @@ import {LoginComponent} from './component';
ComponentsModule,
],
})
export class LoginModule {}
export class LoginModule {
}
......@@ -30,4 +30,5 @@ import {overviewState} from './state';
],
declarations: [OverviewComponent],
})
export class OverviewModule {}
export class OverviewModule {
}
......@@ -114,7 +114,7 @@ limitations under the License.
<kd-resource-card-column>
<span class="kd-replicase-card-pods-stat">
{{::$ctrl.creator.pods.running}} <span ng-if="$ctrl.creator.pods.desired != null">/ {{::$ctrl.creator.pods.desired}}</span>
</span>
</span>
</kd-resource-card-column>
<kd-resource-card-column>
{{::$ctrl.creator.objectMeta.creationTimestamp | relativeTime}}
......
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-cluster-role-list-state',
template: '<kd-cluster-role-list></kd-cluster-role-list>',
})
export class ClusterRoleListComponent {}
export class ClusterRoleListComponent {
}
......@@ -43,4 +43,5 @@ import {clusterRoleState} from './state';
ClusterRoleDetailComponent,
],
})
export class ClusterRoleModule {}
export class ClusterRoleModule {
}
......@@ -19,4 +19,5 @@ import {GroupedResourceList} from '../../common/resources/groupedlist';
selector: 'kd-cluster',
templateUrl: './template.html',
})
export class ClusterComponent extends GroupedResourceList {}
export class ClusterComponent extends GroupedResourceList {
}
......@@ -30,4 +30,5 @@ import {clusterState} from './state';
],
declarations: [ClusterComponent],
})
export class ClusterModule {}
export class ClusterModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-namespace-list-view',
template: '<kd-namespace-list></kd-namespace-list>',
})
export class NamespaceListComponent {}
export class NamespaceListComponent {
}
......@@ -41,4 +41,5 @@ import {namespaceState} from './state';
],
declarations: [NamespaceListComponent, NamespaceDetailComponent, ActionbarComponent],
})
export class NamespaceModule {}
export class NamespaceModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-node-list-state',
template: '<kd-node-list></kd-node-list>',
})
export class NodeListComponent {}
export class NodeListComponent {
}
......@@ -34,4 +34,5 @@ import {nodeState} from './state';
],
declarations: [NodeListComponent, NodeDetailComponent],
})
export class NodeModule {}
export class NodeModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-persistent-volume-list-state',
template: '<kd-persistent-volume-list></kd-persistent-volume-list>',
})
export class PersistentVolumeListComponent {}
export class PersistentVolumeListComponent {
}
......@@ -43,4 +43,5 @@ import {persistentVolumeState} from './state';
PersistentVolumeListComponent, PersistentVolumeDetailComponent, PersistentVolumeSourceComponent
],
})
export class PersistentVolumeModule {}
export class PersistentVolumeModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-storage-class-list-state',
template: '<kd-storage-class-list></kd-storage-class-list>',
})
export class StorageClassListComponent {}
export class StorageClassListComponent {
}
......@@ -40,4 +40,5 @@ import {storageClassState} from './state';
],
declarations: [StorageClassListComponent, StorageClassDetailComponent],
})
export class StorageClassModule {}
export class StorageClassModule {
}
......@@ -19,4 +19,5 @@ import {GroupedResourceList} from '../../common/resources/groupedlist';
selector: 'kd-config',
templateUrl: './template.html',
})
export class ConfigComponent extends GroupedResourceList {}
export class ConfigComponent extends GroupedResourceList {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-config-map-list-state',
template: '<kd-config-map-list></kd-config-map-list>',
})
export class ConfigMapList {}
export class ConfigMapList {
}
......@@ -34,4 +34,5 @@ import {configMapState} from './state';
],
declarations: [ConfigMapList, ConfigMapDetailComponent],
})
export class ConfigMapModule {}
export class ConfigMapModule {
}
......@@ -31,4 +31,5 @@ import {configState} from './state';
],
declarations: [ConfigComponent],
})
export class ConfigModule {}
export class ConfigModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-persistent-volume-claim-list-state',
template: '<kd-persistent-volume-claim-list></kd-persistent-volume-claim-list>',
})
export class PersistentVolumeClaimList {}
export class PersistentVolumeClaimList {
}
......@@ -40,4 +40,5 @@ import {persistentVolumeClaimState} from './state';
],
declarations: [PersistentVolumeClaimList, PersistentVolumeClaimDetailComponent],
})
export class PersistentVolumeClaimModule {}
export class PersistentVolumeClaimModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-secret-list-state',
template: '<kd-secret-list></kd-secret-list>',
})
export class SecretList {}
export class SecretList {
}
......@@ -34,4 +34,5 @@ import {secretState} from './state';
],
declarations: [SecretList, SecretDetailComponent],
})
export class SecretModule {}
export class SecretModule {
}
......@@ -19,4 +19,5 @@ import {GroupedResourceList} from '../../common/resources/groupedlist';
selector: 'kd-discovery',
templateUrl: './template.html',
})
export class DiscoveryComponent extends GroupedResourceList {}
export class DiscoveryComponent extends GroupedResourceList {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-ingress-list-state',
template: '<kd-ingress-list></kd-ingress-list>',
})
export class IngressList {}
export class IngressList {
}
......@@ -40,4 +40,5 @@ import {ingressState} from './state';
],
declarations: [IngressList, IngressDetailComponent],
})
export class IngressModule {}
export class IngressModule {
}
......@@ -31,4 +31,5 @@ import {discoveryState} from './state';
],
declarations: [DiscoveryComponent],
})
export class DiscoveryModule {}
export class DiscoveryModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-service-list-state',
template: '<kd-service-list></kd-service-list>',
})
export class ServiceList {}
export class ServiceList {
}
......@@ -40,4 +40,5 @@ import {serviceState} from './state';
],
declarations: [ServiceList, ServiceDetailComponent],
})
export class ServiceModule {}
export class ServiceModule {
}
......@@ -21,4 +21,5 @@ import {GroupedResourceList} from '../../common/resources/groupedlist';
selector: 'kd-workloads',
templateUrl: './template.html',
})
export class WorkloadsComponent extends GroupedResourceList {}
export class WorkloadsComponent extends GroupedResourceList {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-cron-job-list-state',
template: '<kd-cron-job-list></kd-cron-job-list>',
})
export class CronJobList {}
export class CronJobList {
}
......@@ -33,4 +33,5 @@ import {cronJobState} from './state';
],
declarations: [CronJobList, CronJobDetailComponent],
})
export class CronJobModule {}
export class CronJobModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-daemon-set-list-state',
template: '<kd-daemon-set-list></kd-daemon-set-list>',
})
export class DaemonSetList {}
export class DaemonSetList {
}
......@@ -35,4 +35,5 @@ import {daemonSetState} from './state';
],
declarations: [DaemonSetList, DaemonSetDetailComponent, ActionbarComponent],
})
export class DaemonSetModule {}
export class DaemonSetModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-deployment-list-state',
template: '<kd-deployment-list></kd-deployment-list>',
})
export class DeploymentList {}
export class DeploymentList {
}
......@@ -36,4 +36,5 @@ import {deploymentState} from './state';
],
declarations: [DeploymentList, DeploymentDetailComponent, ActionbarComponent],
})
export class DeploymentModule {}
export class DeploymentModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-job-list-state',
template: '<kd-job-list></kd-job-list>',
})
export class JobList {}
export class JobList {
}
......@@ -32,4 +32,5 @@ import {jobState} from './state';
],
declarations: [JobList, JobDetailComponent],
})
export class JobModule {}
export class JobModule {
}
......@@ -31,4 +31,5 @@ import {workloadsState} from './state';
],
declarations: [WorkloadsComponent],
})
export class WorkloadsModule {}
export class WorkloadsModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-pod-list-state',
template: '<kd-pod-list></kd-pod-list>',
})
export class PodList {}
export class PodList {
}
......@@ -33,4 +33,5 @@ import {podState} from './state';
],
declarations: [PodList, PodDetailComponent],
})
export class PodModule {}
export class PodModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-replica-set-list-state',
template: '<kd-replica-set-list></kd-replica-set-list>',
})
export class ReplicaSetList {}
export class ReplicaSetList {
}
......@@ -34,4 +34,5 @@ import {replicaSetState} from './state';
],
declarations: [ReplicaSetList, ReplicaSetDetailComponent],
})
export class ReplicaSetModule {}
export class ReplicaSetModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-replication-controller-list-state',
template: '<kd-replication-controller-list></kd-replication-controller-list>',
})
export class ReplicationControllerList {}
export class ReplicationControllerList {
}
......@@ -37,4 +37,5 @@ import {replicationControllerState} from './state';
],
declarations: [ReplicationControllerList, ReplicationControllerDetailComponent],
})
export class ReplicationControllerModule {}
export class ReplicationControllerModule {
}
......@@ -18,4 +18,5 @@ import {Component} from '@angular/core';
selector: 'kd-stateful-set-state',
template: '<kd-stateful-set-list></kd-stateful-set-list>',
})
export class StatefulSetList {}
export class StatefulSetList {
}
......@@ -34,4 +34,5 @@ import {statefulSetState} from './state';
],
declarations: [StatefulSetList, StatefulSetDetailComponent],
})
export class StatefulSetModule {}
export class StatefulSetModule {
}
......@@ -33,4 +33,5 @@ import {searchState} from './state';
SearchComponent,
],
})
export class SearchModule {}
export class SearchModule {
}
......@@ -19,4 +19,5 @@ import {Component} from '@angular/core';
template: '<kd-global-settings></kd-global-settings>' +
'<kd-local-settings></kd-local-settings>',
})
export class SettingsComponent {}
export class SettingsComponent {
}
......@@ -42,4 +42,5 @@ import {settingsState} from './state';
SaveAnywayDialog,
],
})
export class SettingsModule {}
export class SettingsModule {
}
......@@ -74,4 +74,5 @@ const SHARED_DEPENDENCIES = [
},
],
})
export class SharedModule {}
export class SharedModule {
}
......@@ -13,9 +13,13 @@
// limitations under the License.
// Shared resource types
export interface TypeMeta { kind: string; }
export interface TypeMeta {
kind: string;
}
export interface ListMeta { totalItems: number; }
export interface ListMeta {
totalItems: number;
}
export interface ObjectMeta {
name: string;
......@@ -49,7 +53,9 @@ export interface ResourceOwner extends Resource {
initContainerImages: string[];
}
export interface LabelSelector { matchLabels: StringMap; }
export interface LabelSelector {
matchLabels: StringMap;
}
export interface CapacityItem {
resourceName: string;
......@@ -57,9 +63,13 @@ export interface CapacityItem {
}
// List types
export interface ClusterRoleList extends ResourceList { items: ClusterRole[]; }
export interface ClusterRoleList extends ResourceList {
items: ClusterRole[];
}
export interface ConfigMapList extends ResourceList { items: ConfigMap[]; }
export interface ConfigMapList extends ResourceList {
items: ConfigMap[];
}
export interface CronJobList extends ResourceList {
items: CronJob[];
......@@ -76,30 +86,46 @@ export interface DeploymentList extends ResourceList {
status: Status;
}
export interface EndpointList extends ResourceList { endpoints: Endpoint[]; }
export interface EndpointList extends ResourceList {
endpoints: Endpoint[];
}
export interface EventList extends ResourceList { events: Event[]; }
export interface EventList extends ResourceList {
events: Event[];
}
export interface HorizontalPodAutoscalerList extends ResourceList {
horizontalpodautoscalers: HorizontalPodAutoscaler[];
}
export interface IngressList extends ResourceList { items: Ingress[]; }
export interface IngressList extends ResourceList {
items: Ingress[];
}
export interface JobList extends ResourceList {
jobs: Job[];
status: Status;
}
export interface NamespaceList extends ResourceList { namespaces: Namespace[]; }
export interface NamespaceList extends ResourceList {
namespaces: Namespace[];
}
export interface NodeList extends ResourceList { nodes: Node[]; }
export interface NodeList extends ResourceList {
nodes: Node[];
}
export interface PersistentVolumeClaimList extends ResourceList { items: PersistentVolumeClaim[]; }
export interface PersistentVolumeClaimList extends ResourceList {
items: PersistentVolumeClaim[];
}
export interface PersistentVolumeList extends ResourceList { items: PersistentVolume[]; }
export interface PersistentVolumeList extends ResourceList {
items: PersistentVolume[];
}
export interface PodContainerList { containers: string[]; }
export interface PodContainerList {
containers: string[];
}
export interface PodList extends ResourceList {
pods: Pod[];
......@@ -118,18 +144,26 @@ export interface ReplicationControllerList extends ResourceList {
status: Status;
}
export interface ResourceQuotaDetailList extends ResourceList { items: ResourceQuotaDetail[]; }
export interface ResourceQuotaDetailList extends ResourceList {
items: ResourceQuotaDetail[];
}
export interface SecretList extends ResourceList { secrets: Secret[]; }
export interface SecretList extends ResourceList {
secrets: Secret[];
}
export interface ServiceList extends ResourceList { services: Service[]; }
export interface ServiceList extends ResourceList {
services: Service[];
}
export interface StatefulSetList extends ResourceList {
statefulSets: StatefulSet[];
status: Status;
}
export interface StorageClassList extends ResourceList { storageClasses: StorageClass[]; }
export interface StorageClassList extends ResourceList {
storageClasses: StorageClass[];
}
// Simple detail types
export interface ClusterRole extends Resource {}
......@@ -161,7 +195,9 @@ export interface Deployment extends Resource {
initContainerImages: string[];
}
export interface EndpointResourceList extends ResourceList { endpoints: EndpointResource[]; }
export interface EndpointResourceList extends ResourceList {
endpoints: EndpointResource[];
}
export interface EndpointResource extends Resource {
host: string;
......@@ -207,7 +243,9 @@ export interface HorizontalPodAutoscaler extends Resource {
targetCPUUtilization?: number;
}
export interface Ingress extends Resource { endpoints: Endpoint[]; }
export interface Ingress extends Resource {
endpoints: Endpoint[];
}
export interface Job extends Resource {
pods: PodInfo;
......@@ -216,9 +254,13 @@ export interface Job extends Resource {
parallelism: number;
}
export interface Namespace extends Resource { phase: string; }
export interface Namespace extends Resource {
phase: string;
}
export interface Node extends Resource { ready: string; }
export interface Node extends Resource {
ready: string;
}
export interface PersistentVolume extends Resource {
capacity: StringMap;
......@@ -261,7 +303,9 @@ export interface ReplicationController extends Resource {
initContainerImages: string[];
}
export interface Secret extends Resource { type: string; }
export interface Secret extends Resource {
type: string;
}
export interface Service extends Resource {
internalEndpoint: Endpoint;
......@@ -359,7 +403,9 @@ export interface PolicyRule {
nonResourceURLs: string[];
}
export interface ClusterRoleDetail extends ResourceDetail { rules: PolicyRule[]; }
export interface ClusterRoleDetail extends ResourceDetail {
rules: PolicyRule[];
}
export interface SecretDetail extends ResourceDetail {
type: string;
......@@ -376,9 +422,13 @@ export interface PersistentVolumeClaimDetail extends ResourceDetail {
accessModes: string[];
}
export interface StorageClassDetail extends ResourceDetail { parameters: StringMap; }
export interface StorageClassDetail extends ResourceDetail {
parameters: StringMap;
}
export interface ConfigMapDetail extends ResourceDetail { data: StringMap; }
export interface ConfigMapDetail extends ResourceDetail {
data: StringMap;
}
export interface JobDetail extends ResourceDetail {
podInfo: PodInfo;
......@@ -464,7 +514,9 @@ export interface HorizontalPodAutoscalerDetail extends ResourceDetail {
}
// Validation types
export interface AppNameValidity { valid: boolean; }
export interface AppNameValidity {
valid: boolean;
}
export interface AppNameValiditySpec {
name: string;
......@@ -476,9 +528,13 @@ export interface ImageReferenceValidity {
reason: string;
}
export interface ImageReferenceValiditySpec { reference: string; }
export interface ImageReferenceValiditySpec {
reference: string;
}
export interface ProtocolValidity { valid: boolean; }
export interface ProtocolValidity {
valid: boolean;
}
export interface ProtocolValiditySpec {
protocol: string;
......@@ -491,7 +547,9 @@ export interface AuthResponse {
errors: K8sError[];
}
export interface CanIResponse { allowed: boolean; }
export interface CanIResponse {
allowed: boolean;
}
export interface LoginSpec {
username: string;
......@@ -530,11 +588,17 @@ export interface AppDeploymentSpec {
runAsPrivileged: boolean;
}
export interface CsrfToken { token: string; }
export interface CsrfToken {
token: string;
}
export interface LocalSettings { isThemeDark: boolean; }
export interface LocalSettings {
isThemeDark: boolean;
}
export interface AppConfig { serverTime: number; }
export interface AppConfig {
serverTime: number;
}
interface StringMap {
[key: string]: string;
......@@ -548,7 +612,9 @@ export interface ErrStatus {
}
/* tslint:disable */
export interface K8sError { ErrStatus: ErrStatus; }
export interface K8sError {
ErrStatus: ErrStatus;
}
/* tslint:enable */
export interface Condition {
......@@ -560,7 +626,9 @@ export interface Condition {
message: string;
}
export interface ContainerStateWaiting { reason: string; }
export interface ContainerStateWaiting {
reason: string;
}
export interface ContainerStateTerminated {
reason: string;
......@@ -729,7 +797,9 @@ export interface AWSElasticBlockStorageVolumeSource {
readOnly: boolean;
}
export interface HostPathVolumeSource { path: string; }
export interface HostPathVolumeSource {
path: string;
}
export interface GlusterfsVolumeSource {
endpoints: string;
......@@ -754,7 +824,9 @@ export interface RBDVolumeSource {
readOnly: boolean;
}
export interface LocalObjectReference { name: string; }
export interface LocalObjectReference {
name: string;
}
/* tslint:disable */
export interface ISCSIVolumeSource {
......@@ -788,7 +860,9 @@ export interface FCVolumeSource {
readOnly: boolean;
}
export interface FlockerVolumeSource { datasetName: string; }
export interface FlockerVolumeSource {
datasetName: string;
}
export interface RollingUpdateStrategy {
maxSurge: (number|string);
......@@ -802,16 +876,22 @@ export interface DeploymentInfo {
unavailable: number;
}
export interface ReplicationControllerSpec { replicas: number; }
export interface ReplicationControllerSpec {
replicas: number;
}
export interface ReplicaCounts {
desiredReplicas: number;
actualReplicas: number;
}
export interface DeleteReplicationControllerSpec { deleteServices: boolean; }
export interface DeleteReplicationControllerSpec {
deleteServices: boolean;
}
export interface NamespaceSpec { name: string; }
export interface NamespaceSpec {
name: string;
}
export interface ReplicationControllerPodWithContainers {
name: string;
......@@ -820,7 +900,9 @@ export interface ReplicationControllerPodWithContainers {
podContainers: PodContainer[];
}
export interface ReplicationControllerPods { pods: ReplicationControllerPodWithContainers[]; }
export interface ReplicationControllerPods {
pods: ReplicationControllerPodWithContainers[];
}
export interface LogSources {
podNames: string[];
......@@ -860,7 +942,9 @@ export interface LogLineReference {
lineNum: number;
}
export interface Protocols { protocols: string[]; }
export interface Protocols {
protocols: string[];
}
export interface SecretSpec {
name: string;
......@@ -889,7 +973,9 @@ export interface GlobalSettings {
autoRefreshTimeInterval: number;
}
export interface APIVersion { name: string; }
export interface APIVersion {
name: string;
}
export interface LoginSpec {
username: string;
......@@ -909,13 +995,19 @@ export interface LoginStatus {
httpsMode: boolean;
}
export interface TokenRefreshSpec { jweToken: string; }
export interface TokenRefreshSpec {
jweToken: string;
}
export interface LoginModesResponse { modes: string[]; }
export interface LoginModesResponse {
modes: string[];
}
export type AuthenticationMode = string;
export interface EnabledAuthenticationModes { modes: AuthenticationMode[]; }
export interface EnabledAuthenticationModes {
modes: AuthenticationMode[];
}
export interface SystemBanner {
message: string;
......
......@@ -33,7 +33,9 @@ export type onSettingsFailCallback = (err?: KdError|K8sError) => void;
export type onLogin = (errors?: K8sError[]) => void;
export interface KnownErrors { unauthorized: KdError; }
export interface KnownErrors {
unauthorized: KdError;
}
export interface KdError {
status: string;
......@@ -64,7 +66,9 @@ export interface ActionColumn {
setObjectMeta(objectMeta: ObjectMeta): void;
}
export interface HTMLInputEvent extends Event { target: HTMLInputElement&EventTarget; }
export interface HTMLInputEvent extends Event {
target: HTMLInputElement&EventTarget;
}
export interface KdFile {
name: string;
......
// Copyright (c) 2013 Dave Collins <dave@davec.name>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// NOTE: Due to the following build constraints, this file will only be compiled
// when both cgo is supported and "-tags testcgo" is added to the go test
// command line. This code should really only be in the dumpcgo_test.go file,
// but unfortunately Go will not allow cgo in test files, so this is a
// workaround to allow cgo types to be tested. This configuration is used
// because spew itself does not require cgo to run even though it does handle
// certain cgo types specially. Rather than forcing all clients to require cgo
// and an external C compiler just to run the tests, this scheme makes them
// optional.
// +build cgo,testcgo
package testdata
/*
#include <stdint.h>
typedef unsigned char custom_uchar_t;
char *ncp = 0;
char *cp = "test";
char ca[6] = {'t', 'e', 's', 't', '2', '\0'};
unsigned char uca[6] = {'t', 'e', 's', 't', '3', '\0'};
signed char sca[6] = {'t', 'e', 's', 't', '4', '\0'};
uint8_t ui8ta[6] = {'t', 'e', 's', 't', '5', '\0'};
custom_uchar_t tuca[6] = {'t', 'e', 's', 't', '6', '\0'};
*/
import "C"
// GetCgoNullCharPointer returns a null char pointer via cgo. This is only
// used for tests.
func GetCgoNullCharPointer() interface{} {
return C.ncp
}
// GetCgoCharPointer returns a char pointer via cgo. This is only used for
// tests.
func GetCgoCharPointer() interface{} {
return C.cp
}
// GetCgoCharArray returns a char array via cgo and the array's len and cap.
// This is only used for tests.
func GetCgoCharArray() (interface{}, int, int) {
return C.ca, len(C.ca), cap(C.ca)
}
// GetCgoUnsignedCharArray returns an unsigned char array via cgo and the
// array's len and cap. This is only used for tests.
func GetCgoUnsignedCharArray() (interface{}, int, int) {
return C.uca, len(C.uca), cap(C.uca)
}
// GetCgoSignedCharArray returns a signed char array via cgo and the array's len
// and cap. This is only used for tests.
func GetCgoSignedCharArray() (interface{}, int, int) {
return C.sca, len(C.sca), cap(C.sca)
}
// GetCgoUint8tArray returns a uint8_t array via cgo and the array's len and
// cap. This is only used for tests.
func GetCgoUint8tArray() (interface{}, int, int) {
return C.ui8ta, len(C.ui8ta), cap(C.ui8ta)
}
// GetCgoTypdefedUnsignedCharArray returns a typedefed unsigned char array via
// cgo and the array's len and cap. This is only used for tests.
func GetCgoTypdefedUnsignedCharArray() (interface{}, int, int) {
return C.tuca, len(C.tuca), cap(C.tuca)
}
package test_package
type TestStruct struct {
TestField string
}
/*
Copyright 2017 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
// +k8s:openapi-gen=false
// +groupName=admission.k8s.io
package v1alpha1 // import "k8s.io/api/admission/v1alpha1"
此差异已折叠。
/*
Copyright 2017 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 v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name for this API.
const GroupName = "admission.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&AdmissionReview{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
/*
Copyright 2017 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 v1alpha1
import (
authenticationv1 "k8s.io/api/authentication/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// AdmissionReview describes an admission request.
type AdmissionReview struct {
metav1.TypeMeta `json:",inline"`
// Spec describes the attributes for the admission request.
// Since this admission controller is non-mutating the webhook should avoid setting this in its response to avoid the
// cost of deserializing it.
// +optional
Spec AdmissionReviewSpec `json:"spec,omitempty" protobuf:"bytes,1,opt,name=spec"`
// Status is filled in by the webhook and indicates whether the admission request should be permitted.
// +optional
Status AdmissionReviewStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
}
// AdmissionReviewSpec describes the admission.Attributes for the admission request.
type AdmissionReviewSpec struct {
// Kind is the type of object being manipulated. For example: Pod
Kind metav1.GroupVersionKind `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
// Object is the object from the incoming request prior to default values being applied
Object runtime.RawExtension `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"`
// OldObject is the existing object. Only populated for UPDATE requests.
// +optional
OldObject runtime.RawExtension `json:"oldObject,omitempty" protobuf:"bytes,3,opt,name=oldObject"`
// Operation is the operation being performed
Operation Operation `json:"operation,omitempty" protobuf:"bytes,4,opt,name=operation"`
// Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
// rely on the server to generate the name. If that is the case, this method will return the empty string.
// +optional
Name string `json:"name,omitempty" protobuf:"bytes,5,opt,name=name"`
// Namespace is the namespace associated with the request (if any).
// +optional
Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"`
// Resource is the name of the resource being requested. This is not the kind. For example: pods
Resource metav1.GroupVersionResource `json:"resource,omitempty" protobuf:"bytes,7,opt,name=resource"`
// SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent
// resource, but it may have a different kind. For instance, /pods has the resource "pods" and the kind "Pod", while
// /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod" (because status operates on
// pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource
// "binding", and kind "Binding".
// +optional
SubResource string `json:"subResource,omitempty" protobuf:"bytes,8,opt,name=subResource"`
// UserInfo is information about the requesting user
UserInfo authenticationv1.UserInfo `json:"userInfo,omitempty" protobuf:"bytes,9,opt,name=userInfo"`
}
// AdmissionReviewStatus describes the status of the admission request.
type AdmissionReviewStatus struct {
// Allowed indicates whether or not the admission request was permitted.
Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"`
// Result contains extra details into why an admission request was denied.
// This field IS NOT consulted in any way if "Allowed" is "true".
// +optional
Result *metav1.Status `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
}
// Operation is the type of resource operation being checked for admission control
type Operation string
// Operation constants
const (
Create Operation = "CREATE"
Update Operation = "UPDATE"
Delete Operation = "DELETE"
Connect Operation = "CONNECT"
)
/*
Copyright 2016 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 v1alpha1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_AdmissionReview = map[string]string{
"": "AdmissionReview describes an admission request.",
"spec": "Spec describes the attributes for the admission request. Since this admission controller is non-mutating the webhook should avoid setting this in its response to avoid the cost of deserializing it.",
"status": "Status is filled in by the webhook and indicates whether the admission request should be permitted.",
}
func (AdmissionReview) SwaggerDoc() map[string]string {
return map_AdmissionReview
}
var map_AdmissionReviewSpec = map[string]string{
"": "AdmissionReviewSpec describes the admission.Attributes for the admission request.",
"kind": "Kind is the type of object being manipulated. For example: Pod",
"object": "Object is the object from the incoming request prior to default values being applied",
"oldObject": "OldObject is the existing object. Only populated for UPDATE requests.",
"operation": "Operation is the operation being performed",
"name": "Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and rely on the server to generate the name. If that is the case, this method will return the empty string.",
"namespace": "Namespace is the namespace associated with the request (if any).",
"resource": "Resource is the name of the resource being requested. This is not the kind. For example: pods",
"subResource": "SubResource is the name of the subresource being requested. This is a different resource, scoped to the parent resource, but it may have a different kind. For instance, /pods has the resource \"pods\" and the kind \"Pod\", while /pods/foo/status has the resource \"pods\", the sub resource \"status\", and the kind \"Pod\" (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource \"pods\", subresource \"binding\", and kind \"Binding\".",
"userInfo": "UserInfo is information about the requesting user",
}
func (AdmissionReviewSpec) SwaggerDoc() map[string]string {
return map_AdmissionReviewSpec
}
var map_AdmissionReviewStatus = map[string]string{
"": "AdmissionReviewStatus describes the status of the admission request.",
"allowed": "Allowed indicates whether or not the admission request was permitted.",
"status": "Result contains extra details into why an admission request was denied. This field IS NOT consulted in any way if \"Allowed\" is \"true\".",
}
func (AdmissionReviewStatus) SwaggerDoc() map[string]string {
return map_AdmissionReviewStatus
}
// AUTO-GENERATED FUNCTIONS END HERE
// +build !ignore_autogenerated
/*
Copyright 2017 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.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
//
// Deprecated: deepcopy registration will go away when static deepcopy is fully implemented.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AdmissionReview).DeepCopyInto(out.(*AdmissionReview))
return nil
}, InType: reflect.TypeOf(&AdmissionReview{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AdmissionReviewSpec).DeepCopyInto(out.(*AdmissionReviewSpec))
return nil
}, InType: reflect.TypeOf(&AdmissionReviewSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*AdmissionReviewStatus).DeepCopyInto(out.(*AdmissionReviewStatus))
return nil
}, InType: reflect.TypeOf(&AdmissionReviewStatus{})},
)
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdmissionReview) DeepCopyInto(out *AdmissionReview) {
*out = *in
out.TypeMeta = in.TypeMeta
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReview.
func (in *AdmissionReview) DeepCopy() *AdmissionReview {
if in == nil {
return nil
}
out := new(AdmissionReview)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AdmissionReview) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdmissionReviewSpec) DeepCopyInto(out *AdmissionReviewSpec) {
*out = *in
out.Kind = in.Kind
in.Object.DeepCopyInto(&out.Object)
in.OldObject.DeepCopyInto(&out.OldObject)
out.Resource = in.Resource
in.UserInfo.DeepCopyInto(&out.UserInfo)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReviewSpec.
func (in *AdmissionReviewSpec) DeepCopy() *AdmissionReviewSpec {
if in == nil {
return nil
}
out := new(AdmissionReviewSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AdmissionReviewStatus) DeepCopyInto(out *AdmissionReviewStatus) {
*out = *in
if in.Result != nil {
in, out := &in.Result, &out.Result
if *in == nil {
*out = nil
} else {
*out = new(v1.Status)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdmissionReviewStatus.
func (in *AdmissionReviewStatus) DeepCopy() *AdmissionReviewStatus {
if in == nil {
return nil
}
out := new(AdmissionReviewStatus)
in.DeepCopyInto(out)
return out
}
/*
Copyright 2017 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.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
admissionregistration_v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1alpha1 "k8s.io/client-go/listers/admissionregistration/v1alpha1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// ExternalAdmissionHookConfigurationInformer provides access to a shared informer and lister for
// ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ExternalAdmissionHookConfigurationLister
}
type externalAdmissionHookConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
// NewExternalAdmissionHookConfigurationInformer constructs a new informer for ExternalAdmissionHookConfiguration type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewExternalAdmissionHookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations().Watch(options)
},
},
&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{},
resyncPeriod,
indexers,
)
}
func defaultExternalAdmissionHookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewExternalAdmissionHookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
}
func (f *externalAdmissionHookConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{}, defaultExternalAdmissionHookConfigurationInformer)
}
func (f *externalAdmissionHookConfigurationInformer) Lister() v1alpha1.ExternalAdmissionHookConfigurationLister {
return v1alpha1.NewExternalAdmissionHookConfigurationLister(f.Informer().GetIndexer())
}
/*
Copyright 2017 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.
*/
// This file was automatically generated by informer-gen
package v1beta1
import (
extensions_v1beta1 "k8s.io/api/extensions/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/extensions/v1beta1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// ThirdPartyResourceInformer provides access to a shared informer and lister for
// ThirdPartyResources.
type ThirdPartyResourceInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ThirdPartyResourceLister
}
type thirdPartyResourceInformer struct {
factory internalinterfaces.SharedInformerFactory
}
// NewThirdPartyResourceInformer constructs a new informer for ThirdPartyResource type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewThirdPartyResourceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.ExtensionsV1beta1().ThirdPartyResources().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.ExtensionsV1beta1().ThirdPartyResources().Watch(options)
},
},
&extensions_v1beta1.ThirdPartyResource{},
resyncPeriod,
indexers,
)
}
func defaultThirdPartyResourceInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewThirdPartyResourceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
}
func (f *thirdPartyResourceInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&extensions_v1beta1.ThirdPartyResource{}, defaultThirdPartyResourceInformer)
}
func (f *thirdPartyResourceInformer) Lister() v1beta1.ThirdPartyResourceLister {
return v1beta1.NewThirdPartyResourceLister(f.Informer().GetIndexer())
}
/*
Copyright 2017 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.
*/
// This file was automatically generated by lister-gen
package v1alpha1
import (
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ExternalAdmissionHookConfigurationLister helps list ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationLister interface {
// List lists all ExternalAdmissionHookConfigurations in the indexer.
List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error)
// Get retrieves the ExternalAdmissionHookConfiguration from the index for a given name.
Get(name string) (*v1alpha1.ExternalAdmissionHookConfiguration, error)
ExternalAdmissionHookConfigurationListerExpansion
}
// externalAdmissionHookConfigurationLister implements the ExternalAdmissionHookConfigurationLister interface.
type externalAdmissionHookConfigurationLister struct {
indexer cache.Indexer
}
// NewExternalAdmissionHookConfigurationLister returns a new ExternalAdmissionHookConfigurationLister.
func NewExternalAdmissionHookConfigurationLister(indexer cache.Indexer) ExternalAdmissionHookConfigurationLister {
return &externalAdmissionHookConfigurationLister{indexer: indexer}
}
// List lists all ExternalAdmissionHookConfigurations in the indexer.
func (s *externalAdmissionHookConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.ExternalAdmissionHookConfiguration, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ExternalAdmissionHookConfiguration))
})
return ret, err
}
// Get retrieves the ExternalAdmissionHookConfiguration from the index for a given name.
func (s *externalAdmissionHookConfigurationLister) Get(name string) (*v1alpha1.ExternalAdmissionHookConfiguration, error) {
key := &v1alpha1.ExternalAdmissionHookConfiguration{ObjectMeta: v1.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("externaladmissionhookconfiguration"), name)
}
return obj.(*v1alpha1.ExternalAdmissionHookConfiguration), nil
}
/*
Copyright 2017 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.
*/
// This file was automatically generated by lister-gen
package v1beta1
import (
v1beta1 "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ThirdPartyResourceLister helps list ThirdPartyResources.
type ThirdPartyResourceLister interface {
// List lists all ThirdPartyResources in the indexer.
List(selector labels.Selector) (ret []*v1beta1.ThirdPartyResource, err error)
// Get retrieves the ThirdPartyResource from the index for a given name.
Get(name string) (*v1beta1.ThirdPartyResource, error)
ThirdPartyResourceListerExpansion
}
// thirdPartyResourceLister implements the ThirdPartyResourceLister interface.
type thirdPartyResourceLister struct {
indexer cache.Indexer
}
// NewThirdPartyResourceLister returns a new ThirdPartyResourceLister.
func NewThirdPartyResourceLister(indexer cache.Indexer) ThirdPartyResourceLister {
return &thirdPartyResourceLister{indexer: indexer}
}
// List lists all ThirdPartyResources in the indexer.
func (s *thirdPartyResourceLister) List(selector labels.Selector) (ret []*v1beta1.ThirdPartyResource, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ThirdPartyResource))
})
return ret, err
}
// Get retrieves the ThirdPartyResource from the index for a given name.
func (s *thirdPartyResourceLister) Get(name string) (*v1beta1.ThirdPartyResource, error) {
key := &v1beta1.ThirdPartyResource{ObjectMeta: v1.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("thirdpartyresource"), name)
}
return obj.(*v1beta1.ThirdPartyResource), nil
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册