{"id":18382319,"url":"https://github.com/centeredge/shawarma","last_synced_at":"2025-04-06T23:31:33.648Z","repository":{"id":38818546,"uuid":"193304842","full_name":"CenterEdge/shawarma","owner":"CenterEdge","description":"A Kubernetes sidecar to assist with enabling/disabling background processing during blue/green deployments.","archived":false,"fork":false,"pushed_at":"2025-01-03T16:55:27.000Z","size":157,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-22T09:01:56.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CenterEdge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-23T04:07:53.000Z","updated_at":"2025-01-03T16:55:31.000Z","dependencies_parsed_at":"2024-06-19T03:51:15.313Z","dependency_job_id":"0a7a3487-dbee-4d9e-a3ca-a65d1c9f33be","html_url":"https://github.com/CenterEdge/shawarma","commit_stats":{"total_commits":35,"total_committers":6,"mean_commits":5.833333333333333,"dds":0.1428571428571429,"last_synced_commit":"40a4888e3432790de5c17a30e879aceb15b86b39"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterEdge%2Fshawarma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterEdge%2Fshawarma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterEdge%2Fshawarma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CenterEdge%2Fshawarma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CenterEdge","download_url":"https://codeload.github.com/CenterEdge/shawarma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569123,"owners_count":20959758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:04:26.828Z","updated_at":"2025-04-06T23:31:28.638Z","avatar_url":"https://github.com/CenterEdge.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shawarma\n\n[![ci](https://github.com/CenterEdge/shawarma/actions/workflows/docker-image.yml/badge.svg)](https://github.com/CenterEdge/shawarma/actions/workflows/docker-image.yml)\n\nA Kubernetes sidecar to assist with enabling/disabling background processing during blue/green\ndeployments.\n\n## Overview\n\nA [Blue/Green Deployment](https://martinfowler.com/bliki/BlueGreenDeployment.html) is a process\ndesigned to maintain 100% uptime during deployments, with rapid rollbacks. As the new version\nis deployed, traffic is routed to the new version and diverted from the old version. However,\nthe old version is left running and ready to receive traffic, allowing for rapid failover to\nthe previous version in the event a rollback is required.\n\nThis works great for serving incoming requests, but what about background processes running\nwithin the application? For example, running scheduled background jobs or processing messages\nfrom the message bus. In a traditional blue/green deployment, these processes continue to\nexecute, potentionally leaving a bug operating in production that you thought you fixed.\n\n## How it Works\n\nShawarma is designed to address this problem for applications running within Kubernetes.\nIt is a very lightweight Go app which runs in a sidecar container within each pod of your\napplication. It monitors the Kubernetes API to know when the pod is or is not connected to\nthe load balancer, and uses an HTTP POST to let your application know the state. Your\napplication must simply receive the POST and start or stop background processing.\n\nThe Kubernetes Service may be referenced either by name (using `--service`) or by one or\nmore labels (using `--service-labels`). If both are supplied then all must match. If more\nthan one Service is matched the the application is considered active if any Service includes\nthe pod.\n\n## HTTP Endpoint\n\nAn optional feature on this sidecar also provides a simple http server to store the current pod status,\nthis enable other use cases where the main container can ask to the sidecar without\nthe need to create a new endpoint on the main service or understand k8s API.\nA simply GET call to the endpoint `/deploymentstate` will return the pod service status as json:\n\n```text\ncurl -X GET http://localhost:8099/deploymentstate -i\nHTTP/1.1 200 OK\nContent-Type: application/json\nDate: Tue, 12 Apr 2022 12:32:22 GMT\nContent-Length: 19\n\n{\"status\":\"active\"}\n```\n\nWhere `localhost` will be the shawarma sidecar container interface (binding just to local one)\n\nThis configuration needs just an extra env config to set the http server port to listen:\n\n- SHAWARMA_LISTEN_PORT (int, default: 8099)\n\n## Example\n\nTo see an example deployment utilizing Shawarma, see (./example/basic/example.yaml).\n\nFor a more automated example using annotations to automatically inject sidecars, see\n(./example/injected).\n\n## RBAC Rights\n\nShawarma requires access rights, via a service account, to monitor endpoints with the\npod's namespace. It is recommended to create a single Role named `shawarma'\nin the namespace, and then bind it to each service account using a RoleBinding.\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n  name: shawarma\nrules:\n- apiGroups: [\"\"]\n  resources: [\"endpoints\"]\n  verbs: [\"get\", \"watch\", \"list\"]\n```\n\n## Usage\n\n`shawarma monitor [arguments...]`\n\nShawarma only functions within Kubernetes, using service tokens for authentication,\nso normally it is run using the Docker container `centeredge/shawarma`.\n\nFor detailed help:\n\n`docker run --rm -it centeredge/shawarma monitor --help`\n\n## Arguments\n\nMost arguments can be specified either on the command line, or via an environment variable.\nIf specified both places, the command line takes precendence.\n\n| Name               | Env Var                 | Description |\n| ------------------ | ----------------------- | ----------- |\n| --log-level        | LOG_LEVEL               | Set the log level (panic, fatal, error, warn, info, debug, trace) (default: \"warn\") |\n| --namespace        | MY_POD_NAMESPACE        | Kubernetes namespace, typically a fieldRef to `fieldPath: metadata.namespace` |\n| --pod              | MY_POD_NAME             | Kubernetes pod name, typically a fieldRef to `fieldPath: metadata.name` |\n| --service          | SHAWARMA_SERVICE        | Name of the Kubernetes service to monitor |\n| --service-labels   | SHAWARMA_SERVICE_LABELS | Kubernetes service labels to monitor, comma-delimited ex. `label1=value1,label2=value2` |\n| --url              | SHAWARMA_URL            | URL which receives a POST on state change, default: \u003chttp://localhost/applicationstate\u003e |\n| --disable-notifier | SHAWARMA_DISABLE_STATE_NOTIFIER | Enable/Disable POST Notification behavior (bool) (default: \"true\") |\n| --listen-port      | SHAWARMA_LISTEN_PORT    | PORT to be used to start the HTTP Server |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenteredge%2Fshawarma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcenteredge%2Fshawarma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcenteredge%2Fshawarma/lists"}