diff --git a/Makefile b/Makefile index ba5dd64e..d55cec4c 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ test-python-sdk: ./hack/python-sdk/test-sdk.sh .PHONY: verify -verify: vet fmt-verify ci-lint manifests generate toc-verify +verify: vet fmt-verify ci-lint manifests generate toc-verify generate-apiref git --no-pager diff --exit-code config api client-go @@ -294,4 +294,14 @@ golangci-lint: ## Download golangci-lint locally if necessary. GOTESTSUM = $(shell pwd)/bin/gotestsum .PHONY: gotestsum gotestsum: ## Download gotestsum locally if necessary. - @GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install gotest.tools/gotestsum@v1.8.2 \ No newline at end of file + @GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install gotest.tools/gotestsum@v1.8.2 + + +.PHONY: generate-apiref +generate-apiref: genref + cd $(PROJECT_DIR)/hack/genref/ && $(GENREF) -o $(PROJECT_DIR)/site/content/en/docs/reference + +GENREF = $(PROJECT_DIR)/bin/genref +.PHONY: genref +genref: ## Download genref locally if necessary. + @GOBIN=$(PROJECT_DIR)/bin $(GO_CMD) install github.com/kubernetes-sigs/reference-docs/genref@v0.28.0 \ No newline at end of file diff --git a/hack/genref/config.yaml b/hack/genref/config.yaml new file mode 100644 index 00000000..be3b7ef5 --- /dev/null +++ b/hack/genref/config.yaml @@ -0,0 +1,20 @@ +# more details can be found https://github.com/kubernetes-sigs/reference-docs/tree/master/genref +hiddenMemberFields: + - "TypeMeta" + - "ObjectMeta" + +apis: + - name: jobset + title: JobSet API + package: sigs.k8s.io/jobset + path: api/jobset/v1alpha2 + +externalPackages: + - match: ^k8s\.io/(api|apimachinery/pkg/apis)/ + target: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#{{- lower .TypeIdentifier -}}-{{- arrIndex .PackageSegments -1 -}}-{{- arrIndex .PackageSegments -2 -}} + - match: ^k8s\.io/apimachinery/pkg/api/resource\.Quantity$ + target: https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity + - match: ^k8s.io/component-base/config/v1alpha1. + target: https://pkg.go.dev/k8s.io/component-base/config/v1alpha1#{{- .TypeIdentifier -}} + - match: ^time\.Duration$ + target: https://pkg.go.dev/time#Duration diff --git a/hack/genref/markdown/members.tpl b/hack/genref/markdown/members.tpl new file mode 100644 index 00000000..b9702186 --- /dev/null +++ b/hack/genref/markdown/members.tpl @@ -0,0 +1,34 @@ +{{ define "members" }} + {{/* . is a apiType */}} + {{- range .GetMembers -}} + {{/* . is a apiMember */}} + {{- if not .Hidden }} +
{{ .FieldName }}
+ {{- if not .IsOptional }} [Required]{{- end -}}
+{{ .DisplayName }}
+ {{- else -}}
+{{ .DisplayName }}
+ {{- end -}}
+ {{- end }}
+{{ .FieldName }}
are embedded into this type.)
+ {{- end }}
+ {{ if .GetComment -}}
+ {{ .GetComment }}
+ {{- else -}}
+ No description provided.
+ {{- end }}
+ {{- if and (eq (.GetType.Name.Name) "ObjectMeta") -}}
+Refer to the Kubernetes API documentation for the fields of the metadata
field.
+ {{- end -}}
+Field | Description |
---|---|
apiVersion string | {{- .APIGroup -}} |
kind string | {{- .Name.Name -}} |
JobSet is the Schema for the jobsets API
+ + +Field | Description |
---|---|
apiVersion string | jobset.x-k8s.io/v1alpha2 |
kind string | JobSet |
spec [Required]+ JobSetSpec
+ |
++ No description provided. | +
status [Required]+ JobSetStatus
+ |
++ No description provided. | +
Field | Description |
---|---|
maxRestarts [Required]+ int32
+ |
+
+ MaxRestarts defines the limit on the number of JobSet restarts. +A restart is achieved by recreating all active child jobs. + |
+
rules [Required]+ []FailurePolicyRule
+ |
+
+ List of failure policy rules for this JobSet. +For a given Job failure, the rules will be evaluated in order, +and only the first matching rule will be executed. +If no matching rule is found, the RestartJobSet action is applied. + |
+
FailurePolicyAction defines the action the JobSet controller will take for +a given FailurePolicyRule.
+ + + + +## `FailurePolicyRule` {#jobset-x-k8s-io-v1alpha2-FailurePolicyRule} + + +**Appears in:** + +- [FailurePolicy](#jobset-x-k8s-io-v1alpha2-FailurePolicy) + + +FailurePolicyRule defines a FailurePolicyAction to be executed if a child job +fails due to a reason listed in OnJobFailureReasons.
+ + +Field | Description |
---|---|
name [Required]+ string
+ |
+
+ The name of the failure policy rule. +The name is defaulted to 'failurePolicyRuleN' where N is the index of the failure policy rule. +The name must match the regular expression "^A-Za-z?$". + |
+
action [Required]+ FailurePolicyAction
+ |
+
+ The action to take if the rule is matched. + |
+
onJobFailureReasons [Required]+ []string
+ |
+
+ The requirement on the job failure reasons. The requirement +is satisfied if at least one reason matches the list. +The rules are evaluated in order, and the first matching +rule is executed. +An empty list applies the rule to any job failure reason. + |
+
targetReplicatedJobs + []string
+ |
+
+ TargetReplicatedJobs are the names of the replicated jobs the operator applies to. +An empty list will apply to all replicatedJobs. + |
+
JobSetSpec defines the desired state of JobSet
+ + +Field | Description |
---|---|
replicatedJobs [Required]+ []ReplicatedJob
+ |
+
+ ReplicatedJobs is the group of jobs that will form the set. + |
+
network + Network
+ |
+
+ Network defines the networking options for the jobset. + |
+
successPolicy [Required]+ SuccessPolicy
+ |
+
+ SuccessPolicy configures when to declare the JobSet as +succeeded. +The JobSet is always declared succeeded if all jobs in the set +finished with status complete. + |
+
failurePolicy [Required]+ FailurePolicy
+ |
+
+ FailurePolicy, if set, configures when to declare the JobSet as +failed. +The JobSet is always declared failed if any job in the set +finished with status failed. + |
+
startupPolicy [Required]+ StartupPolicy
+ |
+
+ StartupPolicy, if set, configures in what order jobs must be started + |
+
suspend [Required]+ bool
+ |
+
+ Suspend suspends all running child Jobs when set to true. + |
+
managedBy + string
+ |
+
+ ManagedBy is used to indicate the controller or entity that manages a JobSet.
+The built-in JobSet controller reconciles JobSets which don't have this
+field at all or the field value is the reserved string
+ The value must be a valid domain-prefixed path (e.g. acme.io/foo) - +all characters before the first "/" must be a valid subdomain as defined +by RFC 1123. All characters trailing the first "/" must be valid HTTP Path +characters as defined by RFC 3986. The value cannot exceed 63 characters. +The field is immutable. + |
+
ttlSecondsAfterFinished + int32
+ |
+
+ TTLSecondsAfterFinished limits the lifetime of a JobSet that has finished +execution (either Complete or Failed). If this field is set, +TTLSecondsAfterFinished after the JobSet finishes, it is eligible to be +automatically deleted. When the JobSet is being deleted, its lifecycle +guarantees (e.g. finalizers) will be honored. If this field is unset, +the JobSet won't be automatically deleted. If this field is set to zero, +the JobSet becomes eligible to be deleted immediately after it finishes. + |
+
JobSetStatus defines the observed state of JobSet
+ + +Field | Description |
---|---|
conditions + []k8s.io/apimachinery/pkg/apis/meta/v1.Condition
+ |
++ No description provided. | +
restarts [Required]+ int32
+ |
+
+ Restarts tracks the number of times the JobSet has restarted (i.e. recreated in case of RecreateAll policy). + |
+
restartsCountTowardsMax [Required]+ int32
+ |
+
+ RestartsCountTowardsMax tracks the number of times the JobSet has restarted that counts towards the maximum allowed number of restarts. + |
+
terminalState [Required]+ string
+ |
+
+ TerminalState the state of the JobSet when it finishes execution. +It can be either Complete or Failed. Otherwise, it is empty by default. + |
+
replicatedJobsStatus + []ReplicatedJobStatus
+ |
+
+ ReplicatedJobsStatus track the number of JobsReady for each replicatedJob. + |
+
Field | Description |
---|---|
enableDNSHostnames + bool
+ |
+
+ EnableDNSHostnames allows pods to be reached via their hostnames. +Pods will be reachable using the fully qualified pod hostname: +<jobSet.name>-<spec.replicatedJob.name>--. + |
+
subdomain + string
+ |
+
+ Subdomain is an explicit choice for a network subdomain name +When set, any replicated job in the set is added to this network. +Defaults to <jobSet.name> if not set. + |
+
publishNotReadyAddresses + bool
+ |
+
+ Indicates if DNS records of pods should be published before the pods are ready. +Defaults to True. + |
+
Operator defines the target of a SuccessPolicy or FailurePolicy.
+ + + + +## `ReplicatedJob` {#jobset-x-k8s-io-v1alpha2-ReplicatedJob} + + +**Appears in:** + +- [JobSetSpec](#jobset-x-k8s-io-v1alpha2-JobSetSpec) + + + +Field | Description |
---|---|
name [Required]+ string
+ |
+
+ Name is the name of the entry and will be used as a suffix +for the Job name. + |
+
template [Required]+ k8s.io/api/batch/v1.JobTemplateSpec
+ |
+
+ Template defines the template of the Job that will be created. + |
+
replicas [Required]+ int32
+ |
+
+ Replicas is the number of jobs that will be created from this ReplicatedJob's template. +Jobs names will be in the format: <jobSet.name>-<spec.replicatedJob.name>- + |
+
ReplicatedJobStatus defines the observed ReplicatedJobs Readiness.
+ + +Field | Description |
---|---|
name [Required]+ string
+ |
+
+ Name of the ReplicatedJob. + |
+
ready [Required]+ int32
+ |
+
+ Ready is the number of child Jobs where the number of ready pods and completed pods +is greater than or equal to the total expected pod count for the Job (i.e., the minimum +of job.spec.parallelism and job.spec.completions). + |
+
succeeded [Required]+ int32
+ |
+
+ Succeeded is the number of successfully completed child Jobs. + |
+
failed [Required]+ int32
+ |
+
+ Failed is the number of failed child Jobs. + |
+
active [Required]+ int32
+ |
+
+ Active is the number of child Jobs with at least 1 pod in a running or pending state +which are not marked for deletion. + |
+
suspended [Required]+ int32
+ |
+
+ Suspended is the number of child Jobs which are in a suspended state. + |
+
Field | Description |
---|---|
startupPolicyOrder [Required]+ StartupPolicyOptions
+ |
+
+ StartupPolicyOrder determines the startup order of the ReplicatedJobs. +AnyOrder means to start replicated jobs in any order. +InOrder means to start them as they are listed in the JobSet. A ReplicatedJob is started only +when all the jobs of the previous one are ready. + |
+
Field | Description |
---|---|
operator [Required]+ Operator
+ |
+
+ Operator determines either All or Any of the selected jobs should succeed to consider the JobSet successful + |
+
targetReplicatedJobs + []string
+ |
+
+ TargetReplicatedJobs are the names of the replicated jobs the operator will apply to. +A null or empty list will apply to all replicatedJobs. + |
+