Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Doc #17

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/13.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
`doc` - Add a technical/logical documentation section
```
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ examples/
bin/
dist/
config/manifests/mutatingWebhookConfiguration.yaml
site/
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,27 @@ Useful links:

To quickly get started with the Kube Image Updater, you can use the following example:

TODO
```yaml
apiVersion: kimup.cloudavenue.io/v1alpha1
kind: Image
metadata:
labels:
app.kubernetes.io/name: kube-image-updater
app.kubernetes.io/managed-by: kustomize
name: demo
namespace: default
spec:
image: ghcr.io/orange-cloudavenue/kube-image-updater
baseTag: v0.0.19
triggers:
- type: crontab
value: "00 00 */12 * * *"
rules:
- name: Automatic update semver minor
type: semver-minor
actions:
- type: apply
```

## Contributing

Expand Down
19 changes: 19 additions & 0 deletions config/manifests/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kimup.cloudavenue.io/v1alpha1
kind: Image
metadata:
labels:
app.kubernetes.io/name: kube-image-updater
app.kubernetes.io/managed-by: kustomize
name: demo
namespace: default
spec:
image: ghcr.io/azrod/golink
baseTag: v0.0.19
triggers:
- type: crontab
value: "00 00 */12 * * *"
rules:
- name: Automatic update semver minor
type: semver-minor
actions:
- type: apply
2 changes: 1 addition & 1 deletion config/manifests/mutatingWebhookConfiguration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ webhooks:
# path: /mutate
# port: 8443
# CA certificate with BEGIN and END lines - base64 encoded
caBundle: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZFekNDQXZ1Z0F3SUJBZ0lDQitZd0RRWUpLb1pJaHZjTkFRRUxCUUF3R3pFWk1CY0dBMVVFQ2hNUWVXOTEKY2k1bGVHRnRjR3hsTG1OdmJUQWVGdzB5TkRBNU1qY3dPVEV5TURsYUZ3MHlOVEE1TWpjd09URXlNRGxhTUJzeApHVEFYQmdOVkJBb1RFSGx2ZFhJdVpYaGhiWEJzWlM1amIyMHdnZ0lpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElDCkR3QXdnZ0lLQW9JQ0FRQytmTjl6VTRHRXBpZXZ0S2Q1SnVnOE5sSFozNVdHcUp6MG5lSmo2dGpBK2Jkbjd3UmUKTHQ3STBQMk1Ta2hDWExqa2s3WmZqREtveEdlVGNZdzdYejI0UVVyR0J2Y3RpcFpJVWh6QkVmbVdYWWk3SlduUgpWSTRVMEw5cWFiclJZTTJ1am5Rc3RVTk9wS2U4Q1M3dStsNFNvMzFxNXFIRFF4dUJjTUJBS1YrbWs2V0JCWWU5CitNeDlWS1hLbFkrbUZBVU55NUFRaXFhRUcxQWE4Y3pZaGdMQTljdHBBWkNQWnF1a2twVUhiRzUvMWI4VVpZUHoKY2ZDcUNQTE8vd2dqbjN1R2ZqdCtFamZCRUdHZUJTU0xDdERhQVdMazlQUmxyZmdhOURJZ0Z0VTJwK3kxc0hLcgpBd0F3bG0zRG1CVEpNYWQ3Tks5TnloSmFRaXF4bVZ2QkgwdXRMSGpjdlRHNTlreDBWSmhhYjVVWVZKNFh2TmRYCjZRS2Rzc1Jldmd1TWo2VlJYd0RKcWtyTS9YRmdqcUJrVTUzSUQ1MlhXa3BUSHRQWTZkeWdrNmM4VkdFNjR6VnkKYWc5b2FIMzltT2piUmxFbG9hMGpnR0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T29xNm9qUjIvUllCTEtjQXp1emVIYksKM3BSWXNRbEJDZ0RQUVRvRCthRWhFVXcwbUlqc1pSQ2F6ZWwwNmpBaTFBWHJyM3duWDM0VlhPOHVYbnpJNGI0YQpxSUtDaHFMcjdNNEpmTnZaVXUzWnlXYkZOREVVNDFQWWVqNVpFOEdLV0xOYStta2xXb3ovdkV0QUh3c254Ull1ClFrOGphdktRYkVCY2QzK0I1a1NwODh1Q1NxeDdPeHMxTEw0S2orODZYR05iejNnNFpUU0F5UWlaaEVSSERrQ0gKKzNhVFhURlNpbWtZRmZ3NWptVWtpUDdXUU1zODJkRmV4OXh6Lzl2aTB6MFQya3M5UWpTTXBqaWR2Nk1UenpvYgpNOXdKcVMwVnUxU2RTWE9iN2wyM1d6NnlGZ01FZGN4NzhxakFaOFNuNnE2dVJrdnB4RnZrZHpjR1NKVlY2UXlhCm9yVm8rYkpJdEhUQ3Z3T1ZqR00vWEhReHAvb2c1MHN6ZzZKSUN5MXB1TnFZaUFtWitXSENIWmtNdTluRHl1alUKTnF4TDliZi9wMkI1b3hDa0xRSUpLcW9jd0NCYmx3UCs0d2NLQnNQcGZuelVIZUdaOGlXN1BpNStZZE1idHR0NwpMYjJKT0g3NTdIcnRaTFFlSUtsRE1FZnNKbWNnU2pVMHZiemhITDFEaHVtQ1hzQzBETXltQkhJbG1pZkFEbFRNCm44TWVrQ2lBWWc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="
rules:
- operations: [ "CREATE", "UPDATE"]
apiGroups: [""]
Expand Down
90 changes: 90 additions & 0 deletions docs/howto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# HowTo

## How to Use

1 - Create an `Image` resource:

```yaml
apiVersion: kimup.cloudavenue.io/v1alpha1
kind: Image
metadata:
labels:
app.kubernetes.io/name: kube-image-updater
app.kubernetes.io/managed-by: kustomize
name: demo
namespace: default
spec:
image: ghcr.io/orange-cloudavenue/kube-image-updater
baseTag: v0.0.19
triggers:
- type: crontab
value: "00 00 */12 * * *"
rules:
- name: Automatic update semver minor
type: semver-minor
actions:
- type: apply
```

2 - Apply the `Image` resource:

```bash
kubectl apply -f image.yaml
```
In this example the image `ghcr.io/orange-cloudavenue/kube-image-updater` will be updated every 12 hours with the latest minor version.

3 - Check the Image TAG:

```bash
kubectl get image demo'

