func buildFrameworkSchema()

in pkg/apis/frameworkcontroller/v1/crd.go [62:172]


func buildFrameworkSchema() *apiExtensions.CustomResourceValidation {
	return &apiExtensions.CustomResourceValidation{
		OpenAPIV3Schema: &apiExtensions.JSONSchemaProps{
			Type: "object",
			Properties: map[string]apiExtensions.JSONSchemaProps{
				"metadata": {
					Type: "object",
					Properties: map[string]apiExtensions.JSONSchemaProps{
						"name": {
							Type:    "string",
							Pattern: NamingConvention,
						},
					},
				},
				"spec": {
					Type: "object",
					Properties: map[string]apiExtensions.JSONSchemaProps{
						"description": {
							Type:     "string",
							Nullable: true,
						},
						"executionType": {
							Type: "string",
							Enum: []apiExtensions.JSON{
								{Raw: []byte(common.Quote(string(ExecutionCreate)))},
								{Raw: []byte(common.Quote(string(ExecutionStart)))},
								{Raw: []byte(common.Quote(string(ExecutionStop)))},
							},
						},
						"retryPolicy": {
							Type: "object",
							Properties: map[string]apiExtensions.JSONSchemaProps{
								"maxRetryCount": {
									Type:    "integer",
									Minimum: common.PtrFloat64(ExtendedUnlimitedValue),
								},
								"fancyRetryPolicy": {
									Type: "boolean",
								},
							},
						},
						"taskRoles": {
							// TODO: names in array should not duplicate
							Type: "array",
							Items: &apiExtensions.JSONSchemaPropsOrArray{
								Schema: &apiExtensions.JSONSchemaProps{
									Type: "object",
									Properties: map[string]apiExtensions.JSONSchemaProps{
										"name": {
											Type:    "string",
											Pattern: NamingConvention,
										},
										"taskNumber": {
											Type:    "integer",
											Minimum: common.PtrFloat64(0),
											Maximum: common.PtrFloat64(10000),
										},
										"frameworkAttemptCompletionPolicy": {
											Type: "object",
											Properties: map[string]apiExtensions.JSONSchemaProps{
												"minFailedTaskCount": {
													Type: "integer",
													// TODO: should not allow 0
													Minimum: common.PtrFloat64(UnlimitedValue),
												},
												"minSucceededTaskCount": {
													Type: "integer",
													// TODO: should not allow 0
													Minimum: common.PtrFloat64(UnlimitedValue),
												},
											},
										},
										"task": {
											Type: "object",
											Properties: map[string]apiExtensions.JSONSchemaProps{
												"retryPolicy": {
													Type: "object",
													Properties: map[string]apiExtensions.JSONSchemaProps{
														"maxRetryCount": {
															Type:    "integer",
															Minimum: common.PtrFloat64(ExtendedUnlimitedValue),
														},
														"fancyRetryPolicy": {
															Type: "boolean",
														},
													},
												},
												"podGracefulDeletionTimeoutSec": {
													Type: "integer",
												},
												"pod": {
													Type:                   "object",
													XPreserveUnknownFields: common.PtrBool(true),
												},
											},
										},
									},
								},
							},
						},
					},
				},
				"status": {
					Type:                   "object",
					Nullable:               true,
					XPreserveUnknownFields: common.PtrBool(true),
				},
			},
		},
	}
}