Coder Social home page Coder Social logo

go-deployment-restarter's Introduction

Restarter Job

This project allows users to restart any deployments in Openshift Platform.

Getting started

The restarter Job has a few requirements before it can be executed successfully:

  • Non-default Kubernetes ServiceAccount
  • Kubernetes Roles and RoleBindings

These requirements are already provided in the openshift directory. These must be deployed to Openshift prior to the Job.

Once the conditions are met, it will be possible to run the Job. Below are the arguments for the job. NAMESPACE is already set, so only DEPLOYMENT needs to be provided.

Parameter Default Description
NAMESPACE "" Target deployment namespace
DEPLOYMENT "" Target deployment name

Testing

To test the image, you set up a local minikube cluster and run the Job against a deployment stub.

Create cluster:

$ make minikube
/usr/local/bin/docker
/opt/homebrew/bin/minikube
/opt/homebrew/bin/kubectl
๐Ÿ˜„  minikube v1.32.0 on Darwin 14.1 (arm64)
โœจ  Using the docker driver based on user configuration
๐Ÿ“Œ  Using Docker Desktop driver with root privileges
๐Ÿ‘  Starting control plane node minikube in cluster minikube
๐Ÿšœ  Pulling base image ...
๐Ÿ”ฅ  Creating docker container (CPUs=2, Memory=4000MB) ...
๐Ÿณ  Preparing Kubernetes v1.28.3 on Docker 24.0.7 ...
    โ–ช Generating certificates and keys ...
    โ–ช Booting up control plane ...
    โ–ช Configuring RBAC rules ...
๐Ÿ”—  Configuring bridge CNI (Container Networking Interface) ...
๐Ÿ”Ž  Verifying Kubernetes components...
    โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5
๐ŸŒŸ  Enabled addons: storage-provisioner, default-storageclass
๐Ÿ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Run test:

$ make test
service/stub created
deployment.apps/stub created
Waiting for deployment "stub" rollout to finish: 0 of 3 updated replicas are available...
Waiting for deployment "stub" rollout to finish: 1 of 3 updated replicas are available...
Waiting for deployment "stub" rollout to finish: 2 of 3 updated replicas are available...
deployment "stub" successfully rolled out
serviceaccount/restarter created
job.batch/restarter-job created
role.rbac.authorization.k8s.io/restarter created
rolebinding.rbac.authorization.k8s.io/restarter created
pod/restarter-job-rhbhm condition met
2023-11-10T13:06:10Z INF src/cmd/restarter/main.go:84 > Waiting for deployment "stub" rollout to finish...
2023-11-10T13:06:13Z INF src/cmd/restarter/main.go:84 > Waiting for deployment "stub" rollout to finish...
2023-11-10T13:06:15Z INF src/cmd/restarter/main.go:84 > Waiting for deployment "stub" rollout to finish...
2023-11-10T13:06:17Z INF src/cmd/restarter/main.go:84 > Waiting for deployment "stub" rollout to finish...
2023-11-10T13:06:19Z INF src/cmd/restarter/main.go:80 > deployment "stub" successfully rolled out

Dockerhub

Build and upload all images to JFrog Artifactory:

make artifact USER=DOCKERHUB_USER SECRET=DOCKERHUB_SECRET

Help

Usage:
  make <target>
  help             Displays help

Development
  fmt              Formats the source code
  vet              Validates the source code
  build            Builds the image
  run              Builds and runs the image
  artifact         Pushes the images to JFrog Artifactory
  clear            Removes the images
  changelog        Generate changelog

Test
  minikube         Creates a minikube cluster
  rm_minikube      Removes the minikube cluster
  test             Tests the restarter job

go-deployment-restarter's People

Contributors

foroozf001 avatar

Watchers

 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.