Skip to content

Commit 0010f0e

Browse files
authored
Merge pull request #504 from cloudogu/develop
Prepare Release 0.18
2 parents e59ba46 + f57c0db commit 0010f0e

191 files changed

Lines changed: 10621 additions & 9534 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Dockerfile‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ RUN mv $(ls -S target/*.jar | head -n 1) /app/gitops-playground.jar
4545
# STAGE 3: Downloader
4646
# ============================================================================
4747
# Purpose: Download and prepare all external dependencies and tools
48-
# - Kubectl CLI
4948
# - Helm CLI
5049
# - Git repositories
5150
# - Jenkins plugins
@@ -58,16 +57,9 @@ RUN apk add curl grep
5857
# -----------------------------------------------------------------------------
5958
# 3.1: Version Configuration
6059
# -----------------------------------------------------------------------------
61-
# When updating kubectl:
62-
# * Update checksum from https://dl.k8s.io/release/v${K8S_VERSION}/bin/linux/amd64/kubectl.sha256
63-
# * Update in init-cluster.sh, vars.tf, Config.groovy and apply.sh
64-
# When upgrading to 1.26+ we can verify kubectl signature with cosign!
65-
# https://kubernetes.io/blog/2022/12/12/kubernetes-release-artifact-signing/
66-
ARG K8S_VERSION=1.35.4
67-
ARG KUBECTL_CHECKSUM=b529430df69a688fd61b64ad2299edb5fd71cb58be2a4779dba624c7d3510efd
6860

6961
# When updating Helm, also upgrade helm image in Config.groovy
70-
ARG HELM_VERSION=4.1.4
62+
ARG HELM_VERSION=4.2.1
7163

7264
# Install additional tools required for downloads
7365
# bash curl unzip required for Jenkins downloader
@@ -114,20 +106,7 @@ RUN gpgv --keyring /tmp/keyring.gpg helm.tar.gz.asc helm.tar.gz
114106
RUN mv linux-amd64/helm /dist/usr/local/bin
115107
ENV PATH=$PATH:/dist/usr/local/bin
116108

117-
# -----------------------------------------------------------------------------
118-
# 3.4: Download and Install Kubectl
119-
# -----------------------------------------------------------------------------
120-
# Download kubectl binary
121-
RUN curl --location --fail --retry 20 --retry-connrefused --retry-all-errors \
122-
--output kubectl \
123-
https://dl.k8s.io/release/v${K8S_VERSION}/bin/linux/amd64/kubectl
124-
125-
# Verify kubectl checksum (note: two spaces required!)
126-
RUN echo "${KUBECTL_CHECKSUM} kubectl" | sha256sum -c
127109

128-
# Install kubectl
129-
RUN chmod +x /tmp/kubectl
130-
RUN mv /tmp/kubectl /dist/usr/local/bin/kubectl
131110

132111
# -----------------------------------------------------------------------------
133112
# 3.5: Clone External Git Repositories
@@ -155,8 +134,9 @@ RUN /jenkins/download-plugins.sh /dist/gitops/jenkins-plugins
155134
# 3.7: Download Helm Charts
156135
# -----------------------------------------------------------------------------
157136
COPY src/main/groovy/com/cloudogu/gitops/config/Config.groovy /tmp/
137+
COPY src/main/groovy/com/cloudogu/gitops/config/scm/ScmTenantSchema.groovy /tmp/
158138
COPY scripts/downloadHelmCharts.sh /tmp/
159-
RUN cd /dist/gitops && /tmp/downloadHelmCharts.sh /tmp/Config.groovy
139+
RUN cd /dist/gitops && /tmp/downloadHelmCharts.sh /tmp/Config.groovy /tmp/ScmTenantSchema.groovy
160140

161141
# -----------------------------------------------------------------------------
162142
# 3.8: Prepare Application Files
@@ -230,7 +210,7 @@ RUN apk update --no-cache && apk upgrade --no-cache && \
230210
# 4.3: Copy Distribution Files
231211
# -----------------------------------------------------------------------------
232212
# Copy all prepared files from downloader stage:
233-
# - Binaries (kubectl, helm)
213+
# - Binaries (helm)
234214
# - Git repositories
235215
# - Helm charts
236216
# - Jenkins plugins

‎Jenkinsfile‎

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pipeline {
88
}
99

1010
options {
11-
buildDiscarder(logRotator(numToKeepStr: '5'))
11+
buildDiscarder(logRotator(numToKeepStr: '20'))
1212
timestamps()
1313
timeout(time: 120, unit: 'MINUTES')
1414
}
@@ -51,8 +51,12 @@ pipeline {
5151
}}
5252
steps {
5353
sh 'mvn -B clean test'
54-
junit testResults: '**/target/surefire-reports/TEST-*.xml'
55-
archiveArtifacts artifacts: "**/target/site/jacoco/**"
54+
}
55+
post {
56+
always {
57+
junit testResults: '**/target/surefire-reports/TEST-*.xml'
58+
archiveArtifacts artifacts: "**/target/site/jacoco/**"
59+
}
5660
}
5761
}
5862