NAME IMAGE TAG
demo ghcr.io/azrod/golink
```
But you can force the update by running the following command:

```bash
kubectl annotate image demo kimup.cloudavenue.io/action=refresh
```

The Image TAG is now updated:

```bash
NAME IMAGE TAG
demo ghcr.io/azrod/golink v0.1.0
```

4 - Make a deployment with the image:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: golink
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: golink
template:
metadata:
labels:
app: golink
spec:
containers:
- name: golink
image: ghcr.io/azrod/golink
ports:
- containerPort: 8080
```

5 - Apply the deployment:

```bash
kubectl apply -f deployment.yaml
```

Now the deployment is running with the image `ghcr.io/azrod/golink:v0.1.0` define by your rules in the CRD `Image`.


34 changes: 33 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ hide:

**kube-image-updater** (A.K.A. **kimup**, which is pronounced /kim up/) is a tool that helps you to update the image of a Kubernetes Deployment, StatefulSet, DaemonSet, or CronJob. It can be used to update the image of a single resource or multiple resources at once.

kimup is designed to be simple to use and easy to deploy. It is an kubernetes operator with custom resource definition (CRD) that allows you to define the image update strategy and schedule.
**kimup** is designed to be simple to use and easy to deploy. It is an kubernetes operator with custom resource definition (CRD) that allows you to define the image update strategy and schedule.

The project is composed of 3 main components:
**kimup-operator:**
: The main component that reconcile `Image` and CRD definition.

**kimup:**
: The component that updates TAG of the `Image` resource.

**kimup-webhook:**
: The component that patch resource creation with rules defined in `Image` resource.

Basic example of usage:

Expand Down Expand Up @@ -46,3 +56,25 @@ It is structured around the following concepts:
- **Triggers**: define when the image should be updated. (Multiple triggers can be defined)
- **Rules**: define how the image should be updated. (Multiple rules can be defined)
- **Actions**: define what should be done after the image is updated (rule matched). (Multiple actions can be defined)

## Features

- **baseTag**: version of the image to update and on which we will apply the rules.

Type of **Triggers**:

- **crontab**: Update the image based on a crontab schedule.

Type of **Rules**:

- **semver-major**: Update the major version of the image.
- **semver-minor**: Update the minor version of the image.
- **semver-patch**: Update the patch version of the image.
- **regex**: Update the image based on a regex pattern.

Type of **Actions**:

- **refresh**: Apply the new image to the resource.
- **notify**: Notify a webhook with the new image.(Not implemented yet)
- **request-approval**: Request approval to apply the new image.(Not implemented yet)

27 changes: 27 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Install

## How to Install (In Development...)

1 - **Install the CRD:**

Git clone project and run the following command:
```bash
kubectl apply -f config/crd/bases/kimup.cloudavenue.io_images.yaml
```

2 - Start all services:

For Operator
```bash
make run-operator
```

For Webhook
```bash
go run ./cmd/webhook --insideCluster=false
```

For kimup
```bash
go run ./cmd/kimup --insideCluster=false
```
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ plugins:

nav:
- Overview: "index.md"
- Getting Started:
- Installation: install.md
- Howto: howto.md

markdown_extensions:
# Python Markdown
Expand Down Expand Up @@ -76,7 +79,6 @@ markdown_extensions:
custom_checkbox: true
- pymdownx.tilde


extra:
social:
- icon: fontawesome/brands/github
Expand Down
Loading