Skip to content

flussonic/central-operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

central-operator

Description

The central-operator deploys central's instances and performs monitoring and management of them.

The functions of the operator include:

  • Deploying instances of Central
  • Performing database migrations
  • Detecting Flussonics in the cluster and automatically adding them to Central

Getting Started

Steps to launch a cluster with multiple instances of Central and Flussonic.

Apply the Central and Media Server operators so that Kubernetes recognizes the CRDs and runs operator instances waiting for the corresponding resources to appear in the cluster:

kubectl apply -f https://flussonic.github.io/media-server-operator/latest/operator.yaml
kubectl apply -f https://flussonic.github.io/central-operator/latest/operator.yaml

Next, label the nodes accordingly and add the necessary secrets:

kubectl label nodes node_name flussonic.com/streamer=true
kubectl create secret generic flussonic-license \
    --from-literal=license_key="${LICENSE_KEY}" \
    --from-literal=edit_auth="root:password"

* node_name - the name of the node where Flussonic should run. Flussonic instances will be deployed on each node labeled accordingly.

Then, add the required custom resources so that the operators can deploy and provision the corresponding standard Kubernetes resources:

kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/ingress.yaml
kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/media_v1alpha1_mediaserver.yaml
kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/media_v1alpha1_central.yaml
kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/postgres.yaml
kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/redis.yaml

Note: Currently, Central works correctly only with Nginx as the ingress controller (required by the agent). If another controller is used by default, remove it from Kubernetes and apply the ingress-nginx manifests:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
kubectl apply -f https://raw.githubusercontent.com/flussonic/central-operator/master/config/samples/nginx_ingress_class.yaml

If all the above steps are completed successfully, the cluster should include PostgreSQL, Redis, two Central instances, and one Flussonic instance per each labeled node.

For developers

The project was generated using operator-sdk.

To generate the documentation, update the version in the Makefile to the current one and run:

make operator.yaml

To launch the cluster on multipass and k3s, run:

make mp-start

The script is configured to build the controller locally and transfer it to the nodes.

If you need to run the cluster using the controller image from Docker Hub, execute mp-start.sh directly.

Deployment Workflow

We use a semi-automated GitOps workflow. The CI pipeline builds artifacts automatically on every commit to master, but the deployment to the cluster is triggered by updating the GitOps repository.

1. Prepare Changes

Before merging your changes to master, you MUST increment the version if you want to release a new build.

  1. Update Version: Change the VERSION variable in the Makefile.
    • Warning: If you do not change the version, the existing Docker image and manifests for that version will be overwritten in the registry.
  2. Generate Manifest: Run make operator.yaml to generate the installation manifest for the new version.
  3. Commit and Merge: Push your changes and merge them into the master branch.

2. CI/CD Pipeline

Once merged to master, the GitLab CI pipeline will automatically:

  • Build and Push Image: Build the Docker image and push it to Docker Hub.
  • Publish Manifests: Push the generated docs/ folder to the Github. The new operator manifest will be available at: https://flussonic.github.io/central-operator/<version>/operator.yaml

3. Deploy to Cluster

To apply the new version to the cluster (Stage or Prod), you need to update the GitOps repository (peeklio_cluster).

  1. Update Kustomization:
    • For Stage: Edit central-operator/overlays/stage/kustomization.yaml.
    • For Prod: Edit central-operator/base/kustomization.yaml
  2. Change Resource URL: Update the link to point to the new version
  3. Commit and Push: Commit and push the change.
  4. Sync: ArgoCD detects the configuration change, you may need to manually trigger the Sync to apply the update.

License

Copyright 2024.

Licensed 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.

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published