From 0fbcfded57391f09ed4c297a54765aa1835af03c Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Thu, 22 Apr 2021 20:14:40 +0300 Subject: [PATCH] Update image automation migration guide to v1alpha2 APIs Signed-off-by: Stefan Prodan --- docs/guides/flux-v1-automation-migration.md | 52 +++++++-------------- docs/guides/sortable-image-tags.md | 8 ++-- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/docs/guides/flux-v1-automation-migration.md b/docs/guides/flux-v1-automation-migration.md index 386f0192..7a8d6200 100644 --- a/docs/guides/flux-v1-automation-migration.md +++ b/docs/guides/flux-v1-automation-migration.md @@ -287,20 +287,24 @@ $ flux create image update my-app-auto \ --export > ./$AUTO_PATH/my-app-auto.yaml $ cat my-app-auto.yaml --- -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImageUpdateAutomation metadata: name: my-app-auto namespace: flux-system spec: - checkout: - branch: main - gitRepositoryRef: - name: flux-system - commit: - authorEmail: fluxbot@example.com - authorName: FluxBot interval: 5m0s + sourceRef: + kind: GitRepository + name: flux-system + git: + checkout: + ref: + branch: main + commit: + author: + email: fluxbot@example.com + name: FluxBot ``` #### Commit and check that the automation object works @@ -357,14 +361,8 @@ metadata: annotations: fluxcd.io/automated: "true" fluxcd.io/tag.app: semver:^5.0 - selector: - matchLabels: - app: podinfo spec: template: - metadata: - labels: - app: podinfo spec: containers: - name: app @@ -395,14 +393,8 @@ metadata: annotations: fluxcd.io/automated: "true" fluxcd.io/tag.app: semver:^5.0 - selector: - matchLabels: - app: podinfo spec: template: - metadata: - labels: - app: podinfo spec: containers: - name: app @@ -420,7 +412,7 @@ $ flux create image repository podinfo-image \ --export > ./$AUTO_PATH/podinfo-image.yaml $ cat ./$AUTO_PATH/podinfo-image.yaml --- -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImageRepository metadata: name: podinfo-image @@ -525,7 +517,7 @@ Say you want to filter for only images that are from `main` branch, and pick the `ImagePolicy` would look like this: ```yaml -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImagePolicy metadata: name: my-app-policy @@ -569,7 +561,7 @@ example, you might put a target environment as well as the version in your image Then you would use an `ImagePolicy` similar to this one: ```yaml -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImagePolicy metadata: name: my-app-policy @@ -600,7 +592,7 @@ $ flux create image policy my-app-policy \ --export > ./$AUTO_PATH/my-app-policy.yaml $ cat ./$AUTO_PATH/my-app-policy.yaml --- -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImagePolicy metadata: name: my-app-policy @@ -659,14 +651,8 @@ metadata: annotations: fluxcd.io/automated: "true" fluxcd.io/tag.app: semver:^5.0 # <-- `.app` here - selector: - matchLabels: - app: podinfo spec: template: - metadata: - labels: - app: podinfo spec: containers: - name: app # <-- targets `app` here @@ -685,14 +671,8 @@ kind: Deployment metadata: namespace: default name: my-app - selector: - matchLabels: - app: podinfo spec: template: - metadata: - labels: - app: podinfo spec: containers: - name: app diff --git a/docs/guides/sortable-image-tags.md b/docs/guides/sortable-image-tags.md index 5ee56acc..49f78761 100644 --- a/docs/guides/sortable-image-tags.md +++ b/docs/guides/sortable-image-tags.md @@ -114,8 +114,8 @@ built from that branch. Here is an example that filters for only images built from `main` branch, and selects the most recent according the timestamp (created with `date +%s`): -``` -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +```yaml +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImagePolicy metadata: name: image-repo-policy @@ -133,8 +133,8 @@ spec: If you don't care about the branch, that part can be a wildcard in the pattern: -``` -apiVersion: image.toolkit.fluxcd.io/v1alpha1 +```yaml +apiVersion: image.toolkit.fluxcd.io/v1alpha2 kind: ImagePolicy metadata: name: image-repo-policy