Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.
turbocoder edited this page Oct 22, 2018 · 4 revisions

What is OrchestrationDesk?

The goal behind this project is to have a single module to connect to orchestration services like [Marathon](https://mesosphere.github.io/marathon/), [Kubernetes](https://kubernetes.io/) etc. and get information about your application containers. With this information you can ping the containers, call api's for health check, notify services to perform some task etc.

What platform it's built on?

The orchestration desk is a node module. The purpose behind choosing node platform was so that it can be used in node application as well by web applications.

An example application of using Orchestration Desk?

  • Feature toggles are widely used. There are many frameworks available on internet for various platform for teams to look into and use in their services. Some teams may choose to write their own depending upon their architecture. One such requirement to fulfill in features toggles system is to refresh/update feature toggle to respected services without the need to redeploy. If the team is using orchestration services like marathon or kubernetes then orchestration desk will fulfill this requirement.

  • Marathon and Kubernetes are orchestration frameworks that allow teams to easily deploy their applications in forms of containers like docker containers and allow teams to easily manage them. These orchestration framework have extensive api to allow teams to write some tools they deem comfortable and necessary to manage life cycle of their applications. Orchestration Desk is designed and destined to help teams for this matter.

  • Containers running in orchestration frameworks like marathon don't have static IP and Ports. To get an IP and port of containers at runtime, we need to connect to marathon api. At present Orchestration Desk supports one feature of getting all ip addresses and ports of containers of application running in marathon. Now that we can get IP addresses and ports, team can build a tool on top of orchestration desk to make api call to containers and notify them of toggle change.

  • Below is an example code on how to refresh toggles given application info running as containers in marathon using Orchestration Desk.

`

import util from 'util';

import {Promise} from 'es6-promise';
import { URL } from 'url';

import { IPAddressController } from 'orchestrationdesk/lib/controllers/ipAddressController';
import { AdapterFactory } from 'orchestrationdesk/lib/factory/adapterFactory';
import { ServiceType } from 'orchestrationdesk/lib/factory/ServiceType';
import { IIPAddress } from 'orchestrationdesk/lib/models/ipAddress/ipAddress.interface';

export class ConfigController {

    constructor(
        private config: IConfiguration,
        private controller: IPAddressController,
        private logger: ILogger
        ) {
    }

    public refreshApplications(applications: IApplication[]): Promise<void> {

        return new Promise<void>((resolve) => {

            applications.forEach((application: IApplication) => {

                this.controller.getIPAddresses(
                    application.applicationId,
                    new AdapterFactory(this.config.userNameOrchestrationApi, this.config.passwordOrchestrationApi, ServiceType.Marathon))
                    .then((response: IIPAddress[]) => {
                        response.forEach((ipAddress: IIPAddress) => {
                            const url: string = this.config.serviceHttpProtocol + '://' + ipAddress.IP + ':' + ipAddress.Port;
                            this.refresh(application.configPath, url, this.config.adminUserName, this.config.adminPasswordName)
                            .then((refreshResponse : any) => {
                                this.logger.info(util.format(this.config.refreshConfigMessageFormat, application.applicationId, url, refreshResponse));
                                })
                            .catch((error: any) => this.logger.info(util.format(this.config.errorRefreshConfigMessageFormat, application.applicationId, url, error)));
                        });
                    }).catch(
                        (error:any) => this.logger.error(util.format(this.config.errorServiceConnectionMessageFormat, application.applicationId, error))
                    );
            });

        resolve();
        
        });
    }

    public refresh(
        applicationName: string,
        url: string,
        adminUsername: string,
        adminPassword: string): Promise<string> {
            const serviceAdapter: IServiceAdapter = new SigmaServiceAdapter(new URL(url));
            serviceAdminProvider.setUsername(adminUsername);
            serviceAdminProvider.setPassword(adminPassword);
        return serviceAdapter.refreshConfig(applicationName);
    }
}`

Features to be added in future?

  • Support for kubernetes the same as marathon.
  • Feature to deploy and kill containers and applications in marathon and kubernetes.
  • Feature to update deployment profiles in marathon and kubernetes. ... open to suggestions.

Looking forward to more suggestions and contribution