@@ -106,16 +110,56 @@ pipeline {
106110
profiles = [params.chooseProfile]
107111
}
108112

109-
def withK3dCluster = { body ->
113+
def dumpKubernetesDebugInfo = { profile ->
114+
def dumpDir = "target/k8s-debug/${profile}"
115+
116+
docker.image("${env.GOLANG_IMAGE}").inside(env.INTEGRATION_TEST_DOCKER_ARGS) {
117+
sh(script: """
118+
set +e
119+
apk add --no-cache kubectl
120+
mkdir -p '${dumpDir}'
121+
export KUBECONFIG='${env.WORKSPACE}/.kubeconfig.yaml'
122+
123+
kubectl cluster-info > '${dumpDir}/cluster-info.txt' 2>&1
124+
kubectl get nodes -o wide > '${dumpDir}/nodes.txt' 2>&1
125+
kubectl get namespaces -o wide > '${dumpDir}/namespaces.txt' 2>&1
126+
kubectl get pods -A -o wide > '${dumpDir}/pods.txt' 2>&1
127+
kubectl get events -A --sort-by=.lastTimestamp > '${dumpDir}/events.txt' 2>&1
128+
kubectl get pvc,pv -A -o wide > '${dumpDir}/volumes.txt' 2>&1
129+
kubectl get ingress -A -o wide > '${dumpDir}/ingress.txt' 2>&1
130+
kubectl describe all -A > '${dumpDir}/describe-all.txt' 2>&1
131+
132+
: > '${dumpDir}/container-logs.txt'
133+
kubectl get pods -A --no-headers \\
134+
-o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name |
135+
while read -r namespace pod; do
136+
echo "===== \${namespace}/\${pod} current =====" >> '${dumpDir}/container-logs.txt'
137+
kubectl logs -n "\${namespace}" "\${pod}" --all-containers=true --tail=200 --prefix=true >> '${dumpDir}/container-logs.txt' 2>&1
138+
139+
echo >> '${dumpDir}/container-logs.txt'
140+
echo "===== \${namespace}/\${pod} previous =====" >> '${dumpDir}/container-logs.txt'
141+
kubectl logs -n "\${namespace}" "\${pod}" --all-containers=true --previous --tail=200 --prefix=true >> '${dumpDir}/container-logs.txt' 2>&1
142+
echo >> '${dumpDir}/container-logs.txt'
143+
done
144+
""", returnStatus: true)
145+
}
146+
147+
archiveArtifacts artifacts: "${dumpDir}/**", allowEmptyArchive: true
148+
}
149+
150+
def withK3dCluster = { profile, body ->
110151
try {
111152
sh "yes | KUBECONFIG=${env.WORKSPACE}/.kubeconfig.yaml ./scripts/init-cluster.sh --cluster-name=${env.K3D_CLUSTER_NAME}"
112153
body()
154+
} catch(Throwable t) {
155+
dumpKubernetesDebugInfo(profile)
156+
throw t
113157
} finally {
114158
sh "KUBECONFIG=${env.WORKSPACE}/.kubeconfig.yaml $HOME/.local/bin/k3d cluster delete ${env.K3D_CLUSTER_NAME}"
115159
}}
116160

117161
profiles.each { profile ->
118-
withK3dCluster {
162+
withK3dCluster(profile) {
119163

120164
if (profile.startsWith('operator')) {
121165
docker.image("${env.GOLANG_IMAGE}").inside(env.INTEGRATION_TEST_DOCKER_ARGS) {
@@ -130,11 +174,16 @@ pipeline {
130174
sh "mvn -B failsafe:integration-test failsafe:verify -Dmicronaut.environments=${profile} -Dsurefire.reportNameSuffix=${profile} && chown $BUILD_USER:$BUILD_GROUP ./* -R"
131175
}
132176
}
133-
junit testResults: "**/target/failsafe-reports/TEST-*${profile}.xml",
134-
allowEmptyResults: true
177+
135178
}
136179
}
137180
}
181+
post {
182+
always {
183+
junit testResults: "**/target/failsafe-reports/TEST-*.xml",
184+
allowEmptyResults: true
185+
}
186+
}
138187
}
139188
}
140189
}
@@ -160,7 +209,6 @@ pipeline {
160209
currentBuild.description = "Image: ${env.FULL_IMAGE_TAG}"
161210
image.push()
162211

163-
if (params.forcePushImage || env.BRANCH_NAME == 'develop') { image.push(env.BRANCH_NAME) }
164212
if (env.TAG_NAME) {
165213
image.push('latest')
166214
image.push(env.TAG_NAME)
@@ -187,4 +235,4 @@ pipeline {
187235
)
188236
}
189237
}
190-
}
238+
}

