################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# Base ClusterServiceVersion template containing static information
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
  annotations:
    alm-examples: |-
      [
        {
          "apiVersion":"flink.apache.org/v1beta1",
          "kind":"FlinkDeployment",
          "metadata":{
              "name":"basic-example"
          },
          "spec":{
              "image":"flink:1.16",
              "flinkVersion":"v1_16",
              "flinkConfiguration":{
                  "taskmanager.numberOfTaskSlots":"2"
              },
              "serviceAccount":"flink",
              "jobManager":{
                  "resource":{
                      "memory":"2048m",
                      "cpu":1
                  }
              },
              "taskManager":{
                  "resource":{
                      "memory":"2048m",
                      "cpu":1
                  }
              },
              "job":{
                  "jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar",
                  "parallelism":2,
                  "upgradeMode":"stateless"
              }
          }
        },
        {
          "apiVersion":"flink.apache.org/v1beta1",
          "kind":"FlinkSessionJob",
          "metadata":{
            "name":"basic-session-job-example2"
          },
          "spec":{
            "deploymentName":"basic-session-cluster",
            "job":{
                "jarURI":"https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming_2.12/1.16.1/flink-examples-streaming_2.12-1.16.1.jar",
                "parallelism":2,
                "upgradeMode":"stateless",
                "entryClass":"org.apache.flink.streaming.examples.statemachine.StateMachineExample"
            }
          }
        }
      ]
    alm-examples-metadata: |-
      {
        "basic-example": {
          "description": "Example flink deployment"
        },
        "basic-session-job-example2": {
          "description": "Example flink session job"
        }
      }
    capabilities: Deep Insights
    categories: Big Data, Streaming & Messaging
    containerImage: docker.io/apache/flink-kubernetes-operator:1.1.0
    createdAt: "2022-07-01T00:00:00Z"
    description: Flink Kubernetes Operator manages the complete deployment lifecycle
      of Apache Flink applications.
    operators.operatorframework.io/builder: operator-sdk-v1.23.0
    operators.operatorframework.io/project_layout: unknown
    repository: https://github.com/apache/flink-kubernetes-operator.git
    support: Apache Software Foundation
  name: flink-kubernetes-operator.v1.1.0
spec:
  apiservicedefinitions: {}
  customresourcedefinitions:
    owned:
    - kind: FlinkDeployment
      name: flinkdeployments.flink.apache.org
      version: v1beta1
      displayName: Flink Deployment
      description: The FlinkDeployment CR defines Flink Application and Session cluster deployments
    - kind: FlinkSessionJob
      name: flinksessionjobs.flink.apache.org
      version: v1beta1
      displayName: Flink Session Job
      description: The FlinkSessionJob CR defines the session job on the Session cluster and each Session cluster can run multiple FlinkSessionJob.
  description: |-
    Flink Kubernetes Operator acts as a control plane to manage the complete deployment lifecycle of Apache Flink applications.
    ## Installation
    This operator can be installed from [OperatorHub.io](https://operatorhub.io/operator/flink-kubernetes-operator).

    By default, the Flink operator monitors and run Flink applications in the same namespace as the operator.
    To run Flink jobs in another namespace, users are responsible for setting up the RBAC in that namespace.

    For example, users need to do the following for each additional namespace that runs the Flink applications:

    1. Switch to the namespace by running:

        ```sh
        kubectl config set-context --current --namespace=CHANGEIT
        ```

    2. Create the service account, role, and role binding in the namespace using the commands below:

        ```sh
        kubectl apply -f - <<EOF
        apiVersion: v1
        kind: ServiceAccount
        metadata:
          labels:
            app.kubernetes.io/name: flink-kubernetes-operator
            app.kubernetes.io/version: RELEASE_VERSION
          name: flink
        ---
        apiVersion: rbac.authorization.k8s.io/v1
        kind: Role
        metadata:
          labels:
            app.kubernetes.io/name: flink-kubernetes-operator
            app.kubernetes.io/version: RELEASE_VERSION
          name: flink
        rules:
        - apiGroups:
          - ""
          resources:
          - pods
          - configmaps
          verbs:
          - '*'
        - apiGroups:
          - apps
          resources:
          - deployments
          - deployments/finalizers
          verbs:
          - '*'
        ---
        apiVersion: rbac.authorization.k8s.io/v1
        kind: RoleBinding
        metadata:
          labels:
            app.kubernetes.io/name: flink-kubernetes-operator
            app.kubernetes.io/version: RELEASE_VERSION
          name: flink-role-binding
        roleRef:
          apiGroup: rbac.authorization.k8s.io
          kind: Role
          name: flink
        subjects:
        - kind: ServiceAccount
          name: flink
        EOF
        ```

    3. Proceed deploying Flink applications using the the Custom Resource Definition below.

        ```sh
        kubectl create -f https://raw.githubusercontent.com/apache/flink-kubernetes-operator/release-RELEASE_VERSION/examples/basic.yaml
        ```

    See [Flink custom resources](https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/custom-resource/overview/#overview) for more detail.
  displayName: Flink Kubernetes Operator
  icon:
  - base64data: [encoded data, 109136 characters]
    mediatype: image/svg+xml
  install:
    spec: null
    strategy: deployment
  installModes:
  - supported: true
    type: OwnNamespace
  - supported: true
    type: SingleNamespace
  - supported: true
    type: MultiNamespace
  - supported: true
    type: AllNamespaces
  keywords:
  - flink
  - streaming
  maintainers:
  - email: mbalassi@apache.org
    name: Marton Balassi
  - email: htchang@us.ibm.com
    name: Ted Chang
  - email: jbusche@us.ibm.com
    name: James Busche
  maturity: beta
  links:
    - name: Website
      url: https://flink.apache.org/
    - name: Documentation
      url: https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/
    - name: Mailing list
      url: https://lists.apache.org/list.html?dev@flink.apache.org
    - name: Slack
      url: https://apache-flink.slack.com/join/shared_invite/zt-1llkzbgyt-K2nNGGg88rfsDGLkT09Qzg#/shared-invite/email
    - name: GitHub
      url: https://github.com/apache/flink-kubernetes-operator
  provider:
    name: Community
    url: https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main/docs/try-flink-kubernetes-operator/quick-start/
  replaces:
  version: 1.1.0
  minKubeVersion: 1.16.0

