Skip to content

Commit

Permalink
refactor(k8s/samples): shorten fluxtomizations by using yaml anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
qlonik committed Apr 28, 2024
1 parent fabb85b commit 80b125b
Show file tree
Hide file tree
Showing 3 changed files with 251 additions and 347 deletions.
Original file line number Diff line number Diff line change
@@ -1,117 +1,85 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-details
namespace: flux-system
spec:
dependsOn:
- name: cluster-apps-istio-system-istiod
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/filter
targetNamespace: bookinfo-with-passthrough-filter
postBuild:
substitute:
filter_name: passthrough
app: details
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-ratings
namespace: flux-system
spec:
dependsOn:
- name: cluster-apps-istio-system-istiod
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/filter
targetNamespace: bookinfo-with-passthrough-filter
postBuild:
substitute:
filter_name: passthrough
app: ratings
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-reviews
namespace: flux-system
spec:
dependsOn:
- name: cluster-apps-istio-system-istiod
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/filter
targetNamespace: bookinfo-with-passthrough-filter
postBuild:
substitute:
filter_name: passthrough
app: reviews
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-productpage
namespace: flux-system
spec:
dependsOn:
- name: cluster-apps-istio-system-istiod
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/filter
targetNamespace: bookinfo-with-passthrough-filter
postBuild:
substitute:
filter_name: passthrough
app: productpage
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
apiVersion: v1
kind: List
extra:
filterName: &filterName passthrough
name: &name bookinfo-with-passthrough-filter
namespace: flux-system
spec:
dependsOn:
- name: bookinfo-envoy-passthrough-filter-details
- name: bookinfo-envoy-passthrough-filter-ratings
- name: bookinfo-envoy-passthrough-filter-reviews
- name: bookinfo-envoy-passthrough-filter-productpage
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/app
targetNamespace: *name
postBuild:
substitute:
ingress_name: *name
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m

baseSpec: &baseSpec
targetNamespace: *name
prune: true
sourceRef:
kind: GitRepository
name: prose-k8s-home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 3m

filterSpec: &filterSpec
<<: *baseSpec
dependsOn:
- name: cluster-apps-istio-system-istiod
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/filter

items:
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: *name
namespace: flux-system
spec:
<<: *baseSpec
dependsOn:
- name: bookinfo-envoy-passthrough-filter-details
- name: bookinfo-envoy-passthrough-filter-ratings
- name: bookinfo-envoy-passthrough-filter-reviews
- name: bookinfo-envoy-passthrough-filter-productpage
path: ./evaluation/kubernetes/apps/samples/bookinfo/_template/app
postBuild:
substitute:
ingress_name: *name
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-details
namespace: flux-system
spec:
<<: *filterSpec
postBuild:
substitute:
filter_name: *filterName
app: details
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-ratings
namespace: flux-system
spec:
<<: *filterSpec
postBuild:
substitute:
filter_name: *filterName
app: ratings
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-reviews
namespace: flux-system
spec:
<<: *filterSpec
postBuild:
substitute:
filter_name: *filterName
app: reviews
- apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: bookinfo-envoy-passthrough-filter-productpage
namespace: flux-system
spec:
<<: *filterSpec
postBuild:
substitute:
filter_name: *filterName
app: productpage
Loading

0 comments on commit 80b125b

Please sign in to comment.