‎Makefile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,15 @@ cluster: ## creates a k3d cluster suitable for GOP
2020
prepare-two-registries: ## for testing with multiple registries
2121
./scripts/dev/prepare_two_registries.sh
2222

23+
.PHONY: install-operator
24+
install-operator: ## installs argocd operator via kubectl and kustomize
25+
kubectl apply -k github.com/argoproj-labs/argocd-operator/config/default?ref=release-0.17 --server-side --force-conflicts
26+
kubectl apply -k github.com/argoproj-labs/argocd-operator/config/crd?ref=release-0.17 --server-side --force-conflicts
27+
28+
.PHONY: image
29+
image: ## builds the docker image for local testing
30+
docker buildx prune -f && docker build . -t local/gop
31+
echo "created docker image local/gop"
32+
2333
%:
2434
@:

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Current existing profiles for argocd in non-operator mode:
8181
| full | all available features | showcase a full-fledged IDP |
8282

8383

84-
Follow profils for ArgoCD in Operator mode which has to be installed first:
84+
The following profiles require the ArgoCD operator to be installed in your cluster first:
8585
| Profile | Features | Use-Case |
8686
|---------------------------|------------------------------------------|----------------------------------------------------------------------|
8787
| operator-minimal | Argo-cd, SCM-Manager | minimal example for an operator based gitops-stack |

‎argocd/cluster-resources/apps/argocd/applications/argocd.ftl.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: argoproj.io/v1alpha1
22
kind: Application
33
metadata:
44
name: argocd
5-
namespace: ${config.application.namePrefix}argocd
5+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
66
annotations:
77
# Only app with the sync-status-unknown alert, so that we only get one alert when SCM is not reachable.
88
# Otherwise, there would be a spam wave by every application everytime the SCM is not reachable.
@@ -15,7 +15,7 @@ metadata:
1515
spec:
1616
destination:
1717
server: https://kubernetes.default.svc
18-
namespace: ${config.application.namePrefix}argocd
18+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
1919
project: argocd
2020
source:
2121
path: apps/argocd/${config.features.argocd.operator?string("operator/", "argocd/")}

‎argocd/cluster-resources/apps/argocd/applications/bootstrap.ftl.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ apiVersion: argoproj.io/v1alpha1
33
kind: Application
44
metadata:
55
name: bootstrap
6-
namespace: ${config.application.namePrefix}argocd
6+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
77
# finalizer disabled, because otherwise everything under this Application would be deleted as well, if this Application is deleted by accident
88
# finalizers:
99
# - resources-finalizer.argocd.argoproj.io
1010
spec:
1111
destination:
1212
server: https://kubernetes.default.svc
13-
namespace: ${config.application.namePrefix}argocd
13+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
1414
project: argocd
1515
source:
1616
path: apps/argocd/applications/

‎argocd/cluster-resources/apps/argocd/applications/projects.ftl.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ apiVersion: argoproj.io/v1alpha1
22
kind: Application
33
metadata:
44
name: projects
5-
namespace: ${config.application.namePrefix}argocd
5+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
66
# finalizer disabled, because otherwise everything under this Application would be deleted as well, if this Application is deleted by accident
77
# finalizers:
88
# - resources-finalizer.argocd.argoproj.io
99
spec:
1010
destination:
1111
server: https://kubernetes.default.svc
12-
namespace: ${config.application.namePrefix}argocd
12+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
1313
project: argocd
1414
source:
1515
path: apps/argocd/projects/

