Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas committed Jun 23, 2021
1 parent 5f4f20a commit b89cfb9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/v1beta1/flinkcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ type JobSpec struct {
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`

// Job running mode
Mode *JobMode `json:"mode"`
Mode *JobMode `json:"mode,omitempty"`
}

// FlinkClusterSpec defines the desired state of FlinkCluster
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/flinkcluster_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ func (v *Validator) validateCleanupAction(

func (v *Validator) validateJobMode(property string, value JobMode) error {
switch value {
case JobModeBlocking:
case JobModeDetached:
default:
return fmt.Errorf("invalid %v: %v", property, value)
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,8 @@ spec:
type: array
jarFile:
type: string
mode:
type: string
noLoggingToStdout:
type: boolean
parallelism:
Expand Down
3 changes: 1 addition & 2 deletions controllers/flinkcluster_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,8 @@ func getDesiredJob(observed *ObservedClusterState) *batchv1.Job {

if jobSpec.Mode != nil {
switch *jobSpec.Mode {
case v1beta1.JobModeBlocking:
case v1beta1.JobModeDetached:
fallthrough
default:
jobArgs = append(jobArgs, "--detached")
}
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/flinkcluster_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestGetDesiredClusterState(t *testing.T) {
var memoryOffHeapRatio int32 = 25
var memoryOffHeapMin = resource.MustParse("600M")
var memoryProcessRatio int32 = 80
var jobMode v1beta1.JobMode = v1beta1.JobModeDetached
var jobMode v1beta1.JobMode = v1beta1.JobModeBlocking
var jobBackoffLimit int32 = 0
var jmReadinessProbe = corev1.Probe{
Handler: corev1.Handler{
Expand Down
4 changes: 2 additions & 2 deletions controllers/flinkcluster_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ func TestNewRevision(t *testing.T) {
var revision, _ = newRevision(&flinkCluster, 1, &collisionCount)
var expectedRevision = appsv1.ControllerRevision{
ObjectMeta: metav1.ObjectMeta{
Name: "mycluster-6889b5645c",
Name: "mycluster-7bc87c954f",
Namespace: "default",
Labels: map[string]string{
"flinkoperator.k8s.io/hash": "6889b5645c",
"flinkoperator.k8s.io/hash": "7bc87c954f",
"flinkoperator.k8s.io/managed-by": "mycluster",
},
Annotations: map[string]string{},
Expand Down

0 comments on commit b89cfb9

Please sign in to comment.