Giter VIP home page Giter VIP logo

projectsveltos / sveltos-agent Goto Github PK

View Code? Open in Web Editor NEW
3.0 0.0 3.0 1.02 MB

Classify cluster and report back to management cluster. Evaluates cluster health based on custom health checks. Watches for events and reports those to management cluster.

Home Page: https://projectsveltos.github.io/sveltos/

License: Apache License 2.0

Dockerfile 0.15% Makefile 2.90% Go 96.63% Shell 0.32%
kubernetes kubernetes-operator add-on classification helm helm-charts multi-tenancy event-driven-programming events health-check

sveltos-agent's Introduction

CI Go Report Card Slack License Twitter Follow

classifier_agent

Please refere to sveltos documentation.

  1. Classify cluster and report back to management cluster (processing Classifier instances);
  2. Evaluates health statuses for Kubernetes resources in the cluster (procecessings HealthCheck instances);
  3. Evaluates events for Kubernetes resources in the cluster (processing EventSource instances).

It gets automatically deployed in each managed cluster. It watches for Kubernetes resources and Classifier instances and classifiy a cluster. It watches for Kubernetes resources and HealthCheck instances and reports health statuses.

Please refer to Classifier for more information.

Contributing

❤️ Your contributions are always welcome! If you want to contribute, have questions, noticed any bug or want to get the latest project news, you can connect with us in the following ways:

  1. Open a bug/feature enhancement on github contributions welcome
  2. Chat with us on the Slack in the #projectsveltos channel Slack
  3. Contact Us

License

Copyright 2022. projectsveltos.io. All rights reserved.

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

sveltos-agent's People

Contributors

gianlucam76 avatar kukacz avatar

Stargazers

 avatar  avatar  avatar

sveltos-agent's Issues

docker image

Currently for classifier-agent (and all other sveltos microservices) all docker images are stored in docker-hub under namespace gianlucam76. Replace this to use namespace projectsveltos.

sveltos-agent still creates ReloaderReports even after ClusterProfile.Spec.Reloader is set to false

Deploy ClusterProfile with Reloader set to true. Have this ClusterProfile deploy a ConfigMap and a Deployment mounting the ConfigMap.

When ConfigMap is modified, a rolling upgrade for Deployment is triggered.
A Reloader instance is present in the managed cluster.

So far this is correct behaviour.

Reset ClusterProfile.Spec.Reloader to false.
Reloader instance is removed from managed cluster.

At this point any change in the ConfigMap should not trigger a rolling upgrade for the Deployment. Yet it still does.

YAML:

# nginx-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
  namespace: nginx
data:
  nginx.conf: |
    server {
      listen 80;
      server_name example.com;

      location / {
        root /usr/share/nginx/html;
        index index.html;
      }
    }

Store configmap.yaml in a file and create a ConfigMap with its content in the management cluster:

kubectl create configmap nginx-data --from-file configmap.yaml
# nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:latest
          ports:
            - containerPort: 80
          volumeMounts:
            - name: nginx-config-volume
              mountPath: /etc/nginx/conf.d/default.conf
              subPath: nginx.conf
      volumes:
        - name: nginx-config-volume
          configMap:
            name: nginx-config

Store deployment.yaml in a file and create a ConfigMap with its content in the management cluster:

kubectl create configmap nginx --from-file deployment.yaml

Create a ClusterProfile

apiVersion: config.projectsveltos.io/v1alpha1
kind: ClusterProfile
metadata:
  name: nginx
spec:
  clusterSelector: env=fv
  reloader: true
  syncMode: Continuous
  policyRefs:
  - name: nginx-data
    namespace: default
    kind: ConfigMap
  - name: nginx
    namespace: default
    kind: ConfigMap

Add command line option to indicate whether sveltos-agent is running in the management or managed cluster

sveltos-agent must support being deployed:

  1. in the managed cluster (this is current and should remain default behaviour)
  2. in the management cluster

A new command line option is needed to tell sveltos-agent where it is deployed.

When running in the management cluster, should use the GetKubernetesRestConfig to get rest.Config to access managed cluster and use that one.

Sveltos-agent is already passed cluster info (namespace, name, cluster-type). Those info are required by GetKubernetesRestConfig.

Doing so require to grant sveltos-agent Secret read permission in the management cluster. Maybe another option would be to pass the Kubeconfig to access the managed cluster directly (as Classifier already has such permission).

When sveltos-agent is started in the management cluster, the run-mode option can only be set to "do-not-send-reports"
Meaning events and reports will be fetched by classifier (which is default behaviour).

classification failed on gke cluster

  1. Created a GKE cluster running Kubernetes version

  2. Applied Classifier

apiVersion: lib.projectsveltos.io/v1alpha1
kind: Classifier
metadata:
  name: v1-27
spec:
  classifierLabels:
  - key: version
    value: v1-27
  kubernetesVersionConstraints:
  - comparison: GreaterThanOrEqualTo
    version: 1.27.0
  1. Cluster was not classified as a match

I0804 09:05:36.270119 1 classifier_evaluation.go:94] "evaluating" classifier="v1-27"
I0804 09:05:36.274064 1 utils.go:50] "cluster version: v1.27.2-gke.1200"
I0804 09:05:36.274128 1 classifier_evaluation.go:152] "cluster version v1.27.2-gke.1200"
I0804 09:05:36.274284 1 classifier_evaluation.go:122] "isMatch false" classifier="v1-27"
I0804 09:05:36.274351 1 classifier_evaluation.go:522] "creating ClassifierReport" classifier="v1-27"

Method: isVersionAMatch needs to be fixed.

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.