Squashed 'acm-hub-bootstrap/' content from commit aea23ee
git-subtree-dir: acm-hub-bootstrap git-subtree-split: aea23ee88fafd5cab0e2d9189f872159c5f16b8e
This commit is contained in:
8
components/policies/gitops/base/kustomization.yaml
Normal file
8
components/policies/gitops/base/kustomization.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace: acm-policies
|
||||
|
||||
resources:
|
||||
- placement.yaml
|
||||
- managedclustersetbinding.yaml
|
||||
|
||||
generators:
|
||||
- policy-generator-config.yaml
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: cluster.open-cluster-management.io/v1beta2
|
||||
kind: ManagedClusterSetBinding
|
||||
metadata:
|
||||
name: global
|
||||
namespace: acm-policies
|
||||
spec:
|
||||
clusterSet: global
|
||||
@@ -0,0 +1,39 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: eso-token-cluster
|
||||
namespace: external-secrets
|
||||
data:
|
||||
dopplerToken: '{{hub (fromSecret "acm-policies" (printf "eso-token-cluster-%s" .ManagedClusterName) "dopplerToken") hub}}'
|
||||
---
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ClusterSecretStore
|
||||
metadata:
|
||||
name: doppler-cluster
|
||||
spec:
|
||||
provider:
|
||||
doppler:
|
||||
auth:
|
||||
secretRef:
|
||||
dopplerToken:
|
||||
name: eso-token-cluster
|
||||
key: dopplerToken
|
||||
namespace: external-secrets
|
||||
|
||||
conditions:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
openshift.io/cluster-monitoring: "true"
|
||||
|
||||
- namespaces:
|
||||
- "cert-manager"
|
||||
- "dev-tools"
|
||||
- "gitops"
|
||||
- "openshift-config"
|
||||
- "openshift-gitops"
|
||||
- "openshift-monitoring"
|
||||
- "openshift-pipelines"
|
||||
- "stackrox"
|
||||
- "stackrox-secured-cluster-service"
|
||||
- "tenant-secrets"
|
||||
- "trusted-profile-analyzer"
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace: openshift-gitops
|
||||
|
||||
resources:
|
||||
- prometheus-rules.yaml
|
||||
@@ -0,0 +1,31 @@
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: argocd-health-alerts
|
||||
annotations:
|
||||
policy.open-cluster-management.io/disable-templates: "true"
|
||||
spec:
|
||||
groups:
|
||||
- name: ArgoCD
|
||||
rules:
|
||||
- alert: ArgoCDHealthAlert
|
||||
annotations:
|
||||
message: ArgoCD application {{ $labels.name }} is not healthy
|
||||
expr: argocd_app_info{namespace="openshift-gitops", health_status!~"Healthy|Suspended|Progressing|Degraded"} > 0
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
- alert: ArgoCDDegradedAlert
|
||||
annotations:
|
||||
message: ArgoCD application {{ $labels.name }} is degraded
|
||||
expr: argocd_app_info{namespace="openshift-gitops", health_status="Degraded"} > 0
|
||||
for: 5m
|
||||
labels:
|
||||
severity: critical
|
||||
- alert: ArgoCDStuckAlert
|
||||
annotations:
|
||||
message: ArgoCD application {{ $labels.name }} is stuck in progressing for more than 10m
|
||||
expr: argocd_app_info{namespace="openshift-gitops", health_status="Progressing"} > 0
|
||||
for: 10m
|
||||
labels:
|
||||
severity: warning
|
||||
@@ -0,0 +1,27 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: cluster-config-bootstrap
|
||||
namespace: openshift-gitops
|
||||
labels:
|
||||
gitops.ownedBy: cluster-config
|
||||
spec:
|
||||
destination:
|
||||
namespace: openshift-gitops
|
||||
server: https://kubernetes.default.svc
|
||||
project: bootstrap
|
||||
source:
|
||||
path: bootstrap/overlays/{{ fromClusterClaim "gitops" }}
|
||||
repoURL: https://github.com/gnunn-gitops/cluster-config-pins.git
|
||||
targetRevision: 'HEAD'
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: false
|
||||
selfHeal: false
|
||||
ignoreDifferences:
|
||||
- group: argoproj.io
|
||||
kind: Application
|
||||
managedFieldsManagers:
|
||||
- argocd-server
|
||||
jsonPointers:
|
||||
- /spec/syncPolicy/automated
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: AppProject
|
||||
metadata:
|
||||
name: bootstrap
|
||||
namespace: openshift-gitops
|
||||
spec:
|
||||
clusterResourceWhitelist:
|
||||
- group: '*'
|
||||
kind: '*'
|
||||
description: Project for bootstrap cluster app
|
||||
destinations:
|
||||
- namespace: '*'
|
||||
server: https://kubernetes.default.svc
|
||||
sourceRepos:
|
||||
- https://github.com/gnunn-gitops/cluster-config
|
||||
- https://github.com/gnunn-gitops/cluster-config-pins
|
||||
@@ -0,0 +1,3 @@
|
||||
resources:
|
||||
- bootstrap-appproject.yaml
|
||||
- bootstrap-app.yaml
|
||||
@@ -0,0 +1,389 @@
|
||||
apiVersion: argoproj.io/v1beta1
|
||||
kind: ArgoCD
|
||||
metadata:
|
||||
name: openshift-gitops
|
||||
namespace: openshift-gitops
|
||||
spec:
|
||||
resourceTrackingMethod: annotation
|
||||
applicationSet: {}
|
||||
extraConfig:
|
||||
exec.enabled: "true"
|
||||
resource.respectRBAC: "normal"
|
||||
resource.ignoreResourceUpdatesEnabled: 'true'
|
||||
resource.compareoptions: |
|
||||
ignoreAggregatedRoles: true
|
||||
resource.customizations.ignoreResourceUpdates.external-secrets.io_ExternalSecret: |
|
||||
jsonPointers:
|
||||
- /status/refreshTime
|
||||
resource.customizations.ignoreResourceUpdates.ocs.openshift.io_StorageCluster: |
|
||||
jsonPointers:
|
||||
- /status
|
||||
- /metadata/resourceVersion
|
||||
resource.customizations.ignoreResourceUpdates.ocs.openshift.io_StorageSystem: |
|
||||
jsonPointers:
|
||||
- /status
|
||||
- /metadata/resourceVersion
|
||||
resource.customizations.ignoreResourceUpdates.noobaa.io_Noobaa: |
|
||||
jsonPointers:
|
||||
- /status
|
||||
- /metadata/resourceVersion
|
||||
resource.customizations.ignoreResourceUpdates.noobaa.io_BackingStore: |
|
||||
jsonPointers:
|
||||
- /status
|
||||
- /metadata/resourceVersion
|
||||
accounts.admin: apiKey, login
|
||||
ui.cssurl: 'https://gnunn-gitops.github.io/cluster-config/themes/{{ fromClusterClaim "gitops" }}/custom-cluster.css'
|
||||
kustomizeBuildOptions: "--enable-helm --enable-alpha-plugins"
|
||||
oidcConfig: |
|
||||
name: Keycloak
|
||||
issuer: https://sso.ocplab.com/realms/ocplab
|
||||
clientID: argocd
|
||||
clientSecret: $oidc.keycloak.clientSecret
|
||||
requestedScopes: ["openid", "profile", "email", "groups"]
|
||||
controller:
|
||||
extraCommandArgs:
|
||||
- '--persist-resource-health=false'
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
requests:
|
||||
cpu: 1000m
|
||||
memory: 3Gi
|
||||
monitoring:
|
||||
enabled: true
|
||||
repo:
|
||||
sidecarContainers:
|
||||
- name: setenv-cmp-plugin
|
||||
command: [/var/run/argocd/argocd-cmp-server]
|
||||
env:
|
||||
- name: KUSTOMIZE_PLUGIN_HOME
|
||||
value: /etc/kustomize/plugin
|
||||
- name: INFRASTRUCTURE_ID
|
||||
value: '{{ (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").status.infrastructureName }}'
|
||||
- name: CLUSTER_ID
|
||||
value: '{{ (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").spec.clusterID }}'
|
||||
- name: CLUSTER_GITOPS_NAME
|
||||
value: '{{ fromClusterClaim "gitops" }}'
|
||||
- name: CLUSTER_NAME
|
||||
value: '{{ fromClusterClaim "name" }}'
|
||||
- name: SUB_DOMAIN
|
||||
value: '{{ (lookup "config.openshift.io/v1" "Ingress" "openshift-ingress" "cluster").spec.domain }}'
|
||||
- name: BASE_DOMAIN
|
||||
value: '{{ (lookup "config.openshift.io/v1" "DNS" "" "cluster").spec.baseDomain }}'
|
||||
- name: COLOR
|
||||
value: '{{ default "0066CC" (fromClusterClaim "color") }}'
|
||||
image: quay.io/gnunn/tools:latest
|
||||
imagePullPolicy: Always
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/argocd
|
||||
name: var-files
|
||||
- mountPath: /home/argocd/cmp-server/plugins
|
||||
name: plugins
|
||||
- mountPath: /tmp
|
||||
name: tmp
|
||||
- mountPath: /home/argocd/cmp-server/config/plugin.yaml
|
||||
subPath: plugin.yaml
|
||||
name: setenv-cmp-plugin
|
||||
volumes:
|
||||
- configMap:
|
||||
name: setenv-cmp-plugin
|
||||
name: setenv-cmp-plugin
|
||||
resources:
|
||||
limits:
|
||||
cpu: '1'
|
||||
memory: 1.5Gi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 768Mi
|
||||
redis:
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
server:
|
||||
insecure: true
|
||||
# host: 'openshift-gitops-server-openshift-gitops.{{ (lookup "config.openshift.io/v1" "Ingress" "openshift-ingress" "cluster").spec.domain }}'
|
||||
route:
|
||||
enabled: true
|
||||
tls:
|
||||
termination: edge
|
||||
insecureEdgeTerminationPolicy: Redirect
|
||||
notifications:
|
||||
enabled: true
|
||||
resourceActions:
|
||||
- group: compliance.openshift.io
|
||||
kind: ComplianceScan
|
||||
action: |
|
||||
discovery.lua: |
|
||||
local actions = {}
|
||||
local enabled = false
|
||||
if obj.status ~= nil and obj.status.phase == "DONE" then
|
||||
enabled = true
|
||||
end
|
||||
actions["rescan"] = {["disabled"] = not(enabled)}
|
||||
return actions
|
||||
definitions:
|
||||
- name: rescan
|
||||
action.lua: |
|
||||
if obj.metadata.annotations == nil then
|
||||
obj.metadata.annotations = {}
|
||||
end
|
||||
obj.metadata.annotations["compliance.openshift.io/rescan"] = ""
|
||||
return obj
|
||||
resourceHealthChecks:
|
||||
- group: argoproj.io
|
||||
kind: Application
|
||||
check: |
|
||||
hs = {}
|
||||
hs.status = "Progressing"
|
||||
hs.message = ""
|
||||
if obj.status ~= nil then
|
||||
if obj.status.health ~= nil then
|
||||
hs.status = obj.status.health.status
|
||||
hs.message = obj.status.health.message
|
||||
end
|
||||
end
|
||||
return hs
|
||||
- group: argoproj.io
|
||||
kind: RolloutManager
|
||||
check: |
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
for _, condition in ipairs(obj.status.conditions) do
|
||||
hs.message = condition.message
|
||||
break
|
||||
end
|
||||
end
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "Failure" then
|
||||
hs.status = "Degraded"
|
||||
return hs
|
||||
elseif obj.status.phase == "Available" then
|
||||
hs.status = "Healthy"
|
||||
return hs
|
||||
elseif obj.status.phase == "Pending" then
|
||||
hs.status = "Progressing"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for operator to update status"
|
||||
return hs
|
||||
end
|
||||
- group: operators.coreos.com
|
||||
kind: Subscription
|
||||
check: |
|
||||
health_status = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
numDegraded = 0
|
||||
numPending = 0
|
||||
numSuspended = 0
|
||||
msg = ""
|
||||
for i, condition in pairs(obj.status.conditions) do
|
||||
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. (condition.reason and condition.reason or '') .. "\n"
|
||||
if condition.type == "InstallPlanPending" and condition.status == "True" then
|
||||
if condition.reason == "RequiresApproval" then
|
||||
numSuspended = numSuspended + 1
|
||||
else
|
||||
numPending = numPending + 1
|
||||
end
|
||||
elseif (condition.type == "InstallPlanMissing" and condition.reason ~= "ReferencedInstallPlanNotFound") then
|
||||
numDegraded = numDegraded + 1
|
||||
elseif (condition.type == "CatalogSourcesUnhealthy" or condition.type == "InstallPlanFailed") and condition.status == "True" then
|
||||
numDegraded = numDegraded + 1
|
||||
elseif (condition.type == "ResolutionFailed" and condition.reason ~= "ConstraintsNotSatisfiable") then
|
||||
numDegraded = numDegraded + 1
|
||||
elseif (condition.type == 'ChannelDeprecated' and condition.status == "True") then
|
||||
numDegraded = numDegraded + 1
|
||||
end
|
||||
end
|
||||
if numDegraded > 0 then
|
||||
health_status.status = "Degraded"
|
||||
health_status.message = msg
|
||||
return health_status
|
||||
elseif numSuspended > 0 then
|
||||
health_status.status = "Suspended"
|
||||
health_status.message = msg
|
||||
return health_status
|
||||
elseif numPending > 0 then
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "An install plan for a subscription is pending installation"
|
||||
return health_status
|
||||
else
|
||||
health_status.status = "Healthy"
|
||||
health_status.message = msg
|
||||
return health_status
|
||||
end
|
||||
end
|
||||
end
|
||||
health_status.status = "Progressing"
|
||||
health_status.message = "An install plan for a subscription is pending installation"
|
||||
return health_status
|
||||
- group: operators.coreos.com
|
||||
kind: InstallPlan
|
||||
check: |
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "Complete" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
elseif obj.status.phase == "RequiresApproval" then
|
||||
hs.status = "Suspended"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
else
|
||||
hs.status = "Progressing"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for InstallPlan to complete"
|
||||
return hs
|
||||
- group: platform.stackrox.io
|
||||
kind: Central
|
||||
check: |
|
||||
hs = {}
|
||||
if obj.status ~= nil and obj.status.conditions ~= nil then
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.status == "True" or condition.reason == "InstallSuccessful" or condition.reason == "UpgradeSuccessful" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "Install Successful"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for Central to deploy."
|
||||
return hs
|
||||
- group: image.openshift.io
|
||||
kind: ImageStream
|
||||
check: |
|
||||
hs = {}
|
||||
hs.status = "Progressing"
|
||||
hs.message = ""
|
||||
if obj.status ~= nil then
|
||||
if obj.status.tags ~= nil then
|
||||
numTags = 0
|
||||
for _ , item in pairs(obj.status.tags) do
|
||||
numTags = numTags + 1
|
||||
numItems = 0
|
||||
if item.tags ~= nil then
|
||||
for _ , item in pairs(item.tags) do
|
||||
numItems = numItems + 1
|
||||
end
|
||||
if numItems == 0 then
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
if numTags > 0 then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "ImageStream has tags resolved"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
return hs
|
||||
- group: build.openshift.io
|
||||
kind: Build
|
||||
check: |
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "Complete" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for Build to complete"
|
||||
return hs
|
||||
- kind: PersistentVolumeClaim
|
||||
check: |
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.phase ~= nil then
|
||||
if obj.status.phase == "Pending" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
end
|
||||
if obj.status.phase == "Bound" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = obj.status.phase
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for PVC"
|
||||
return hs
|
||||
resourceIgnoreDifferences:
|
||||
resourceIdentifiers:
|
||||
- group: route.openshift.io
|
||||
kind: Route
|
||||
customization:
|
||||
jsonPointers:
|
||||
- /status/ingress
|
||||
- /metadata/annotations
|
||||
- group: quay.redhat.com
|
||||
kind: QuayRegistry
|
||||
customization:
|
||||
jsonPointers:
|
||||
- /status/ingress
|
||||
- group: cluster.open-cluster-management.io
|
||||
kind: ManagedCluster
|
||||
customization:
|
||||
jsonPointers:
|
||||
- /spec/managedClusterClientConfigs
|
||||
resourceExclusions: |
|
||||
- apiGroups:
|
||||
- tekton.dev
|
||||
clusters:
|
||||
- '*'
|
||||
kinds:
|
||||
- TaskRun
|
||||
- PipelineRun
|
||||
- apiGroups:
|
||||
- operator.tekton.dev
|
||||
clusters:
|
||||
- '*'
|
||||
kinds:
|
||||
- TektonAddon
|
||||
- TektonInstallerSet
|
||||
- apiGroups:
|
||||
- compliance.openshift.io
|
||||
kinds:
|
||||
- ComplianceCheckResult
|
||||
- ComplianceRemediation
|
||||
- apiGroups:
|
||||
- policy.open-cluster-management.io
|
||||
kinds:
|
||||
- ConfigurationPolicy
|
||||
- apiGroups:
|
||||
- noobaa.io
|
||||
kinds:
|
||||
- NooBaa
|
||||
- BucketClass
|
||||
ha:
|
||||
enabled: false
|
||||
rbac:
|
||||
defaultPolicy: 'role:none'
|
||||
policy: |
|
||||
p, role:none, *, *, */*, deny
|
||||
g, system:cluster-admins, role:admin
|
||||
g, cluster-admins, role:admin
|
||||
scopes: "[groups]"
|
||||
@@ -0,0 +1,3 @@
|
||||
resources:
|
||||
- setenv-cmp-plugin-cm.yaml
|
||||
- argocd.yaml
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: setenv-cmp-plugin
|
||||
namespace: openshift-gitops
|
||||
data:
|
||||
plugin.yaml: |
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: ConfigManagementPlugin
|
||||
metadata:
|
||||
name: setenv-cmp-plugin
|
||||
spec:
|
||||
init:
|
||||
command: [sh, -c, 'echo "Initializing setenv-plugin-cmp..."']
|
||||
generate:
|
||||
command:
|
||||
- sh
|
||||
- "-c"
|
||||
- "set -o pipefail && kustomize build --enable-helm --enable-alpha-plugins . | envsub"
|
||||
@@ -0,0 +1,2 @@
|
||||
resources:
|
||||
- notifications-config.yaml
|
||||
@@ -0,0 +1,256 @@
|
||||
# No longer needed with NotificationsConfig introduced in 1.12
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: openshift-gitops
|
||||
app.kubernetes.io/name: argocd-notifications-cm
|
||||
app.kubernetes.io/part-of: argocd
|
||||
annotation:
|
||||
policy.open-cluster-management.io/disable-templates: "true"
|
||||
name: argocd-notifications-cm
|
||||
namespace: openshift-gitops
|
||||
data:
|
||||
service.slack: |
|
||||
token: $slack-token
|
||||
template.app-deployed: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#18be52",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Revision",
|
||||
"value": "{{.app.status.sync.revision}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
template.app-health-degraded: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#f4c030",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Health Status",
|
||||
"value": "{{.app.status.health.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
template.app-sync-failed: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#E96D76",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
template.app-sync-running: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#0DADEA",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
template.app-sync-status-unknown: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#E96D76",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
template.app-sync-succeeded: |-
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#18be52",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
# trigger.on-created: |-
|
||||
# - description: Application is created.
|
||||
# oncePer: app.metadata.name
|
||||
# send:
|
||||
# - app-created
|
||||
# when: "true"
|
||||
# trigger.on-deleted: |-
|
||||
# - description: Application is deleted.
|
||||
# oncePer: app.metadata.name
|
||||
# send:
|
||||
# - app-deleted
|
||||
# when: app.metadata.deletionTimestamp != nil
|
||||
trigger.on-deployed: |-
|
||||
- description: Application is synced and healthy. Triggered once per commit.
|
||||
oncePer: app.status.operationState.syncResult.revision
|
||||
send:
|
||||
- app-deployed
|
||||
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status
|
||||
== 'Healthy'
|
||||
trigger.on-health-degraded: |-
|
||||
- description: Application has degraded
|
||||
send:
|
||||
- app-health-degraded
|
||||
when: app.status.health.status == 'Degraded'
|
||||
trigger.on-sync-failed: |-
|
||||
- description: Application syncing has failed
|
||||
send:
|
||||
- app-sync-failed
|
||||
when: app.status.operationState.phase in ['Error', 'Failed']
|
||||
trigger.on-sync-running: |-
|
||||
- description: Application is being synced
|
||||
send:
|
||||
- app-sync-running
|
||||
when: app.status.operationState.phase in ['Running']
|
||||
trigger.on-sync-status-unknown: |-
|
||||
- description: Application status is 'Unknown'
|
||||
end:
|
||||
- app-sync-status-unknown
|
||||
when: app.status.sync.status == 'Unknown'
|
||||
trigger.on-sync-succeeded: |-
|
||||
- description: Application syncing has succeeded
|
||||
send:
|
||||
- app-sync-succeeded
|
||||
when: app.status.operationState.phase in ['Succeeded']
|
||||
@@ -0,0 +1,540 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: NotificationsConfiguration
|
||||
metadata:
|
||||
name: default-notifications-configuration
|
||||
namespace: openshift-gitops
|
||||
spec:
|
||||
services:
|
||||
service.slack: |
|
||||
token: $slack-token
|
||||
templates:
|
||||
template.app-created: |-
|
||||
email:
|
||||
subject: Application {{.app.metadata.name}} has been created.
|
||||
message: Application {{.app.metadata.name}} has been created.
|
||||
teams:
|
||||
title: Application {{.app.metadata.name}} has been created.
|
||||
template.app-deleted: |-
|
||||
email:
|
||||
subject: Application {{.app.metadata.name}} has been deleted.
|
||||
message: Application {{.app.metadata.name}} has been deleted.
|
||||
teams:
|
||||
title: Application {{.app.metadata.name}} has been deleted.
|
||||
template.app-deployed: |-
|
||||
email:
|
||||
subject: New version of an application {{.app.metadata.name}} is up and running.
|
||||
message: |
|
||||
{{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests.
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#18be52",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Revision",
|
||||
"value": "{{.app.status.sync.revision}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
},
|
||||
{
|
||||
"name": "Revision",
|
||||
"value": "{{.app.status.sync.revision}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |-
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Operation Application",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
themeColor: '#000080'
|
||||
title: New version of an application {{.app.metadata.name}} is up and running.
|
||||
template.app-health-degraded: |-
|
||||
email:
|
||||
subject: Application {{.app.metadata.name}} has degraded.
|
||||
message: |
|
||||
{{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded.
|
||||
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#f4c030",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Health Status",
|
||||
"value": "{{.app.status.health.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Health Status",
|
||||
"value": "{{.app.status.health.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Application",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
themeColor: '#FF0000'
|
||||
title: Application {{.app.metadata.name}} has degraded.
|
||||
template.app-sync-failed: |-
|
||||
email:
|
||||
subject: Failed to sync application {{.app.metadata.name}}.
|
||||
message: |
|
||||
{{if eq .serviceType "slack"}}:exclamation:{{end}} The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}
|
||||
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#E96D76",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Failed at",
|
||||
"value": "{{.app.status.operationState.finishedAt}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |-
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Operation",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
themeColor: '#FF0000'
|
||||
title: Failed to sync application {{.app.metadata.name}}.
|
||||
template.app-sync-running: |-
|
||||
email:
|
||||
subject: Start syncing application {{.app.metadata.name}}.
|
||||
message: |
|
||||
The sync operation of application {{.app.metadata.name}} has started at {{.app.status.operationState.startedAt}}.
|
||||
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#0DADEA",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Started at",
|
||||
"value": "{{.app.status.operationState.startedAt}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |-
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Operation",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
title: Start syncing application {{.app.metadata.name}}.
|
||||
template.app-sync-status-unknown: |-
|
||||
email:
|
||||
subject: Application {{.app.metadata.name}} sync status is 'Unknown'
|
||||
message: |
|
||||
{{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} sync is 'Unknown'.
|
||||
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
|
||||
{{if ne .serviceType "slack"}}
|
||||
{{range $c := .app.status.conditions}}
|
||||
* {{$c.message}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#E96D76",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |-
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Application",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
title: Application {{.app.metadata.name}} sync status is 'Unknown'
|
||||
template.app-sync-succeeded: |-
|
||||
email:
|
||||
subject: Application {{.app.metadata.name}} has been successfully synced.
|
||||
message: |
|
||||
{{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}.
|
||||
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
|
||||
slack:
|
||||
attachments: |
|
||||
[{
|
||||
"title": "{{ .app.metadata.name}}",
|
||||
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
|
||||
"color": "#18be52",
|
||||
"fields": [
|
||||
{
|
||||
"title": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}",
|
||||
"short": true
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"title": "{{$c.type}}",
|
||||
"value": "{{$c.message}}",
|
||||
"short": true
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
}]
|
||||
deliveryPolicy: Post
|
||||
groupingKey: ""
|
||||
notifyBroadcast: false
|
||||
teams:
|
||||
facts: |
|
||||
[{
|
||||
"name": "Sync Status",
|
||||
"value": "{{.app.status.sync.status}}"
|
||||
},
|
||||
{
|
||||
"name": "Synced at",
|
||||
"value": "{{.app.status.operationState.finishedAt}}"
|
||||
},
|
||||
{
|
||||
"name": "Repository",
|
||||
"value": "{{.app.spec.source.repoURL}}"
|
||||
}
|
||||
{{range $index, $c := .app.status.conditions}}
|
||||
{{if not $index}},{{end}}
|
||||
{{if $index}},{{end}}
|
||||
{
|
||||
"name": "{{$c.type}}",
|
||||
"value": "{{$c.message}}"
|
||||
}
|
||||
{{end}}
|
||||
]
|
||||
potentialAction: |-
|
||||
[{
|
||||
"@type":"OpenUri",
|
||||
"name":"Operation Details",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"@type":"OpenUri",
|
||||
"name":"Open Repository",
|
||||
"targets":[{
|
||||
"os":"default",
|
||||
"uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
|
||||
}]
|
||||
}]
|
||||
themeColor: '#000080'
|
||||
title: Application {{.app.metadata.name}} has been successfully synced
|
||||
triggers:
|
||||
trigger.on-created: |-
|
||||
- description: Application is created.
|
||||
oncePer: app.metadata.name
|
||||
send:
|
||||
- app-created
|
||||
when: "true"
|
||||
trigger.on-deleted: |-
|
||||
- description: Application is deleted.
|
||||
oncePer: app.metadata.name
|
||||
send:
|
||||
- app-deleted
|
||||
when: app.metadata.deletionTimestamp != nil
|
||||
trigger.on-deployed: |-
|
||||
- description: Application is synced and healthy. Triggered once per commit.
|
||||
oncePer: app.status.operationState.syncResult.revision
|
||||
send:
|
||||
- app-deployed
|
||||
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status
|
||||
== 'Healthy'
|
||||
trigger.on-health-degraded: |-
|
||||
- description: Application has degraded
|
||||
send:
|
||||
- app-health-degraded
|
||||
when: app.status.health.status == 'Degraded'
|
||||
trigger.on-sync-failed: |-
|
||||
- description: Application syncing has failed
|
||||
send:
|
||||
- app-sync-failed
|
||||
when: app.status.operationState.phase in ['Error', 'Failed']
|
||||
trigger.on-sync-running: |-
|
||||
- description: Application is being synced
|
||||
send:
|
||||
- app-sync-running
|
||||
when: app.status.operationState.phase in ['Running']
|
||||
trigger.on-sync-status-unknown: |-
|
||||
- description: Application status is 'Unknown'
|
||||
send:
|
||||
- app-sync-status-unknown
|
||||
when: app.status.sync.status == 'Unknown'
|
||||
trigger.on-sync-succeeded: |-
|
||||
- description: Application syncing has succeeded
|
||||
send:
|
||||
- app-sync-succeeded
|
||||
when: app.status.operationState.phase in ['Succeeded']
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: argocd-secret
|
||||
namespace: openshift-gitops
|
||||
spec:
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: OIDC_ARGOCD
|
||||
secretKey: oidc.keycloak.clientSecret
|
||||
refreshInterval: 1h
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: doppler-cluster
|
||||
target:
|
||||
creationPolicy: Merge
|
||||
deletionPolicy: Retain
|
||||
name: argocd-secret
|
||||
@@ -0,0 +1,3 @@
|
||||
resources:
|
||||
- argocd-external-secret.yaml
|
||||
- notifications-secret.yaml
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: argocd-notifications-secret
|
||||
namespace: openshift-gitops
|
||||
spec:
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: doppler-cluster
|
||||
target:
|
||||
name: argocd-notifications-secret
|
||||
creationPolicy: Merge
|
||||
deletionPolicy: Retain
|
||||
data:
|
||||
- secretKey: slack-token
|
||||
remoteRef:
|
||||
key: GITOPS_SLACK_TOKEN
|
||||
@@ -0,0 +1,12 @@
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: argocd-application-controller-cluster-admin
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: openshift-gitops-argocd-application-controller
|
||||
namespace: openshift-gitops
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
@@ -0,0 +1,39 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
name: gitops-controller
|
||||
aggregationRule:
|
||||
clusterRoleSelectors:
|
||||
- matchLabels:
|
||||
gitops/aggregate-to-controller: "true"
|
||||
rules: []
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: gitops-controller-admin
|
||||
labels:
|
||||
gitops/aggregate-to-controller: "true"
|
||||
aggregationRule:
|
||||
clusterRoleSelectors:
|
||||
- matchLabels:
|
||||
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||
rules: []
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: gitops-controller-view
|
||||
labels:
|
||||
gitops/aggregate-to-controller: "true"
|
||||
rules:
|
||||
- apiGroups:
|
||||
- '*'
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
@@ -0,0 +1,53 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: gitops-server
|
||||
rules:
|
||||
- verbs:
|
||||
- get
|
||||
- patch
|
||||
- delete
|
||||
apiGroups:
|
||||
- '*'
|
||||
resources:
|
||||
- '*'
|
||||
- verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- update
|
||||
- patch
|
||||
- delete
|
||||
apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- secrets
|
||||
- configmaps
|
||||
- verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- update
|
||||
- delete
|
||||
- patch
|
||||
apiGroups:
|
||||
- argoproj.io
|
||||
resources:
|
||||
- applications
|
||||
- appprojects
|
||||
- applicationsets
|
||||
- verbs:
|
||||
- create
|
||||
- list
|
||||
apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- events
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/exec
|
||||
verbs:
|
||||
- create
|
||||
@@ -0,0 +1,8 @@
|
||||
resources:
|
||||
- sub-namespace.yaml
|
||||
- sub-operatorgroup.yaml
|
||||
- subscription.yaml
|
||||
- namespace.yaml
|
||||
- gitops-controller-rbac.yaml
|
||||
- gitops-server-rbac.yaml
|
||||
- cluster-admin-rolebinding.yaml
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
labels:
|
||||
openshift.io/cluster-monitoring: "true"
|
||||
name: openshift-gitops
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
labels:
|
||||
openshift.io/cluster-monitoring: "true"
|
||||
name: openshift-gitops-operator
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: operators.coreos.com/v1
|
||||
kind: OperatorGroup
|
||||
metadata:
|
||||
name: gitops-operators
|
||||
namespace: openshift-gitops-operator
|
||||
spec:
|
||||
upgradeStrategy: Default
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: operators.coreos.com/v1alpha1
|
||||
kind: Subscription
|
||||
metadata:
|
||||
name: openshift-gitops-operator
|
||||
namespace: openshift-gitops-operator
|
||||
spec:
|
||||
config:
|
||||
env:
|
||||
- name: ARGOCD_CLUSTER_CONFIG_NAMESPACES
|
||||
value: openshift-gitops, gitops
|
||||
- name: CONTROLLER_CLUSTER_ROLE
|
||||
value: gitops-controller
|
||||
- name: SERVER_CLUSTER_ROLE
|
||||
value: gitops-server
|
||||
channel: gitops-1.15
|
||||
installPlanApproval: Automatic
|
||||
name: openshift-gitops-operator
|
||||
source: redhat-operators
|
||||
sourceNamespace: openshift-marketplace
|
||||
28
components/policies/gitops/base/placement.yaml
Normal file
28
components/policies/gitops/base/placement.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: cluster.open-cluster-management.io/v1beta1
|
||||
kind: Placement
|
||||
metadata:
|
||||
name: placement-policy-gitops
|
||||
namespace: acm-policies
|
||||
spec:
|
||||
clusterSets:
|
||||
- global
|
||||
predicates:
|
||||
- requiredClusterSelector:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: gitops
|
||||
operator: Exists
|
||||
---
|
||||
apiVersion: policy.open-cluster-management.io/v1
|
||||
kind: PlacementBinding
|
||||
metadata:
|
||||
name: binding-policy-gitops
|
||||
namespace: acm-policies
|
||||
placementRef:
|
||||
apiGroup: cluster.open-cluster-management.io
|
||||
kind: Placement
|
||||
name: placement-policy-gitops
|
||||
subjects:
|
||||
- apiGroup: policy.open-cluster-management.io
|
||||
kind: PolicySet
|
||||
name: gitops
|
||||
60
components/policies/gitops/base/policy-generator-config.yaml
Normal file
60
components/policies/gitops/base/policy-generator-config.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
apiVersion: policy.open-cluster-management.io/v1
|
||||
kind: PolicyGenerator
|
||||
metadata:
|
||||
name: gitops-policy-generator
|
||||
policyDefaults:
|
||||
namespace: acm-policies
|
||||
remediationAction: enforce
|
||||
placementBindingDefaults:
|
||||
name: "binding-policy-gitops"
|
||||
policies:
|
||||
- name: policy-eso-secret-store
|
||||
configurationPolicyAnnotations:
|
||||
apps.open-cluster-management.io/reconcile-option: replace
|
||||
manifests:
|
||||
- path: manifests/eso/base/
|
||||
- name: policy-gitops-subscription
|
||||
remediationAction: enforce
|
||||
manifests:
|
||||
- path: manifests/gitops-subscription/base/
|
||||
- name: policy-gitops-instance
|
||||
# Needed to fix issue with merging lists resulting in duplicates
|
||||
configurationPolicyAnnotations:
|
||||
apps.open-cluster-management.io/reconcile-option: replace
|
||||
complianceType: "mustonlyhave"
|
||||
manifests:
|
||||
- path: manifests/gitops-instance/base/
|
||||
- name: policy-gitops-bootstrap
|
||||
manifests:
|
||||
- path: manifests/gitops-bootstrap/base/
|
||||
- name: policy-gitops-notifications
|
||||
remediationAction: enforce
|
||||
manifests:
|
||||
- path: manifests/gitops-notifications/base/
|
||||
configurationPolicyAnnotations:
|
||||
policy.open-cluster-management.io/disable-templates: "true"
|
||||
- name: policy-gitops-alerting
|
||||
remediationAction: enforce
|
||||
manifests:
|
||||
- path: manifests/gitops-alerting/base/
|
||||
configurationPolicyAnnotations:
|
||||
policy.open-cluster-management.io/disable-templates: "true"
|
||||
# Put ESO secrets into separate policy since it's chicken and egg
|
||||
# Not being used since I have a global policy that does this but included for example
|
||||
# - name: policy-gitops-secrets
|
||||
# remediationAction: enforce
|
||||
# manifests:
|
||||
# - path: manifests/gitops-secrets/base/
|
||||
policySets:
|
||||
- name: "gitops"
|
||||
description: "Policy for bootstrapping cluster with gitops"
|
||||
policies:
|
||||
- policy-eso-secret-store
|
||||
- policy-gitops-subscription
|
||||
- policy-gitops-instance
|
||||
- policy-gitops-bootstrap
|
||||
- policy-gitops-notifications
|
||||
- policy-gitops-alerting
|
||||
generatePolicySetPlacement: false
|
||||
placement:
|
||||
name: placement-policy-gitops
|
||||
Reference in New Issue
Block a user