Git Product home page Git Product logo

clustersubscription's Introduction

ClusterSubscription

Subscribe to Razee controlled resources

Install

  • Logon to your RazeeDash server and go to the manage org page
    • ie. https://app.razee.io/stark-industries/org
  • Install ClusterSubscription in your cluster using the Install Razee Agent command on the org page.
    • ie. kubectl apply -f "https://app.razee.io/api/install/razeedeploy-job?orgKey=orgApiKey-..."
  • Verify that a razee-identity ConfigMap and Secret have been created on your cluster
  • Logon to your RazeeDash server and go to the Deployables page to create Cluster Groups, Channels and Subscriptions

Environment Variables

Name Required Description
RAZEE_API yes The url to your razeedash-api. ex: http://api-host:8081 Found in the razee-identidy ConfigMap
RAZEE_ORG_KEY yes The orgApiKey used to communicate with razeedash-api. ex: orgApiKey-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeer . Found in the razee-identity Secret
CLUSTER_ID yes The razee defined cluster id. Found in the razee-identity ConfigMap

Upgrading to 3.0

  • If you are upgrading existing clusters to the 3.0+ release of ClusterSubscription then you will need to create a razee-identity ConfigMap and Secret manually.
    • Logon to your RazeeDash server and go to the clusters page
      • ie. https://app.razee.io/stark-industries/clusters
    • Click a cluster name and go to the Details tab
    • From there you will see the kubectl commands you can run to generate the razee-identity ConfigMap and Secret
    • Now you can add this cluster to a Cluster Group from the Deployables page

clustersubscription's People

Contributors

adamkingit avatar alewitt2 avatar carrolp avatar dalehille avatar deepalialoori avatar dependabot-preview[bot] avatar dependabot[bot] avatar ethanstjohn avatar kdai7 avatar khoiohk87 avatar mckaymic avatar nderibe avatar rmgraham avatar ryangrahamnc avatar tasneem067 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

clustersubscription's Issues

Created RemoteResource objects should include the Name of the subscription

RR's get named like clustersubscription-8e7563f6-4370-4a36-8350-2fa7a8584ba6 and don't have any internal attribute or label that specifies the name of the subscription, nor details (name/uuid) of the version or channel. This can make debug difficult. Those details should be included as RR spec attributes or labels.

Create interval to validate subscriptions on

There are some cases where an event might have been missed, or a failure to apply the remoteresource occurred, or someone accidentally modified the RR and broke it. We should not rely on another event to come from razeedash before we try to rectify these issues.

My suggestion would be to set up some interval, maybe every 5-10min where we run callRazee() just in case we hit one of these edge cases. This would be in addition to the event based model that already exists.

Receive labels/tags from a cluster

  • remove the dependency of razee_api, razee_org_key and razee_tags as environment variables
  • look on the cluster for configmap/secret containing razee_api, razee_org_key and razee_tags
  • call replace subscriptionsByTags with subscriptionsByCluster

Existing users would need to first create lables and register a cluster from razeedash. refs razee-io/Razeedash#321

Code updates for this are in the subscriptions_by_cluster branch

Utilize Secret Auth Header

As part of its operation, ClusterSubscription renders a RemoteResource template. https://github.com/razee-io/ClusterSubscription/blob/master/lib/remoteResource.js#L13-L20

In this template it is injecting the orgKey in plain text as a request header. We shouldn't display keys in plain text, so we need to utilize the secret auth header feature defined in RemoteResource https://github.com/razee-io/RemoteResource#request-options (see Note about secretKeyRef)

ie:

const requestsTemplate = `{
  "options": {
    "url": "{{{url}}}",
    "headers": {
      "razee-org-key":
        "valueFrom":
          "secretKeyRef":
            "name": "clustersubscription-{{subscriptionUuid}}-secret"
            "namespace": "razeedeploy"
            "key": "razee-api-org-key"
    }
  }
}`;

in order to reference a secret like the above example, we need to first create a secret.

ie:

const resourceTemplate = {
  'apiVersion': v1,
  'kind': Secret,
  'metadata': {
    'namespace': NAMESPACE,
    'name': resourceName,
    'annotations': {
      'deploy.razee.io/clustersubscription': sub.subscriptionUuid,
      'deploy.razee.io/clusterid': clusterId
    },
    'labels': {
      'razee/watch-resource': 'lite'
    }
  },
  'data': {
    'razee-api-org-key': apiKey
  }
};

the createRemoteResource function should be broken up in such a way as to utilize the code that applies the resource to the cluster for both the remoteResource and the secret. https://github.com/razee-io/ClusterSubscription/blob/master/lib/remoteResource.js#L22-L87

similarly, when a remoteResource gets deleted, the corresponding secret should also be deleted. You will need to break up this function to handle both secrets and remote resources too https://github.com/razee-io/ClusterSubscription/blob/master/lib/remoteResource.js#L89-L111

ClusterSubscription is using razee namespace instead of razeedeploy

we are hitting the following error

> [email protected] start /usr/src/app
> node src/index.js
{"name":"cluster-subscription","hostname":"clustersubscription-786fddbb56-9bwzr","pid":19,"level":30,"msg":"Client has connected to the server!","time":"2020-03-10T14:54:52.556Z","v":0}
{"name":"cluster-subscription","hostname":"clustersubscription-786fddbb56-9bwzr","pid":19,"level":30,"msg":"Received subscription data from razeeapi {\n  subscriptions: [\n    {\n      name: 'jupyter-3.0',\n      uuid: '79c43b8e-bf03-42bf-91d1-e0389e9df2f3'\n    }\n  ],\n  urls: [ 'api/v1/channels/jupyter/a69d36b9-0646-4b5e-8d54-bfa2c5f6bdd2' ]\n}","time":"2020-03-10T14:54:52.558Z","v":0}
{"name":"cluster-subscription","hostname":"clustersubscription-786fddbb56-9bwzr","pid":19,"level":30,"msg":"Get 404 /apis/deploy.razee.io/v1alpha1/namespaces/razee/remoteresources/clustersubscription-rr","time":"2020-03-10T14:54:58.975Z","v":0}
{"name":"cluster-subscription","hostname":"clustersubscription-786fddbb56-9bwzr","pid":19,"level":50,"msg":"post error 404 Not Found {\n  kind: 'Status',\n  apiVersion: 'v1',\n  metadata: {},\n  status: 'Failure',\n  message: 'namespaces \"razee\" not found',\n  reason: 'NotFound',\n  details: { name: 'razee', kind: 'namespaces' },\n  code: 404\n}","time":"2020-03-10T14:54:59.141Z","v":0}

index.js -> Line #29, i see the namespace is configured as razee.

When we install the watchkeeper , razeedeploy namespace is created and deploy componenets are created under razeedeploy ns. But the clustersubscription deployment is referring to razee namespace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.