Skip to content

Commit

Permalink
Use generated crd in integation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alvaroaleman committed Aug 28, 2021
1 parent d00c061 commit 9c7b0e2
Show file tree
Hide file tree
Showing 6 changed files with 40,179 additions and 176 deletions.
20,132 changes: 20,062 additions & 70 deletions config/prow/cluster/prowjob_customresourcedefinition.yaml

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ gen-spyglass-bindata(){
gen-prowjob-crd(){
clean "./config/prow/cluster" "prowjob_customresourcedefinition.yaml"
if [[ -z ${HOME:-} ]]; then export HOME=$PWD; fi
$controller_gen crd:preserveUnknownFields=false,crdVersions=v1beta1 paths=./prow/apis/prowjobs/v1 output:stdout |sed '/^$/d' >./config/prow/cluster/prowjob_customresourcedefinition.yaml
$controller_gen crd:preserveUnknownFields=false,crdVersions=v1 paths=./prow/apis/prowjobs/v1 output:stdout \
|sed '/^$/d' \
|sed '/^ annotations.*/a \ api-approved.kubernetes.io: https://github.com/kubernetes/test-infra/pull/8669' \
> ./config/prow/cluster/prowjob_customresourcedefinition.yaml
cp ./config/prow/cluster/prowjob_customresourcedefinition.yaml prow/test/integration/prow/cluster/50_crd.yaml
copyfiles "./config/prow/cluster" "prowjob_customresourcedefinition.yaml"
copyfiles "./prow/test/integration/prow/cluster/" "50_crd.yaml"
unset HOME
}

Expand All @@ -194,10 +199,10 @@ export GOSUMDB=sum.golang.org
export PATH=$PATH:$go_sdk/bin
export GO111MODULE=off
export GOCACHE=$old
#gen-deepcopy
#gen-client
#gen-lister
#gen-informer
#gen-spyglass-bindata
gen-deepcopy
gen-client
gen-lister
gen-informer
gen-spyglass-bindata
gen-prowjob-crd
export GO111MODULE=on
21 changes: 18 additions & 3 deletions prow/apis/prowjobs/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ProwJob contains the spec as well as runtime metadata.
// +kubebuilder:printcolumn:name="Job",type=string,JSONPath=`.spec.job`,description="The name of the job being run"
// +kubebuilder:printcolumn:name="BuildId",type=string,JSONPath=`.status.build_id`,description="The ID of the job being run."
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,description="The type of job being run."
// +kubebuilder:printcolumn:name="Org",type=string,JSONPath=`.spec.refs.org`,description="The org for which the job is running."
// +kubebuilder:printcolumn:name="Repo",type=string,JSONPath=`.spec.refs.repo`,description="The repo for which the job is running."
// +kubebuilder:printcolumn:name="Pulls",type=string,JSONPath=`.spec.refs.pulls[*].number`,description="The pulls for which the job is running."
// +kubebuilder:printcolumn:name="StartTime",type=date,JSONPath=`.status.startTime`,description="When the job started running."
// +kubebuilder:printcolumn:name="CompletionTime",type=date,JSONPath=`.status.completionTime`,description="When the job finished running."
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`,description="The state of the job."
type ProwJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -115,6 +124,8 @@ type ProwJob struct {
type ProwJobSpec struct {
// Type is the type of job and informs how
// the jobs is triggered
// +kubebuilder:validation:Enum=presubmit;postsubmit;periodic;batch
// +kubebuilder:validation:Required
Type ProwJobType `json:"type,omitempty"`
// Agent determines which controller fulfills
// this specific ProwJobSpec and runs the job
Expand All @@ -126,6 +137,7 @@ type ProwJobSpec struct {
// Namespace defines where to create pods/resources.
Namespace string `json:"namespace,omitempty"`
// Job is the name of the job
// +kubebuilder:validation:Required
Job string `json:"job,omitempty"`
// Refs is the code under test, determined at
// runtime by Prow itself
Expand All @@ -144,6 +156,7 @@ type ProwJobSpec struct {
RerunCommand string `json:"rerun_command,omitempty"`
// MaxConcurrency restricts the total number of instances
// of this job that can run in parallel at once
// +kubebuilder:validation:Minimum=0
MaxConcurrency int `json:"max_concurrency,omitempty"`
// ErrorOnEviction indicates that the ProwJob should be completed and given
// the ErrorState status if the pod that is executing the job is evicted.
Expand Down Expand Up @@ -840,9 +853,11 @@ type ProwJobStatus struct {
PendingTime *metav1.Time `json:"pendingTime,omitempty"`
// CompletionTime is the timestamp for when the job goes to a final state
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
State ProwJobState `json:"state,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
// +kubebuilder:validation:Enum=triggered;pending;success;failure;aborted;error
// +kubebuilder:validation:Required
State ProwJobState `json:"state,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`

// PodName applies only to ProwJobs fulfilled by
// plank. This field should always be the same as
Expand Down
96 changes: 0 additions & 96 deletions prow/test/integration/prow/cluster/100_starter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,99 +18,3 @@ metadata:
name: kubeconfig
stringData:
config: ""
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: prowjobs.prow.k8s.io
annotations:
"api-approved.kubernetes.io": "https://github.com/kubernetes/test-infra/pull/8669"
spec:
group: prow.k8s.io
names:
kind: ProwJob
singular: prowjob
plural: prowjobs
scope: Namespaced
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
max_concurrency:
type: integer
minimum: 0
type:
type: string
enum:
- "presubmit"
- "postsubmit"
- "periodic"
- "batch"
status:
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
state:
type: string
enum:
- "triggered"
- "pending"
- "success"
- "failure"
- "aborted"
- "error"
anyOf:
- not:
properties:
state:
enum:
- "success"
- "failure"
- "error"
- required:
- completionTime
additionalPrinterColumns:
- name: Job
type: string
description: The name of the job being run.
jsonPath: .spec.job
- name: BuildId
type: string
description: The ID of the job being run.
jsonPath: .status.build_id
- name: Type
type: string
description: The type of job being run.
jsonPath: .spec.type
- name: Org
type: string
description: The org for which the job is running.
jsonPath: .spec.refs.org
- name: Repo
type: string
description: The repo for which the job is running.
jsonPath: .spec.refs.repo
- name: Pulls
type: string
description: The pulls for which the job is running.
jsonPath: ".spec.refs.pulls[*].number"
- name: StartTime
type: date
description: When the job started running.
jsonPath: .status.startTime
- name: CompletionTime
type: date
description: When the job finished running.
jsonPath: .status.completionTime
- name: State
description: The state of the job.
type: string
jsonPath: .status.state
Loading

0 comments on commit 9c7b0e2

Please sign in to comment.