Skip to content

Commit

Permalink
Merge pull request #54 from fluxcd/release-v0.0.2
Browse files Browse the repository at this point in the history
Release v0.0.2
  • Loading branch information
stefanprodan authored Jul 2, 2020
2 parents 5e850f4 + 7e7dcc5 commit 74cb763
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 36 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project are documented in this file.

## 0.0.2 (2020-07-02)

This prerelease comes with improvements to the alerting system.
The reconciliation events can be forwarded to notification controller
and alerting can be configured for Slack, MS Teams, Discord and Rocket chat
using the [notification.fluxcd.io API](https://github.com/fluxcd/notification-controller/tree/master/docs/spec).

## 0.0.1 (2020-06-24)

This is the first prerelease ready for public testing. To get started
Expand Down
63 changes: 34 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ Specifications:

## Usage

The kustomize-controller is part of a composable GitOps toolkit and depends on
[source-controller](https://github.com/fluxcd/source-controller) to acquire the Kubernetes
manifests from Git repositories.
The kustomize-controller is part of a composable [GitOps toolkit](https://toolkit.fluxcd.io)
and depends on [source-controller](https://github.com/fluxcd/source-controller)
to acquire the Kubernetes manifests from Git repositories.

### Install the controllers
### Install the toolkit controllers

Install the source and kustomize controllers in the `kustomize-system` namespace:
Download the [toolkit CLI](https://github.com/fluxcd/toolkit/tree/master/install):

```bash
kustomize build https://github.com/fluxcd/kustomize-controller//config/default?ref=master \
kubectl apply -f-
curl -s https://toolkit.fluxcd.io/install.sh | sudo bash
```

Install the toolkit controllers in the `gitops-system` namespace:

```bash
tk install
```

### Define a Git repository source
Expand All @@ -52,7 +57,7 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
name: podinfo
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 1m
url: https://github.com/stefanprodan/podinfo
Expand All @@ -67,13 +72,13 @@ Save the above file and apply it on the cluster.
You can wait for the source controller to assemble an artifact from the head of the repo master branch with:
```bash
kubectl wait gitrepository/podinfo --for=condition=ready
kubectl -n gitops-system wait gitrepository/podinfo --for=condition=ready
```

The source controller will check for new commits in the master branch every minute. You can force a git sync with:

```bash
kubectl annotate --overwrite gitrepository/podinfo source.fluxcd.io/syncAt="$(date +%s)"
kubectl -n gitops-system nnotate --overwrite gitrepository/podinfo source.fluxcd.io/syncAt="$(date +%s)"
```

### Define a kustomization
Expand All @@ -85,7 +90,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: podinfo-dev
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 5m
path: "./deploy/overlays/dev/"
Expand Down Expand Up @@ -122,13 +127,13 @@ Kustomization object status transitions to a ready state.
You can wait for the kustomize controller to complete the deployment with:

```bash
kubectl -n kustomize-system wait kustomization/podinfo-dev --for=condition=ready
kubectl -n gitops-system wait kustomization/podinfo-dev --for=condition=ready
```

When the controller finishes the reconciliation, it will log the applied objects:

```bash
kubectl -n kustomize-system logs deploy/kustomize-controller | jq .
kubectl -n gitops-system logs deploy/kustomize-controller | jq .
```

```json
Expand All @@ -137,7 +142,7 @@ kubectl -n kustomize-system logs deploy/kustomize-controller | jq .
"ts": 1587195448.071468,
"logger": "controllers.Kustomization",
"msg": "Kustomization applied in 1.436096591s",
"kustomization": "kustomize-system/podinfo-dev",
"kustomization": "gitops-system/podinfo-dev",
"output": {
"namespace/dev": "created",
"service/frontend": "created",
Expand All @@ -150,17 +155,17 @@ kubectl -n kustomize-system logs deploy/kustomize-controller | jq .
}
```

You can trigger a kustomize build and apply any time with:
You can trigger a kustomization reconciliation any time with:

```bash
kubectl -n kustomize-system annotate --overwrite kustomization/podinfo-dev \
kubectl -n gitops-system annotate --overwrite kustomization/podinfo-dev \
kustomize.fluxcd.io/syncAt="$(date +%s)"
```

When the source controller pulls a new Git revision, the kustomize controller will detect that the
source revision changed, and will apply those changes right away.
source revision changed, and will reconcile those changes right away.

If the kustomization build or apply fails, the controller sets the ready condition to `false` and logs the error:
If the kustomization reconciliation fails, the controller sets the ready condition to `false` and logs the error:

```yaml
status:
Expand All @@ -174,7 +179,7 @@ status:

```json
{
"kustomization": "kustomize-system/podinfo-dev",
"kustomization": "gitops-system/podinfo-dev",
"error": "Error from server (NotFound): error when creating podinfo-dev.yaml: namespaces dev not found"
}
```
Expand All @@ -192,7 +197,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: istio
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 10m
path: "./istio/system/"
Expand All @@ -209,12 +214,12 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: podinfo-dev
namespace: kustomize-system
namespace: gitops-system
spec:
dependsOn:
- istio
interval: 5m
path: "./overlays/dev/"
path: "./deploy/overlays/dev/"
prune: true
sourceRef:
kind: GitRepository
Expand All @@ -230,12 +235,12 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
name: podinfo-releases
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 5m
url: https://github.com/stefanprodan/podinfo
ref:
semver: ">=3.2.3 <4.0.0"
semver: ">=4.0.0 <5.0.0"
```

With `ref.semver` we configure source controller to pull the Git tags and create an artifact from the most recent tag
Expand All @@ -248,7 +253,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: podinfo-production
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 10m
path: "./deploy/overlays/production/"
Expand All @@ -262,7 +267,7 @@ set in the Git repository.

### Configure alerting

The kustomize-controller emits Kubernetes events whenever a kustomization status changes.
The kustomize controller emits Kubernetes events whenever a kustomization status changes.

You can use the [notification-controller](https://github.com/fluxcd/notification-controller) to forward these events
to Slack, Microsoft Teams, Discord or Rocket chart.
Expand All @@ -274,7 +279,7 @@ apiVersion: notification.fluxcd.io/v1alpha1
kind: Provider
metadata:
name: slack
namespace: kustomize-system
namespace: gitops-system
spec:
type: slack
channel: alerts
Expand All @@ -285,7 +290,7 @@ apiVersion: v1
kind: Secret
metadata:
name: slack-url
namespace: kustomize-system
namespace: gitops-system
data:
address: <encoded-url>
```
Expand All @@ -297,7 +302,7 @@ apiVersion: notification.fluxcd.io/v1alpha1
kind: Alert
metadata:
name: on-call
namespace: kustomize-system
namespace: gitops-system
spec:
providerRef:
name: slack
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ resources:
images:
- name: fluxcd/kustomize-controller
newName: fluxcd/kustomize-controller
newTag: v0.0.1
newTag: v0.0.2
12 changes: 6 additions & 6 deletions docs/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
name: istio
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 5m
url: https://github.com/stefanprodan/gitops-istio
Expand All @@ -109,7 +109,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: istio
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 10m
path: "./istio/"
Expand All @@ -130,7 +130,7 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
name: webapp
namespace: kustomize-system
namespace: gitops-system
spec:
interval: 1m
url: https://github.com/stefanprodan/podinfo-deploy
Expand All @@ -141,7 +141,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: webapp-common
namespace: kustomize-system
namespace: gitops-system
spec:
dependsOn:
- istio
Expand All @@ -157,7 +157,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: webapp-backend
namespace: kustomize-system
namespace: gitops-system
spec:
dependsOn:
- webapp-common
Expand All @@ -177,7 +177,7 @@ apiVersion: kustomize.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
name: webapp-frontend
namespace: kustomize-system
namespace: gitops-system
spec:
dependsOn:
- webapp-backend
Expand Down

0 comments on commit 74cb763

Please sign in to comment.