Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omitempty corrections #2255

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/v1beta2/scheduledsparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ type ScheduledSparkApplicationStatus struct {
// ScheduledSparkApplication is the Schema for the scheduledsparkapplications API.
type ScheduledSparkApplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.ObjectMeta `json:"metadata"`

Spec ScheduledSparkApplicationSpec `json:"spec,omitempty"`
Spec ScheduledSparkApplicationSpec `json:"spec"`
Status ScheduledSparkApplicationStatus `json:"status,omitempty"`
}

Expand Down
13 changes: 6 additions & 7 deletions api/v1beta2/sparkapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ type SparkApplicationSpec struct {
// +optional
MainClass *string `json:"mainClass,omitempty"`
// MainFile is the path to a bundled JAR, Python, or R file of the application.
// +optional
MainApplicationFile *string `json:"mainApplicationFile"`
// Arguments is a list of arguments to be passed to the application.
// +optional
Expand Down Expand Up @@ -187,9 +186,9 @@ type SparkApplicationStatus struct {
// SparkApplication is the Schema for the sparkapplications API
type SparkApplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.ObjectMeta `json:"metadata"`

Spec SparkApplicationSpec `json:"spec,omitempty"`
Spec SparkApplicationSpec `json:"spec"`
Status SparkApplicationStatus `json:"status,omitempty"`
}

Expand Down Expand Up @@ -280,15 +279,15 @@ type SparkUIConfiguration struct {
// ServicePort allows configuring the port at service level that might be different from the targetPort.
// TargetPort should be the same as the one defined in spark.ui.port
// +optional
ServicePort *int32 `json:"servicePort"`
ServicePort *int32 `json:"servicePort,omitempty"`
// ServicePortName allows configuring the name of the service port.
// This may be useful for sidecar proxies like Envoy injected by Istio which require specific ports names to treat traffic as proper HTTP.
// Defaults to spark-driver-ui-port.
// +optional
ServicePortName *string `json:"servicePortName"`
ServicePortName *string `json:"servicePortName,omitempty"`
// ServiceType allows configuring the type of the service. Defaults to ClusterIP.
// +optional
ServiceType *corev1.ServiceType `json:"serviceType"`
ServiceType *corev1.ServiceType `json:"serviceType,omitempty"`
// ServiceAnnotations is a map of key,value pairs of annotations that might be added to the service object.
// +optional
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
Expand All @@ -312,7 +311,7 @@ type DriverIngressConfiguration struct {
ServicePortName *string `json:"servicePortName"`
// ServiceType allows configuring the type of the service. Defaults to ClusterIP.
// +optional
ServiceType *corev1.ServiceType `json:"serviceType"`
ServiceType *corev1.ServiceType `json:"serviceType,omitempty"`
// ServiceAnnotations is a map of key,value pairs of annotations that might be added to the service object.
// +optional
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11573,6 +11573,7 @@ spec:
required:
- driver
- executor
- mainApplicationFile
- sparkVersion
- type
type: object
Expand Down Expand Up @@ -11621,6 +11622,9 @@ spec:
application.
type: string
type: object
required:
- metadata
- spec
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11475,6 +11475,7 @@ spec:
required:
- driver
- executor
- mainApplicationFile
- sparkVersion
- type
type: object
Expand Down Expand Up @@ -11555,6 +11556,9 @@ spec:
required:
- driverInfo
type: object
required:
- metadata
- spec
type: object
served: true
storage: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11573,6 +11573,7 @@ spec:
required:
- driver
- executor
- mainApplicationFile
- sparkVersion
- type
type: object
Expand Down Expand Up @@ -11621,6 +11622,9 @@ spec:
application.
type: string
type: object
required:
- metadata
- spec
type: object
served: true
storage: true
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/sparkoperator.k8s.io_sparkapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11475,6 +11475,7 @@ spec:
required:
- driver
- executor
- mainApplicationFile
- sparkVersion
- type
type: object
Expand Down Expand Up @@ -11555,6 +11556,9 @@ spec:
required:
- driverInfo
type: object
required:
- metadata
- spec
type: object
served: true
storage: true
Expand Down
2 changes: 0 additions & 2 deletions docs/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,6 @@ string
</em>
</td>
<td>
<em>(Optional)</em>
<p>MainFile is the path to a bundled JAR, Python, or R file of the application.</p>
</td>
</tr>
Expand Down Expand Up @@ -2355,7 +2354,6 @@ string
</em>
</td>
<td>
<em>(Optional)</em>
<p>MainFile is the path to a bundled JAR, Python, or R file of the application.</p>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/kubeflow/spark-operator/api/v1beta2"
"github.com/kubeflow/spark-operator/pkg/util"
)

var _ = Describe("ScheduledSparkApplication Controller", func() {
Expand Down Expand Up @@ -61,6 +62,7 @@ var _ = Describe("ScheduledSparkApplication Controller", func() {
RestartPolicy: v1beta2.RestartPolicy{
Type: v1beta2.RestartPolicyNever,
},
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
},
// TODO(user): Specify other spec details if needed.
Expand Down
15 changes: 15 additions & 0 deletions internal/controller/sparkapplication/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ var _ = Describe("SparkApplication Controller", func() {
common.LabelSparkAppName: app.Name,
},
},
Spec: v1beta2.SparkApplicationSpec{
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
}
v1beta2.SetSparkApplicationDefaults(app)
Expect(k8sClient.Create(ctx, app)).To(Succeed())
Expand Down Expand Up @@ -146,6 +149,9 @@ var _ = Describe("SparkApplication Controller", func() {
Name: appName,
Namespace: appNamespace,
},
Spec: v1beta2.SparkApplicationSpec{
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
}
v1beta2.SetSparkApplicationDefaults(app)
Expect(k8sClient.Create(ctx, app)).To(Succeed())
Expand Down Expand Up @@ -202,6 +208,9 @@ var _ = Describe("SparkApplication Controller", func() {
Name: appName,
Namespace: appNamespace,
},
Spec: v1beta2.SparkApplicationSpec{
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
}
v1beta2.SetSparkApplicationDefaults(app)
Expect(k8sClient.Create(ctx, app)).To(Succeed())
Expand Down Expand Up @@ -253,6 +262,9 @@ var _ = Describe("SparkApplication Controller", func() {
Name: appName,
Namespace: appNamespace,
},
Spec: v1beta2.SparkApplicationSpec{
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
}
v1beta2.SetSparkApplicationDefaults(app)
Expect(k8sClient.Create(ctx, app)).To(Succeed())
Expand Down Expand Up @@ -309,6 +321,9 @@ var _ = Describe("SparkApplication Controller", func() {
Name: appName,
Namespace: appNamespace,
},
Spec: v1beta2.SparkApplicationSpec{
MainApplicationFile: util.StringPtr("local:///dummy.jar"),
},
}
v1beta2.SetSparkApplicationDefaults(app)
Expect(k8sClient.Create(ctx, app)).To(Succeed())
Expand Down