From 398180d9c173aa4cbf65287668905a59a88c52a9 Mon Sep 17 00:00:00 2001 From: John Long Date: Wed, 29 Nov 2023 14:40:25 -0500 Subject: [PATCH] updated broker to use current appDep of release --- components/broker/engine/store.go | 12 ++++++++++-- docs/quickstart.md | 12 ++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/components/broker/engine/store.go b/components/broker/engine/store.go index def2d6c..befa6e0 100644 --- a/components/broker/engine/store.go +++ b/components/broker/engine/store.go @@ -346,13 +346,21 @@ func (str *Store) buildReleaseMatcher(ctx context.Context) (*matcher.EventMatche vars map[string]*api.Val ) - if appDep, err := str.AppDeployment(rel.Spec.AppDeployment.Name); err != nil { + var appDepName string + if rel.Status.Current != nil { + appDepName = rel.Status.Current.AppDeployment.Name + } + if appDepName == "" { + str.log.Debugf("Release '%s/%s' does not have a current AppDeployment", rel.Namespace, rel.Name) + continue + } + + if appDep, err := str.AppDeployment(appDepName); err != nil { str.log.Warn(err) continue } else { comps = appDep.Spec.Components } - if env, err := str.ReleaseEnv(rel.Name); err != nil { str.log.Warn(err) continue diff --git a/docs/quickstart.md b/docs/quickstart.md index 4f3d51b..3cc4057 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -684,14 +684,18 @@ between deployments KubeFox is able to share a single pod. Not only are environments injected per request, routing is performed dynamically. For fun publish the new version, release it to the `qa` environment, then -promote version `v0.1.0` to the `prod` environment. Check out those blazing fast -the releases. +promote version `v0.1.0` to the `prod` environment. Because of the stricter +release policies set in the `prod` environment a snapshot is required for the +release. Much like a versioned deployment, an environment snapshot is immutable, +ensuring a stable release even if the `prod` environment is changed. + +Check out those blazing fast the releases. ```{ .shell .copy } git tag v0.1.1 && \ fox publish --version v0.1.1 --wait 5m && \ fox release v0.1.1 --virtual-env qa && \ - fox release v0.1.0 --virtual-env prod + fox release v0.1.0 --virtual-env prod --create-snapshot ``` ??? example "Output" @@ -700,7 +704,7 @@ git tag v0.1.1 && \ $ git tag v0.1.1 && \ fox publish --version v0.1.1 --wait 5m && \ fox release v0.1.1 --virtual-env qa && \ - fox release v0.1.0 --virtual-env prod + fox release v0.1.0 --virtual-env prod --create-snapshot info Component image 'localhost/kubefox/hello-world/backend:bb702a1' exists. info Loading component image 'localhost/kubefox/hello-world/backend:bb702a1' into kind cluster 'kind'.