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

[Feature]: Add deploy examples of operators #2

Open
1 task done
lwpk110 opened this issue May 21, 2024 · 0 comments
Open
1 task done

[Feature]: Add deploy examples of operators #2

lwpk110 opened this issue May 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@lwpk110
Copy link
Member

lwpk110 commented May 21, 2024

Duplicates

  • I have searched the existing issues

Summary 💡

We can create a folder called examples , which contains some subfolders. These subfolders can be named after the names of operators we have developed, such as trino, kafka, etc. each subfolder containers 5 yml files, the file struct like below:

.
├── examples
│   ├── dolphinscheduler
│   │   ├── catalog.yaml
│   │   ├── cluster.yaml
│   │   ├── namespace.yaml
│   │   ├── operator-group.yaml
│   │   ├── subscription.yaml
│   └── kafka
│       ├── catalog.yaml
│       ├── cluster.yaml
│       ├── namespace.yaml
│       ├── operator-group.yaml
│       ├── subscription.yaml
│       └── sub.yaml

  • catalog.yml : CatalogSource of current operatpr;
  • cluster.yml: Customr resource of current operator;
  • namespace: Namespaces required that deploy the current operator;
  • operator-group.yml : OperatorGroup of current operator
  • subscription.yml : Subscription of current operator

After defining all the example resources, we apply all these resources through the kubectl command to quickly start a cluster

Examples 🌈

Next, i will give some example resource code below, take kafka as an example:

catalog.yaml

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: kds-catalog
  namespace: olm
spec:
  sourceType: grpc
  grpcPodConfig:
    securityContextConfig: restricted
  image: quay.io/zncdatadev/catalog:latest
  displayName: kds catalog
  publisher: zncdata-labs
  updateStrategy:
    registryPoll:
      interval: 5m

Notice
All operator example reference a same CatalogSource named kds-catalog that using the same image quay.io/zncdatadev/catalog:latest

cluster.yaml

apiVersion: kafka.zncdata.dev/v1alpha1
kind: KafkaCluster
metadata:
  labels:
    app.kubernetes.io/name: kafkacluster
    app.kubernetes.io/instance: kafkacluster-sample
    app.kubernetes.io/part-of: kafka-operator
    app.kubernetes.io/managed-by: kustomize
    app.kubernetes.io/created-by: kafka-operator
  name: kafkacluster-sample
spec:
  image:
    repository: docker.io/bitnami/kafka
  clusterConfig:
    zookeeperDiscoveryZNode: "sample-kafka-znode"
  brokers:
    roleGroups:
      default:
        replicas: 2
        config:
          resources:
            cpu:
              min: 1
              max: 2
            memory:
              limit: "3Gi"
          logging:
            broker:
              loggers:
                test:
                  level: DEBUG
              console:
                level: WARN
              file:
                level: ERROR
          ssl:
            enabled: true
            jksPassword: "123456789"

namespace.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: kubedatastack-operators
---
apiVersion: v1
kind: Namespace
metadata:
  name: kubedatastack

operator-group.yaml

kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: kubedatastack
  namespace: kubedatastack-operators
spec:
  targetNamespaces:
  - kubedatastack

subscription.yaml

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: kafka-sub
  namespace: kubedatastack-operators
spec:
  channel: stable
  name: kafka-operator
  source: kafka-catalog
  sourceNamespace: olm
  installPlanApproval: Automated

Motivation 🔦

through the example , we can quick start to deploy a cluster , and give a example code for users

@lwpk110 lwpk110 added the enhancement New feature or request label May 21, 2024
@lwpk110 lwpk110 changed the title [FEATURE]Add deploy examples of operators [Feature]Add deploy examples of operators May 22, 2024
@tutunannan tutunannan changed the title [Feature]Add deploy examples of operators [Feature]: Add deploy examples of operators May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant