Git Product home page Git Product logo

capi-custom-extension's Introduction

Sample Runtime Extension for Cluster API Runtime SDK

capi-custom-extension

capi-custom-extension is a runtime extension of Cluster API (CAPI) that implements the logic for the BeforeClusterUpgradeHook. This extension provides additional functionality for handling cluster upgrades before the actual upgrade process takes place.

Prerequisites

Before using this extension, ensure that you have the following prerequisites in place:

  • A ClusterUpgrade resource must be created. Here's an example of a ClusterUpgrade resource manifest:

    apiVersion: cluster.aruba.it/v1alpha1
    kind: ClusterUpgrade
    metadata:
      name: clusterupgrade-sample-v1.21.2-v1.22.0
      namespace: default
    spec:
      nodes_ip:
      - 10.244.0.12
  • The ClusterUpgrade resource should be in the desired state with relevant annotations, labels, and status conditions based on your use case.

Usage

To test the extension, run the following command:

kubectl create --raw '/api/v1/namespaces/default/services/https:sample-service:443/proxy/hooks.runtime.cluster.x-k8s.io/v1alpha1/beforeclusterupgrade/before-cluster-upgrade' -f <(echo '{"apiVersion":"hooks.runtime.cluster.x-k8s.io/v1alpha1","kind":"BeforeClusterUpgradeRequest","cluster":{"metadata":{"namespace":"default","name":"clusterupgrade-sample"}},"fromKubernetesVersion":"v1.21.2","toKubernetesVersion":"v1.22.0"}')

This command creates a BeforeClusterUpgradeRequest for the specified cluster and triggers the extension logic.

Build and Deployment

To build the project, execute the following commands:

docker build --platform=linux/amd64 -t YOUR_DOCKER_IMAGE_NAME --build-arg builder_image=golang:1.19.3 .

Replace YOUR_DOCKER_IMAGE_NAME with the desired name for your Docker image. This command builds the project and creates the Docker image.

To push the Docker image to a repository, use the following command:

docker push YOUR_DOCKER_IMAGE_NAME

Replace YOUR_DOCKER_IMAGE_NAME with the actual name of your Docker image. This command pushes the image to the specified repository.

To deploy the extension to your cluster, run the following command:

kubectl -k apply -k config/default

This command applies the Kubernetes manifests located in the config/default directory to deploy the extension. Make sure to modify the extension_image_patch.yaml file in the config/default directory to update the image reference accordingly.

Note: Replace YOUR_DOCKER_IMAGE_NAME with the actual name of your Docker image in the extension_image_patch.yaml file.

capi-custom-extension's People

Contributors

franzudev avatar iron87 avatar

Watchers

 avatar  avatar

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.