Skip to content

ingress configuration 'ingressAnnotations' and 'ingressTLSSecretName' #188

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ spec:
properties:
name:
type: string
ingressAnnotations:
description: May be used to configure the ingress objects
type: object
ingressTLSSecretName:
description: May be used to configure the ingress TLS
type: string
serviceAccountName:
type: string
securityContext:
Expand Down
3 changes: 3 additions & 0 deletions docs/quick-start-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ metadata:
selfLink: v1beta1
uid: a2855178-b29c-11e9-9a3b-025000000001
spec:
ingressAnnotations:
kubernetes.io/ingress.class: nginx
ingressTLSSecretName: "wordcount-secret-tls"
entryClass: org.apache.flink.WordCount
flinkConfig:
state.backend.fs.checkpointdir: file:///checkpoints/flink/checkpoints
Expand Down
5 changes: 5 additions & 0 deletions examples/beam-python/flink-operator-custom-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ metadata:
spec:
#image: docker.io/lyft/flinkk8soperator-example-beam:{sha}
image: flinkk8soperator-example-beam
# Any ingress annotations can be set there
# ingressAnnotations:
# kubernetes.io/ingress.class: nginx
# Declare the secret that stores the TLS key and cert
# ingressTLSSecretName: "tls-secret"
flinkConfig:
taskmanager.network.memory.fraction: 0.1
taskmanager.network.memory.min: 10m
Expand Down
6 changes: 5 additions & 1 deletion examples/wordcount/flink-operator-custom-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ apiVersion: flink.k8s.io/v1beta1
kind: FlinkApplication
metadata:
name: wordcount-operator-example
namespace: flink-operator
annotations:
labels:
environment: development
spec:
image: docker.io/lyft/wordcount-operator-example:{sha}
# Any ingress annotations can be set there
# ingressAnnotations:
# kubernetes.io/ingress.class: nginx
# Declare the secret that stores the TLS key and cert
# ingressTLSSecretName: "tls-secret"
deleteMode: None
flinkConfig:
taskmanager.heap.size: 200
Expand Down
28 changes: 15 additions & 13 deletions pkg/apis/app/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ type FlinkApplication struct {
}

type FlinkApplicationSpec struct {
Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"`
ImagePullPolicy apiv1.PullPolicy `json:"imagePullPolicy,omitempty" protobuf:"bytes,14,opt,name=imagePullPolicy,casttype=PullPolicy"`
ImagePullSecrets []apiv1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
SecurityContext *apiv1.PodSecurityContext `json:"securityContext,omitempty"`
FlinkConfig FlinkConfig `json:"flinkConfig"`
FlinkVersion string `json:"flinkVersion"`
TaskManagerConfig TaskManagerConfig `json:"taskManagerConfig,omitempty"`
JobManagerConfig JobManagerConfig `json:"jobManagerConfig,omitempty"`
JarName string `json:"jarName"`
Parallelism int32 `json:"parallelism"`
EntryClass string `json:"entryClass,omitempty"`
ProgramArgs string `json:"programArgs,omitempty"`
Image string `json:"image,omitempty" protobuf:"bytes,2,opt,name=image"`
ImagePullPolicy apiv1.PullPolicy `json:"imagePullPolicy,omitempty" protobuf:"bytes,14,opt,name=imagePullPolicy,casttype=PullPolicy"`
ImagePullSecrets []apiv1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
IngressAnnotations map[string]string `json:"ingressAnnotations,omitempty"`
IngressTLSSecretName string `json:"ingressTLSSecretName,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
SecurityContext *apiv1.PodSecurityContext `json:"securityContext,omitempty"`
FlinkConfig FlinkConfig `json:"flinkConfig"`
FlinkVersion string `json:"flinkVersion"`
TaskManagerConfig TaskManagerConfig `json:"taskManagerConfig,omitempty"`
JobManagerConfig JobManagerConfig `json:"jobManagerConfig,omitempty"`
JarName string `json:"jarName"`
Parallelism int32 `json:"parallelism"`
EntryClass string `json:"entryClass,omitempty"`
ProgramArgs string `json:"programArgs,omitempty"`
// Deprecated: use SavepointPath instead
SavepointInfo SavepointInfo `json:"savepointInfo,omitempty"`
SavepointPath string `json:"savepointPath,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/app/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions pkg/controller/flink/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1beta1.In
podLabels = common.CopyMap(podLabels, k8.GetAppLabel(app.Name))

ingressMeta := v1.ObjectMeta{
Name: app.Name,
Labels: podLabels,
Namespace: app.Namespace,
Name: app.Name,
Labels: podLabels,
Annotations: app.Spec.IngressAnnotations,
Namespace: app.Namespace,
OwnerReferences: []v1.OwnerReference{
*v1.NewControllerRef(app, app.GroupVersionKind()),
},
Expand All @@ -42,7 +43,6 @@ func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1beta1.In
IntVal: getUIPort(app),
},
}

ingressSpec := v1beta1.IngressSpec{
Rules: []v1beta1.IngressRule{{
Host: GetFlinkUIIngressURL(app.Name),
Expand All @@ -55,6 +55,14 @@ func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1beta1.In
},
}},
}
if app.Spec.IngressTLSSecretName != "" {
ingressSpec.TLS = []v1beta1.IngressTLS{
{
Hosts: []string{GetFlinkUIIngressURL(app.Name)},
SecretName: app.Spec.IngressTLSSecretName,
},
}
}
return &v1beta1.Ingress{
ObjectMeta: ingressMeta,
TypeMeta: v1.TypeMeta{
Expand Down