Decathlon / Decathlon/kubernetes-status-to-github

Be able to compute the status from an object list

Open
#4 1 comment 0 reactions 1 assignee Claimed by @jlore-decathlon View on GitHub
Dominant language
Java
Stars
8
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### Discussed in https://github.com/Decathlon/kubernetes-status-to-github/discussions/3

Originally posted by **GregoireW** October 5, 2023
In case we push multiple object in kubernetes to deploy one application it may be interesting to compute a status from all the object.

Example: your repository is a mono repo with a front app, an api, a worker. You deploy all of them when you put your application in production, you want to check all them to be deployed to declare a deployment succesful.

The CRD could be modified to something like this:

```yaml
apiVersion: github.decathlon.com/v1beta1
kind: GitHubDeployment
metadata:
name: example
spec:
sourceRef:
apiVersion: apps/v1
kind: Deployment
name: podinfo-primary
namespace: test

additionnalRef:
- apiVersion: apps/v1
kind: Deployment
name: front-app
namespace: test
- apiVersion: apps/v1
kind: Deployment
name: worker
namespace: test

extract: # Extract the ref on which to GitHub will create the deployment ( commit sha1, tag, etc... )
containerName: podinfod # get the tag of the image of this container. If it is not set, a `jsonPath` option has to be given.
# jsonPath: $.metadata.annotations.source-ref # a jsonPath to extract a value. Mandatory is `containerName` is not set
regexp: main-.*-(.*) # optional. If present, extract a substring from the tag. Capture a single group (can be named "ref")
# template: "{}" # optional. If present, use this template to build the GitHub ref from the extracted string. "{}" will be replaced by the extract string.
# For instance if you capture "1.2.3", a template like 'tag-{}' will send to GitHub a ref "tag-123"
repository:
name: my-repo # your repo name (no need to set the org/user, you can just set the repo name)
environment: staging # the environment name. It can be anything like production, staging, ..
```

Extract / template to get the commit point in git would be extracted from the `sourceRef` object, but the overall status would be the minimum status from all the objects from additionalRef + sourceRef.

- If one object is in error, the global status is in error
- else if one object is in pending, the global status is pending
- else if ALL object are current, the result is current.
-

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.