‎argocd/cluster-resources/apps/argocd/argocd/templates/allow-namespaces.ftl.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: networking.k8s.io/v1
33
kind: NetworkPolicy
44
metadata:
55
name: allow-argocd-access-scmm
6-
namespace: ${config.application.namePrefix}scm-manager
6+
namespace: ${config.application.namePrefix}${config.scm.scmManager.namespace}
77
spec:
88
podSelector:
99
matchLabels:
@@ -14,7 +14,7 @@ spec:
1414
- from:
1515
- namespaceSelector:
1616
matchLabels:
17-
kubernetes.io/metadata.name: ${config.application.namePrefix}argocd
17+
kubernetes.io/metadata.name: ${config.application.namePrefix}${config.features.argocd.namespace}
1818
- podSelector:
1919
matchLabels:
2020
app.kubernetes.io/name: argocd-repo-server

‎argocd/cluster-resources/apps/argocd/argocd/values.ftl.yaml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ argo-cd:
2828
<#if config.features.monitoring.active == true>
2929
serviceMonitor:
3030
enabled: true
31-
namespace: ${config.application.namePrefix}monitoring
31+
namespace: ${config.application.namePrefix}${config.features.monitoring.namespace}
3232
selector:
3333
release: kube-prometheus-stack
3434
</#if>
@@ -38,7 +38,7 @@ argo-cd:
3838
<#if config.features.monitoring.active == true>
3939
serviceMonitor:
4040
enabled: true
41-
namespace: ${config.application.namePrefix}monitoring
41+
namespace: ${config.application.namePrefix}${config.features.monitoring.namespace}
4242
selector:
4343
release: kube-prometheus-stack
4444
</#if>
@@ -48,7 +48,7 @@ argo-cd:
4848
<#if config.features.monitoring.active == true>
4949
serviceMonitor:
5050
enabled: true
51-
namespace: ${config.application.namePrefix}monitoring
51+
namespace: ${config.application.namePrefix}${config.features.monitoring.namespace}
5252
selector:
5353
release: kube-prometheus-stack
5454
</#if>
@@ -58,7 +58,7 @@ argo-cd:
5858
# Unfortunately, as of argocd 2.6 this leads to failing notifications
5959
# https://github.com/argoproj/argo-cd/issues/11252
6060
params:
61-
application.namespaces: "${config.application.namePrefix}argocd"
61+
application.namespaces: "${config.application.namePrefix}${config.features.argocd.namespace}"
6262
server.insecure: true # tls terminated in ingress
6363

6464
# Repo credential templates are created dynamically in groovy, so they are not stored in git
@@ -89,7 +89,7 @@ argo-cd:
8989
<#if config.features.mail.smtpUser?has_content>username: $email-username</#if>
9090
<#if config.features.mail.smtpPassword?has_content>password: $email-password</#if>
9191
<#else>
92-
host: mail.${config.application.namePrefix}monitoring.svc.cluster.local
92+
host: mail.${config.application.namePrefix}${config.features.monitoring.namespace}.svc.cluster.local
9393
port: 1025
9494
</#if>
9595
from: ${config.features.argocd.emailFrom}

‎argocd/cluster-resources/apps/argocd/multiTenant/central/applications/argocd.ftl.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: argoproj.io/v1alpha1
22
kind: Application
33
metadata:
4-
name: ${config.application.namePrefix}argocd
4+
name: ${config.application.namePrefix}${config.features.argocd.namespace}
55
namespace: ${config.multiTenant.centralArgocdNamespace}
66
annotations:
77
# Only app with the sync-status-unknown alert, so that we only get one alert when SCM is not reachable.
@@ -15,7 +15,7 @@ metadata:
1515
spec:
1616
destination:
1717
server: https://kubernetes.default.svc
18-
namespace: ${config.application.namePrefix}argocd
18+
namespace: ${config.application.namePrefix}${config.features.argocd.namespace}
1919
project: ${tenantName}
2020
source:
2121
path: apps/argocd/${config.features.argocd.operator?string("operator/", "argocd/")}

0 commit comments

Comments
 (0)