Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate velero and minio in tests #1055

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9c635b5
Update values-kind-security.yaml
jkleinlercher Feb 14, 2025
843cc0a
Merge branch 'main' into feat/test-velero-minio
jkleinlercher Feb 15, 2025
8f55e01
feat: add crossplane resource health checks
jkleinlercher Feb 16, 2025
fb8df46
fix indent
jkleinlercher Feb 16, 2025
e7b730f
fix: keycloak-builtin-objects-kubrix expects this secret
jkleinlercher Feb 16, 2025
cad4e2f
fix: XR needs keycloak service and deployment
jkleinlercher Feb 16, 2025
39095b4
fix: keycloak-builtin-objects-kubrix needs realm
jkleinlercher Feb 16, 2025
ce39668
create roles dynamically based on the values
jkleinlercher Feb 21, 2025
709574e
updated trivy scan results
github-actions[bot] Feb 21, 2025
bb92a58
specify better labels for grafana roles
jkleinlercher Feb 21, 2025
955ee03
Merge branch 'feat/test-velero-minio' of https://github.com/suxess-it…
jkleinlercher Feb 21, 2025
9e9685c
needs to run later, because of https://github.com/suxess-it/kubriX/is…
jkleinlercher Feb 21, 2025
fde9da5
forgot to fix the role names also in the values file
jkleinlercher Feb 21, 2025
ffb3b9c
update to the same version as the chart provides. don't know if that …
jkleinlercher Feb 21, 2025
c5bd951
add keycloak because vault needs keycloak
jkleinlercher Feb 22, 2025
2d61c8c
try with newest vault provider
jkleinlercher Feb 23, 2025
a129573
add debug deploymentruntimeconfig for vault for better troubleshooting
jkleinlercher Feb 24, 2025
9935fcd
better issue reference
jkleinlercher Feb 24, 2025
a3ae2cb
sync deploymentruntimeconfig with provider, otherwise provider fails …
jkleinlercher Feb 24, 2025
0963b2a
downgrade vault provider to v1.0.0
jkleinlercher Feb 24, 2025
b8a3e5b
reduce poll-interval from 10m to 1m
jkleinlercher Feb 24, 2025
b83b757
seems to be poll instead of poll-interval, see https://github.com/upb…
jkleinlercher Feb 24, 2025
49de33b
also restart sync when operation-phase is 'error'
jkleinlercher Feb 24, 2025
46b1ed3
trigger a sync explicitly in case the bootstrap-app already failed to…
jkleinlercher Feb 24, 2025
9384864
decrease cpu requests so observability stack can get tested on github
jkleinlercher Feb 24, 2025
6b8049c
reduce cpu requests for observability stack tests in GitHub actions
jkleinlercher Feb 24, 2025
ff5aa09
reduce cpu requests for observability tests in GitHub actions
jkleinlercher Feb 24, 2025
34ff158
fix permission denied error
jkleinlercher Feb 24, 2025
5f14d57
trigger sync for sx-bootstrap-app, because sync to unknown app brings…
jkleinlercher Feb 25, 2025
37bdc80
Test vault provider v2.1.1 again
jkleinlercher Feb 26, 2025
40045ec
again back to v1 because v2 failed again with known error
jkleinlercher Feb 26, 2025
a390931
Merge branch 'main' into feat/test-velero-minio
jkleinlercher Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions install-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ wait_until_apps_synced_healthy() {
fi
# terminate sync if sync is running and takes longer than 300 seconds (workaround when sync gets stuck)
operation_phase=$(kubectl get application -n argocd ${app} -o jsonpath='{.status.operationState.phase}')
if [ "${operation_phase}" = "Running" ] && [ ${sync_duration} -gt 300 ] || [ "${operation_phase}" = "Failed" ] ; then
if [ "${operation_phase}" = "Running" ] && [ ${sync_duration} -gt 300 ] || [ "${operation_phase}" = "Failed" ] || [ "${operation_phase}" = "Error" ] ; then
# Terminate the operation for the application
echo "sync of app ${app} gets terminated because it took longer than 300 seconds"
echo "sync of app ${app} gets terminated because it took longer than 300 seconds or failed"
kubectl exec sx-argocd-application-controller-0 -n argocd -- argocd app terminate-op "$app" --core
echo "wait for 10 seconds"
sleep 10
Expand Down Expand Up @@ -328,19 +328,25 @@ fi
if [[ $( echo $argocd_apps | grep sx-kargo ) ]] ; then
kubectl delete ExternalSecret github-creds -n kargo
# check if kargo is synced and healthy for 5 minutes
# we trigger a new sync in case the bootstrap-app already failed 5 times
kubectl exec sx-argocd-application-controller-0 -n argocd -- argocd app sync "sx-kargo" --async --core
wait_until_apps_synced_healthy "sx-kargo" "Synced" "Healthy" 300
fi

if [[ $( echo $argocd_apps | grep sx-team-onboarding ) ]] ; then
kubectl delete ExternalSecret github-creds -n kargo
# check if kargo is synced and healthy for 5 minutes
# we trigger a new sync in case the bootstrap-app already failed 5 times
kubectl exec sx-argocd-application-controller-0 -n argocd -- argocd app sync "sx-team-onboarding" --async --core
wait_until_apps_synced_healthy "sx-team-onboarding" "Synced" "Healthy" 300
fi

# if backstage is part of this stack, create the manual secret for backstage
if [[ $( echo $argocd_apps | grep sx-backstage ) ]] ; then

# check if backstage is already synced (it will still be degraded because of the missing secret we create in the next step)
# we trigger a new sync in case the bootstrap-app already failed 5 times
kubectl exec sx-argocd-application-controller-0 -n argocd -- argocd app sync "sx-bootstrap-app" --async --core
wait_until_apps_synced_healthy "sx-backstage" "Synced" "*" 900

echo "adding special configuration for sx-backstage"
Expand Down Expand Up @@ -424,6 +430,8 @@ if [[ $( echo $argocd_apps | grep sx-backstage ) ]] ; then
fi

# finally wait for all apps including backstage to be synced and health
# we trigger a new sync in case the bootstrap-app already failed 5 times
kubectl exec sx-argocd-application-controller-0 -n argocd -- argocd app sync "sx-bootstrap-app" --async --core
wait_until_apps_synced_healthy "${argocd_apps}" "Synced" "Healthy" 300

fi
133 changes: 133 additions & 0 deletions platform-apps/charts/argocd/values-k3d.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,139 @@ argo-cd:
end
return hs

"*.upbound.io/*":
health.lua: |
health_status = {
status = "Progressing",
message = "Provisioning ..."
}

local function contains (table, val)
for i, v in ipairs(table) do
if v == val then
return true
end
end
return false
end

local has_no_status = {
"ProviderConfig",
"ProviderConfigUsage"
}

if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then
health_status.status = "Healthy"
health_status.message = "Resource is up-to-date."
return health_status
end

if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then
health_status.status = "Healthy"
health_status.message = "Resource is in use."
return health_status
end
return health_status
end

for i, condition in ipairs(obj.status.conditions) do
if condition.type == "LastAsyncOperation" then
if condition.status == "False" then
health_status.status = "Degraded"
health_status.message = condition.message
return health_status
end
end

if condition.type == "Synced" then
if condition.status == "False" then
health_status.status = "Degraded"
health_status.message = condition.message
return health_status
end
end

if condition.type == "Ready" then
if condition.status == "True" then
health_status.status = "Healthy"
health_status.message = "Resource is up-to-date."
return health_status
end
end
end

return health_status

"*.crossplane.io/*":
health.lua: |
health_status = {
status = "Progressing",
message = "Provisioning ..."
}

local function contains (table, val)
for i, v in ipairs(table) do
if v == val then
return true
end
end
return false
end

local has_no_status = {
"Composition",
"CompositionRevision",
"DeploymentRuntimeConfig",
"ControllerConfig",
"ProviderConfig",
"ProviderConfigUsage"
}
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then
health_status.status = "Healthy"
health_status.message = "Resource is up-to-date."
return health_status
end

if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then
health_status.status = "Healthy"
health_status.message = "Resource is in use."
return health_status
end
return health_status
end

for i, condition in ipairs(obj.status.conditions) do
if condition.type == "LastAsyncOperation" then
if condition.status == "False" then
health_status.status = "Degraded"
health_status.message = condition.message
return health_status
end
end

if condition.type == "Synced" then
if condition.status == "False" then
health_status.status = "Degraded"
health_status.message = condition.message
return health_status
end
end

if contains({"Ready", "Healthy", "Offered", "Established"}, condition.type) then
if condition.status == "True" then
health_status.status = "Healthy"
health_status.message = "Resource is up-to-date."
return health_status
end
end
end

return health_status



rbac:
policy.csv: |
p, backstage, applications, get, */*, allow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
namespace: crossplane
labels:
type: provider-credentials
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-1"
type: Opaque
stringData:
credentials: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
labels:
platform-engineer.cloud/role: viewer
platform-engineer.cloud/role: grafana-viewer
name: client-default-role-grafana-viewer
spec:
forProvider:
Expand All @@ -25,7 +25,7 @@ metadata:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
labels:
platform-engineer.cloud/role: editor
platform-engineer.cloud/role: grafana-editor
name: client-default-role-grafana-editor
spec:
forProvider:
Expand All @@ -45,7 +45,7 @@ metadata:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
labels:
platform-engineer.cloud/role: admin
platform-engineer.cloud/role: grafana-admin
name: client-default-role-grafana-admin
spec:
forProvider:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,79 +1,10 @@
apiVersion: group.keycloak.crossplane.io/v1alpha1
kind: Roles
metadata:
name: {{ .Values.deployments.keycloak.grafanaclient.config.clientID }}-grafana-group-roles
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
spec:
deletionPolicy: Delete
forProvider:
exhaustive: false
groupIdRef:
name: admins
realmIdRef:
name: {{ .Values.deployments.keycloak.realm.realmid }}
roleIdsSelector:
matchLabels:
platform-engineer.cloud/role: admin
initProvider: {}
managementPolicies:
- '*'
providerConfigRef:
name: sx-keycloak-config
---
apiVersion: group.keycloak.crossplane.io/v1alpha1
kind: Roles
metadata:
name: {{ .Values.deployments.keycloak.grafanaclient.config.clientID }}-grafana-group-roles-viewer
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
spec:
deletionPolicy: Delete
forProvider:
exhaustive: false
groupIdRef:
name: users
realmIdRef:
name: {{ .Values.deployments.keycloak.realm.realmid }}
roleIdsSelector:
matchLabels:
platform-engineer.cloud/role: editor
initProvider: {}
managementPolicies:
- '*'
providerConfigRef:
name: sx-keycloak-config
---
apiVersion: group.keycloak.crossplane.io/v1alpha1
kind: Roles
metadata:
name: {{ .Values.deployments.keycloak.grafanaclient.config.clientID }}-grafana-group-roles-viewer-team1
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
spec:
deletionPolicy: Delete
forProvider:
exhaustive: false
groupIdRef:
name: team1
realmIdRef:
name: {{ .Values.deployments.keycloak.realm.realmid }}
roleIdsSelector:
matchLabels:
platform-engineer.cloud/role: viewer
initProvider: {}
managementPolicies:
- '*'
providerConfigRef:
name: sx-keycloak-config
{{- range $group := .Values.deployments.keycloak.realm.groups }}
{{- range $role := $group.roles }}
---
apiVersion: group.keycloak.crossplane.io/v1alpha1
kind: Roles
metadata:
name: {{ .Values.deployments.keycloak.grafanaclient.config.clientID }}-grafana-group-roles-viewer-team-a
name: {{ $.Values.deployments.keycloak.grafanaclient.config.clientID }}-group-roles-{{ $group.name }}-{{ $role }}
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
Expand All @@ -82,15 +13,16 @@ spec:
forProvider:
exhaustive: false
groupIdRef:
name: team-a
name: {{ $group.name }}
realmIdRef:
name: {{ .Values.deployments.keycloak.realm.realmid }}
name: {{ $.Values.deployments.keycloak.realm.realmid }}
roleIdsSelector:
matchLabels:
platform-engineer.cloud/role: viewer
platform-engineer.cloud/role: {{ $role }}
initProvider: {}
managementPolicies:
- '*'
providerConfigRef:
name: sx-keycloak-config
---
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ metadata:
annotations:
link.argocd.argoproj.io/external-link: https://{{ .Values.deployments.ingress.host }}/admin/master/console/#/{{ .Values.deployments.keycloak.realm.realmid }}
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "1"
spec:
forProvider:
realm: {{ .Values.deployments.keycloak.realm.realmid }}
Expand Down
1 change: 0 additions & 1 deletion platform-apps/charts/keycloak/templates/xr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ metadata:
name: keycloak-builtin-objects-{{ .Values.deployments.keycloak.realm.realmid }}
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-1"
spec:
providerConfigName: sx-keycloak-config
providerSecretName: keycloak-credentials-cp
Expand Down
10 changes: 9 additions & 1 deletion platform-apps/charts/keycloak/values-demo-metalstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,27 @@ deployments:
password: "test"
groups:
- name: admins
mfa: false # valid if .keycloak.mfa.enabled is true, disable for admin
roles:
- grafana-admin
mfa: false # valid if .keycloak.mfa.enabled is true, disable for admin
members:
- backstageadmin
- demoadmin
- name: team1
roles:
- grafana-viewer
mfa: true # valid if .keycloak.mfa.enabled is true
members:
- team1user
- name: team-a
roles:
- grafana-viewer
mfa: false # valid if .keycloak.mfa.enabled is true
members:
- team-auser
- name: users
roles:
- grafana-editor
mfa: false # valid if .keycloak.mfa.enabled is true
members:
- phac
Expand Down
6 changes: 6 additions & 0 deletions platform-apps/charts/keycloak/values-k3d.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,19 @@ deployments:
password: "test"
groups:
- name: admins
roles:
- grafana-admin
members:
- backstageadmin
- demoadmin
- name: team1
roles:
- grafana-viewer
members:
- team1user
- name: users
roles:
- grafana-editor
members:
- phac
- jokl
Expand Down
Loading