Keel Documentation

repository·master·Indexed 25 days ago

https://github.com/keel-hq/keel

Keel is a tool for automatically upgrading Kubernetes deployments when new Docker images become available. It supports Semver update policies, various trigger mechanisms (polling, pubsub, webhooks), and integrates with registries like AWS ECR and GCR. The project includes a Helm chart for installation, Terraform support, and a Vue-based UI solution based on Ant Design Pro Vue for managing dashboards, permissions, and resources.

Tokens
16K
Snippets
45
Records
80
Agent score
80%

What's inside Keel

  1. Understand Keel Architecture and Core Concepts

    master

    Keel is a Kubernetes deployment automation tool that watches container registries for new image versions and automatically updates Kubernetes deployments based on configured policies.

    Core Workflow

    1. Trigger: Detects a new version (via Polling, Pub/Sub, or Webhooks) and creates a types.Event.
    2. Provider: Receives the event and checks if the update is allowed based on defined Policies.
    3. Approval: If required, the update waits for manual approval.
    4. Update: The Provider (Kubernetes or Helm3) patches the resource.
    5. Notification: Sends updates to configured channels (Slack, Teams, etc.).
  2. Remove Babel Polyfill

    master

    To remove the polyfill, you must update both src/main.js and babel.config.js:

    1. Remove import '@babel/polyfill' from src/main.js.
    2. In babel.config.js, remove the following configuration:
    [
      '@babel/preset-env',
      {
        'useBuiltIns': 'entry'
      }
    ]
    [
      '@babel/preset-env',
      {
        'useBuiltIns': 'entry'
      }
    ]
  3. Configure webpack-bundle-analyzer in vue.config.js

    master

    Add BundleAnalyzerPlugin to the configureWebpack.plugins array in your vue.config.js file to enable dependency analysis during the build process.

    const path = require('path')
    const webpack = require('webpack')
    const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
    
    function resolve (dir) {
      return path.join(__dirname, dir)
    }
    
    // vue.config.js
    module.exports = {
      configureWebpack: {
        plugins: [
          // Ignore all locale files of moment.js
          new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
          // 依赖大小分析工具
          new BundleAnalyzerPlugin(),
        ]
      },
      
      
      ...
    }
  4. Remove Multi-Tab Mode functionality

    master

    To completely remove the Multi-Tab feature from the project, perform the following deletions across the codebase:

    1. Layout: In /src/components/layouts/BasicLayout.vue, remove the <multi-tab> component usage (specifically at lines 3, 12, and 19).
    2. Configuration: In /src/config/defaultSettings.js, remove the configuration at line 25.
    3. State Management: In src/store/modules/app.js, remove the logic at lines 27, 76-79, and 118-120.
    4. Utilities: In src/utils/mixin.js, remove the logic at line 21.
    5. Filesystem: Delete the entire component directory src/components/MultiTab.
  5. Install Keel via Helm

    master

    Install Keel using Helm. By default, the installation includes support for Docker image polling, the Kubernetes provider, and the Helm provider, allowing Kubernetes deployments to be upgraded automatically when new Docker images become available.

    $ helm upgrade --install keel --namespace keel keel/keel
  6. Install Keel via Helm

    master

    To install Keel on a Kubernetes cluster using Helm, first add the Keel chart repository and update your local Helm cache. You can then install Keel with the Helm provider enabled by default, or disable it if you only work with standard Kubernetes manifests.

    Prerequisites:

    • Helm
    • Kubernetes cluster
  7. Use the FooterToolbar component

    master

    The FooterToolbar is a fixed bottom toolbar that stays at the bottom of the content area and does not move with the scrollbar. It is ideal for data collection and submission actions on long pages.

    To use it, import the component and register it in your Vue component's components option.

    import FooterToolBar from '@/components/FooterToolbar'
    
    export default {
        components: {
            FooterToolBar
        }
    }
  8. Run Keel unit and e2e tests

    master

    If you are contributing to Keel, you can run the test suites using make.

    Unit Tests: To get formatted output, it is recommended to install tparse first.

    End-to-End (e2e) Tests: Requires a configured kubectl + kubeconfig and a running cluster. The test suite will create and subsequently delete testing namespaces.

  9. Configure a Helm release for automatic updates with Keel

    master

    To enable Keel to automatically update a Helm release, you must configure the keel settings in your application's values.yaml or via the --set flag during a helm upgrade.

    Key configuration parameters include:

    • policy: Defines the Semver update policy (all, major, minor, patch, or force).
    • trigger: The mechanism used to detect updates (e.g., poll, or event-based triggers like pubsub or webhooks).
    • pollSchedule: The cron-like schedule for polling (e.g., @every 3m).
    • images: A list of images to track, specifying the repository and tag.
    keel:
      # keel policy (all/major/minor/patch/force)
      policy: all
      # trigger type, defaults to events such as pubsub, webhooks
      trigger: poll
      # polling schedule
      pollSchedule: "@every 3m"
      # images to track and update
      images:
        - repository: image.repository # it must be the same names as your app's values
          tag: image.tag # it must be the same names as your app's values
  10. Run unit and E2E tests

    master

    Keel uses standard Go testing conventions. Test files are named *_test.go and are located alongside their corresponding source files.

    To run unit tests, use make test. To run end-to-end (E2E) tests, use make e2e. Note that E2E tests require a running cluster.

    # Unit tests
    make test
    
    # E2E tests (requires running cluster)
    make e2e