-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83cfe91
commit c2d0f74
Showing
9 changed files
with
241 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# This deployment manigest is not relevant anymore | ||
# Workloads that are to be deployed on a workloads cluster are synced to the latter using Flux that is installed on the respective workload cluster | ||
# Flux gets installed on the workload cluster by using Flux that runs on the management cluster using Flux's remote deployment capability | ||
# | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 | ||
kind: Kustomization | ||
metadata: | ||
name: application-prometheus | ||
namespace: flux-system | ||
spec: | ||
dependsOn: | ||
- name: application-webapp | ||
interval: 30s | ||
path: ./deploy/monitoring | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system | ||
healthChecks: | ||
- apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
name: prometheus-helmrelease | ||
namespace: flux-system | ||
# | ||
# Prometheus is deployed using a HelmRelease. | ||
# Hence, the 'kubeConfig' field that points to the remote workload cluster is set in the HelmRelease manifest | ||
# | ||
validation: client | ||
timeout: 2m | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# This deployment manigest is not relevant anymore | ||
# Workloads that are to be deployed on a workloads cluster are synced to the latter using Flux that is installed on the respective workload cluster | ||
# Flux gets installed on the workload cluster by using Flux that runs on the management cluster using Flux's remote deployment capability | ||
# | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 | ||
kind: Kustomization | ||
metadata: | ||
name: application-webapp | ||
namespace: flux-system | ||
spec: | ||
interval: 30s | ||
path: ./deploy/webapp | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system | ||
kubeConfig: | ||
secretRef: | ||
name: crossplane-workload-cluster-connection | ||
validation: client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- prometheus-repository.yaml | ||
- prometheus-release.yaml | ||
# | ||
# Generate a ConfigMap resources from the specified file | ||
# This will generate a ConfigMap which will contain a key named 'value.yaml' | ||
# The value associated with this key will be the contents of the file 'prometheus-nosidecar-values.yaml' | ||
# This ConfigMap can then be references in a HelmRelease to override the default values for a Helm chart | ||
# | ||
configMapGenerator: | ||
- name: prometheus-configmap | ||
namespace: flux-system | ||
files: | ||
- values.yaml=prometheus-values.yaml | ||
# | ||
# Trigger a Helm release upgrade everytime the values in prometheus-values.yaml change | ||
# | ||
configurations: | ||
- kustomizeconfig.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# It is possible to use Kustomize ConfigMap generator to trigger a Helm release upgrade every time the encoded values change. | ||
# First, create a kustomizeconfig.yaml for Kustomize to be able to patch ConfigMap referenced in HelmRelease manifest | ||
# The 'fieldSpecs/path' identifies the ConfigMap referenced in the HelmRelease. | ||
# Create a HelmRelease definition that references a ConfigMap | ||
# Create a 'kustomization.yaml' that generates the ConfigMap using the configurations from 'kustomizeconfig.yaml' | ||
# | ||
nameReference: | ||
- kind: ConfigMap | ||
version: v1 | ||
fieldSpecs: | ||
- path: spec/valuesFrom/name | ||
kind: HelmRelease | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
# | ||
# Note that this HelmRelease is deployed on the workload cluster | ||
# The release itself is made in a namespace that equals to the namespace of the HelmRelease which is 'flux-system' here. | ||
# As this namespace should already exist, we have to create a 'flux-system' namespace on the workload cluster. | ||
# | ||
metadata: | ||
name: prometheus-helmrelease | ||
namespace: flux-system | ||
spec: | ||
# install: | ||
# createNamespace: true | ||
targetNamespace: monitoring | ||
releaseName: prometheus-for-amp | ||
interval: 5m | ||
kubeConfig: | ||
secretRef: | ||
name: crossplane-workload-cluster-connection | ||
chart: | ||
spec: | ||
chart: prometheus | ||
sourceRef: | ||
kind: HelmRepository | ||
name: prometheus-community | ||
namespace: flux-system | ||
interval: 1m | ||
valuesFrom: | ||
- kind: ConfigMap | ||
name: prometheus-configmap | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta1 | ||
kind: HelmRepository | ||
metadata: | ||
name: prometheus-community | ||
namespace: flux-system | ||
spec: | ||
interval: 5m | ||
url: https://prometheus-community.github.io/helm-charts | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
serviceAccounts: | ||
server: | ||
name: prometheus-service-account | ||
annotations: | ||
eks.amazonaws.com/role-arn: arn:aws:iam::937351930975:role/EKS-AMP-ServiceAccount-Role | ||
|
||
nodeExporter: | ||
enabled: false | ||
alertmanager: | ||
enabled: false | ||
pushgateway: | ||
enabled: false | ||
kubeStateMetrics: | ||
enabled: false | ||
|
||
server: | ||
statefulSet: | ||
enabled: false | ||
persistentVolume: | ||
enabled: false | ||
|
||
remoteWrite: | ||
- url: https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-f1b785f2-4d12-40ff-b5be-132f8b8ca14b/api/v1/remote_write | ||
sigv4: | ||
region: us-west-2 | ||
queue_config: | ||
max_samples_per_send: 1000 | ||
max_shards: 200 | ||
capacity: 2500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: flux-system | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: monitoring | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: golang | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: webapp | ||
namespace: golang | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: webapp | ||
role: scrape-target | ||
template: | ||
metadata: | ||
labels: | ||
app: webapp | ||
role: scrape-target | ||
annotations: | ||
prometheus.io/scrape: 'true' | ||
prometheus.io/port: '3000' | ||
prometheus.io/path: '/metrics' | ||
spec: | ||
containers: | ||
- name: golang | ||
image: public.ecr.aws/awsvijisarathy/prometheus-webapp:2.0 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: "128m" | ||
memory: "128Mi" | ||
ports: | ||
- name: http | ||
containerPort: 3000 | ||
protocol: TCP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: webapp-svc | ||
namespace: golang | ||
spec: | ||
sessionAffinity: None | ||
type: ClusterIP | ||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 3000 | ||
selector: | ||
app: webapp | ||
role: scrape-target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,12 +33,12 @@ spec: | |
# Note that you will have to execute the sealing step against the SealedSecrets controller in the workload cluster. | ||
# | ||
|
||
GITREPO_URL=ssh://[email protected]/vijayansarathy/fluxv2-deployment-apps.git | ||
flux create secret git flux-remote-bootstrap \ | ||
--url=$GITREPO_URL \ | ||
--namespace=flux-system \ | ||
--ssh-key-algorithm=ecdsa \ | ||
--ssh-ecdsa-curve=p521 | ||
# GITREPO_URL=ssh://[email protected]/vijayansarathy/fluxv2-deployment-apps.git | ||
# flux create secret git flux-remote-bootstrap \ | ||
# --url=$GITREPO_URL \ | ||
# --namespace=flux-system \ | ||
# --ssh-key-algorithm=ecdsa \ | ||
# --ssh-ecdsa-curve=p521 | ||
|
||
kubectl -n flux-system get secret flux-remote-bootstrap -o yaml > temp.yaml | ||
kubeseal --kubeconfig ./kubeconfig-admin --format yaml --controller-namespace sealed-secrets < temp.yaml > flux-remote-bootstrap-sealed-secret.yaml | ||
# kubectl -n flux-system get secret flux-remote-bootstrap -o yaml > temp.yaml | ||
# kubeseal --kubeconfig ./kubeconfig-admin --format yaml --controller-namespace sealed-secrets < temp.yaml > flux-remote-bootstrap-sealed-secret.yaml |