Skip to content

Commit

Permalink
fix: add flinkImageRepository field to the Artifact (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
austince authored Oct 2, 2019
1 parent 5542ecb commit 4e26f70
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 34 deletions.
33 changes: 19 additions & 14 deletions api/v1beta1/converters/deployment_spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var _ = Describe("DeploymentSpec", func() {
var artifactEntryClass = "com.fintechstudios.streaming"
var artifactFlinkVersion = "1.8.0"
var artifactFlinkRegistry = "registry.docker.com"
var artifactFlinkRepository = "v1.4/flink"
var artifactFlinkTag = "1.8.0_scala1.12"

Describe("DeploymentSpecToNative", func() {
Expand Down Expand Up @@ -78,13 +79,14 @@ var _ = Describe("DeploymentSpec", func() {
},
Spec: &vpAPI.DeploymentTemplateSpec{
Artifact: &vpAPI.Artifact{
Kind: artifactKind,
JarUri: artifactJarUri,
MainArgs: artifactArgs,
EntryClass: artifactEntryClass,
FlinkVersion: artifactFlinkVersion,
FlinkImageRegistry: artifactFlinkRegistry,
FlinkImageTag: artifactFlinkTag,
Kind: artifactKind,
JarUri: artifactJarUri,
MainArgs: artifactArgs,
EntryClass: artifactEntryClass,
FlinkVersion: artifactFlinkVersion,
FlinkImageRegistry: artifactFlinkRegistry,
FlinkImageRepository: artifactFlinkRepository,
FlinkImageTag: artifactFlinkTag,
},
Parallelism: deploymentParallelism,
NumberOfTaskManagers: deploymentNumTaskManagers,
Expand Down Expand Up @@ -129,6 +131,7 @@ var _ = Describe("DeploymentSpec", func() {
Expect(artifact.FlinkImageTag).To(Equal(artifactFlinkTag))
Expect(artifact.FlinkVersion).To(Equal(artifactFlinkVersion))
Expect(artifact.FlinkImageRegistry).To(Equal(artifactFlinkRegistry))
Expect(artifact.FlinkImageRepository).To(Equal(artifactFlinkRepository))
Expect(artifact.EntryClass).To(Equal(artifactEntryClass))
Expect(artifact.MainArgs).To(Equal(artifactArgs))
Expect(artifact.Kind).To(Equal(artifactKind))
Expand Down Expand Up @@ -199,13 +202,14 @@ var _ = Describe("DeploymentSpec", func() {
},
Spec: &ververicaplatformv1beta1.VpDeploymentTemplateSpec{
Artifact: &ververicaplatformv1beta1.VpArtifact{
Kind: artifactKind,
JarUri: artifactJarUri,
MainArgs: artifactArgs,
EntryClass: artifactEntryClass,
FlinkVersion: artifactFlinkVersion,
FlinkImageRegistry: artifactFlinkRegistry,
FlinkImageTag: artifactFlinkTag,
Kind: artifactKind,
JarUri: artifactJarUri,
MainArgs: artifactArgs,
EntryClass: artifactEntryClass,
FlinkVersion: artifactFlinkVersion,
FlinkImageRegistry: artifactFlinkRegistry,
FlinkImageRepository: artifactFlinkRepository,
FlinkImageTag: artifactFlinkTag,
},
Parallelism: &deploymentParallelism,
NumberOfTaskManagers: &deploymentNumTaskManagers,
Expand Down Expand Up @@ -250,6 +254,7 @@ var _ = Describe("DeploymentSpec", func() {
Expect(artifact.FlinkImageTag).To(Equal(artifactFlinkTag))
Expect(artifact.FlinkVersion).To(Equal(artifactFlinkVersion))
Expect(artifact.FlinkImageRegistry).To(Equal(artifactFlinkRegistry))
Expect(artifact.FlinkImageRepository).To(Equal(artifactFlinkRepository))
Expect(artifact.EntryClass).To(Equal(artifactEntryClass))
Expect(artifact.MainArgs).To(Equal(artifactArgs))
Expect(artifact.Kind).To(Equal(artifactKind))
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/converters/deployment_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
ververicaplatformv1beta1 "github.com/fintechstudios/ververica-platform-k8s-controller/api/v1beta1"
)

//DeploymentStateToNative converts a Ververica Platform deployment into its native K8s representation
// DeploymentStateToNative converts a Ververica Platform deployment into its native K8s representation
func DeploymentStateToNative(state string) (ververicaplatformv1beta1.DeploymentState, error) {
switch state {
case string(ververicaplatformv1beta1.CancelledState):
Expand Down
3 changes: 3 additions & 0 deletions api/v1beta1/vpdeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ type VpArtifact struct {
// +optional
FlinkImageRegistry string `json:"flinkImageRegistry,omitempty"`
// +optional
FlinkImageRepository string `json:"flinkImageRepository,omitempty"`
// +optional
FlinkImageTag string `json:"flinkImageTag,omitempty"`
}

Expand Down Expand Up @@ -298,6 +300,7 @@ type VpDeploymentStatus struct {
// +kubebuilder:printcolumn:name="Flink-Version",type="string",JSONPath=".spec.spec.template.spec.artifact.flinkVersion"
// +kubebuilder:printcolumn:name="Flink-Image-Tag",type="string",JSONPath=".spec.spec.template.spec.artifact.flinkImageTag"
// +kubebuilder:printcolumn:name="Flink-Image-Registry",type="string",JSONPath=".spec.spec.template.spec.artifact.flinkImageRegistry"
// +kubebuilder:printcolumn:name="Flink-Image-Repository",type="string",JSONPath=".spec.spec.template.spec.artifact.flinkImageRepository"

// VpDeployment is the Schema for the vpdeployments API
type VpDeployment struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ spec:
- JSONPath: .spec.spec.template.spec.artifact.flinkImageRegistry
name: Flink-Image-Registry
type: string
- JSONPath: .spec.spec.template.spec.artifact.flinkImageRepository
name: Flink-Image-Repository
type: string
group: ververicaplatform.fintechstudios.com
names:
kind: VpDeployment
Expand Down Expand Up @@ -141,6 +144,8 @@ spec:
type: string
flinkImageRegistry:
type: string
flinkImageRepository:
type: string
flinkImageTag:
type: string
flinkVersion:
Expand All @@ -167,8 +172,6 @@ spec:
description: VpPods are the K8s specific options
properties:
affinity:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down Expand Up @@ -227,8 +230,6 @@ spec:
value:
type: string
valueFrom:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down Expand Up @@ -291,8 +292,6 @@ spec:
type: string
type: object
securityContext:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down Expand Up @@ -339,8 +338,6 @@ spec:
type: object
tolerations:
items:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down Expand Up @@ -394,8 +391,6 @@ spec:
name:
type: string
volume:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down Expand Up @@ -441,8 +436,6 @@ spec:
type: boolean
type: object
volumeMount:
description: VpJsonNode is odd - seems incorrect
but TBD
properties:
array:
type: boolean
Expand Down
1 change: 1 addition & 0 deletions config/samples/ververicaplatform_v1beta1_vpdeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
entryClass: org.apache.flink.streaming.examples.windowing.TopSpeedWindowing
flinkVersion: "1.8"
flinkImageRegistry: registry.platform.data-artisans.net/dist
flinkImageRepository: v1.4/flink
flinkImageTag: 1.8.0-stream2-scala_2.11
parallelism: 1
numberOfTaskManagers: 1
Expand Down
15 changes: 8 additions & 7 deletions ververica-platform-api/model_artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
package ververicaplatformapi

type Artifact struct {
Kind string `json:"kind"`
JarUri string `json:"jarUri"`
MainArgs string `json:"mainArgs,omitempty"`
EntryClass string `json:"entryClass,omitempty"`
FlinkVersion string `json:"flinkVersion,omitempty"`
FlinkImageRegistry string `json:"flinkImageRegistry,omitempty"`
FlinkImageTag string `json:"flinkImageTag,omitempty"`
Kind string `json:"kind"`
JarUri string `json:"jarUri"`
MainArgs string `json:"mainArgs,omitempty"`
EntryClass string `json:"entryClass,omitempty"`
FlinkVersion string `json:"flinkVersion,omitempty"`
FlinkImageRegistry string `json:"flinkImageRegistry,omitempty"`
FlinkImageRepository string `json:"flinkImageRepository,omitempty"`
FlinkImageTag string `json:"flinkImageTag,omitempty"`
}
3 changes: 3 additions & 0 deletions ververica-platform-swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,9 @@
"flinkImageRegistry": {
"type": "string"
},
"flinkImageRepository": {
"type": "string"
},
"flinkImageTag": {
"type": "string"
}
Expand Down

0 comments on commit 4e26f70

Please sign in to comment.