diff --git a/charts/devtron/Chart.yaml b/charts/devtron/Chart.yaml index adc92a13d4..930d8e4251 100644 --- a/charts/devtron/Chart.yaml +++ b/charts/devtron/Chart.yaml @@ -16,7 +16,7 @@ sources: - https://github.com/devtron-labs/charts dependencies: - name: argo-cd - version: "5.9.1" + version: "7.7.15" repository: https://argoproj.github.io/argo-helm condition: argo-cd.enabled - name: security diff --git a/charts/devtron/templates/argocd-secret.yaml b/charts/devtron/templates/argocd-secret.yaml index 1d55e545bc..ee12df5593 100644 --- a/charts/devtron/templates/argocd-secret.yaml +++ b/charts/devtron/templates/argocd-secret.yaml @@ -64,173 +64,205 @@ data: health.lua: | hs = {} if obj.status ~= nil then - if obj.status.status ~= nil then - hs.status = "Degraded" - hs.message = obj.status.status - else + if obj.status.status ~= nil then + hs.status = "Degraded" + hs.message = obj.status.status + else hs.status = "Healthy" - end + end else - hs.status = "Healthy" + hs.status = "Healthy" end return hs argoproj.io/Rollout: health.lua: | + function getNumberValueOrDefault(field) + if field ~= nil then + return field + end + return 0 + end + function checkPaused(obj) + hs = {} + local paused = false + if obj.status.verifyingPreview ~= nil then + paused = obj.status.verifyingPreview + elseif obj.spec.paused ~= nil then + paused = obj.spec.paused + end + + if paused then + hs.status = "Suspended" + hs.message = "Rollout is paused" + return hs + end + return nil + end function checkReplicasStatus(obj) - hs = {} - replicasCount = getNumberValueOrDefault(obj.spec.replicas) - replicasStatus = getNumberValueOrDefault(obj.status.replicas) - updatedReplicas = getNumberValueOrDefault(obj.status.updatedReplicas) - availableReplicas = getNumberValueOrDefault(obj.status.availableReplicas) + hs = {} + replicasCount = getNumberValueOrDefault(obj.spec.replicas) + replicasStatus = getNumberValueOrDefault(obj.status.replicas) + updatedReplicas = getNumberValueOrDefault(obj.status.updatedReplicas) + availableReplicas = getNumberValueOrDefault(obj.status.availableReplicas) - if updatedReplicas < replicasCount then + if updatedReplicas < replicasCount then hs.status = "Progressing" hs.message = "Waiting for roll out to finish: More replicas need to be updated" return hs - end - -- Since the scale down delay can be very high, BlueGreen does not wait for all the old replicas to scale - -- down before marking itself healthy. As a result, only evaluate this condition if the strategy is canary. - if obj.spec.strategy.canary ~= nil and replicasStatus > updatedReplicas then + end + -- Since the scale down delay can be very high, BlueGreen does not wait for all the old replicas to scale + -- down before marking itself healthy. As a result, only evaluate this condition if the strategy is canary. + if obj.spec.strategy.canary ~= nil and replicasStatus > updatedReplicas then hs.status = "Progressing" hs.message = "Waiting for roll out to finish: old replicas are pending termination" return hs - end - if availableReplicas < updatedReplicas then + end + if availableReplicas < updatedReplicas then hs.status = "Progressing" hs.message = "Waiting for roll out to finish: updated replicas are still becoming available" return hs - end - return nil - end - - function getNumberValueOrDefault(field) - if field ~= nil then - return field - end - return 0 - end - - function checkPaused(obj) - hs = {} - local paused = false - if obj.status.verifyingPreview ~= nil then - paused = obj.status.verifyingPreview - elseif obj.spec.paused ~= nil then - paused = obj.spec.paused - end - - if paused then - hs.status = "Suspended" - hs.message = "Rollout is paused" - return hs - end - return nil - end + end + return nil + end - hs = {} - if obj.status ~= nil then - if obj.status.conditions ~= nil then + function statusfromcondition(obj) + local hs={} for _, condition in ipairs(obj.status.conditions) do - if condition.type == "InvalidSpec" then - hs.status = "Degraded" - hs.message = condition.message + if condition.type == "InvalidSpec" then + hs.status = "Degraded" + hs.message = condition.message return hs - end - if condition.type == "Progressing" and condition.reason == "RolloutAborted" then - hs.status = "Degraded" - hs.message = condition.message + end + if condition.type == "Progressing" and condition.reason == "RolloutAborted" then + hs.status = "Degraded" + hs.message = condition.message return hs - end - if condition.type == "Progressing" and condition.reason == "ProgressDeadlineExceeded" then - hs.status = "Degraded" - hs.message = condition.message + end + if condition.type == "Progressing" and condition.reason == "ProgressDeadlineExceeded" then + hs.status = "Degraded" + hs.message = condition.message return hs - end + end end - end - if obj.status.currentPodHash ~= nil then + return nil + end + + function statusfrompodhash(obj) + local hs={} if obj.spec.strategy.blueGreen ~= nil then - isPaused = checkPaused(obj) - if isPaused ~= nil then - return isPaused - end - replicasHS = checkReplicasStatus(obj) - if replicasHS ~= nil then - return replicasHS - end - if obj.status.blueGreen ~= nil and obj.status.blueGreen.activeSelector ~= nil and obj.status.blueGreen.activeSelector == obj.status.currentPodHash then - hs.status = "Healthy" - hs.message = "The active Service is serving traffic to the current pod spec" + isPaused = checkPaused(obj) + if isPaused ~= nil then + return isPaused + end + replicasHS = checkReplicasStatus(obj) + if replicasHS ~= nil then + return replicasHS + end + if obj.status.blueGreen ~= nil and obj.status.blueGreen.activeSelector ~= nil and obj.status.blueGreen.activeSelector == obj.status.currentPodHash then + hs.status = "Healthy" + hs.message = "The active Service is serving traffic to the current pod spec" + return hs + end + hs.status = "Progressing" + hs.message = "The current pod spec is not receiving traffic from the active service" return hs - end - hs.status = "Progressing" - hs.message = "The current pod spec is not receiving traffic from the active service" - return hs end if obj.spec.strategy.recreate ~= nil then - isPaused = checkPaused(obj) - if isPaused ~= nil then - return isPaused - end - replicasHS = checkReplicasStatus(obj) - if replicasHS ~= nil then - return replicasHS - end - if obj.status.recreate ~= nil and obj.status.recreate.currentRS ~= nil and obj.status.recreate.currentRS == obj.status.currentPodHash then - hs.status = "Healthy" - hs.message = "Rollout is successful" + isPaused = checkPaused(obj) + if isPaused ~= nil then + return isPaused + end + replicasHS = checkReplicasStatus(obj) + if replicasHS ~= nil then + return replicasHS + end + if obj.status.recreate ~= nil and obj.status.recreate.currentRS ~= nil and obj.status.recreate.currentRS == obj.status.currentPodHash then + hs.status = "Healthy" + hs.message = "Rollout is successful" + return hs + end + hs.status = "Progressing" + hs.message = "Rollout is in progress" return hs - end - hs.status = "Progressing" - hs.message = "Rollout is in progress" - return hs end if obj.spec.strategy.canary ~= nil then - currentRSIsStable = obj.status.canary.stableRS == obj.status.currentPodHash - if obj.spec.strategy.canary.steps ~= nil and table.getn(obj.spec.strategy.canary.steps) > 0 then + if obj.status.stableRS ~= nil then + currentRSIsStable = obj.status.stableRS == obj.status.currentPodHash + end + if obj.status.canary.stableRS ~= nil then + currentRSIsStable = obj.status.canary.stableRS == obj.status.currentPodHash + end + if obj.spec.strategy.canary.steps ~= nil and table.getn(obj.spec.strategy.canary.steps) > 0 then stepCount = table.getn(obj.spec.strategy.canary.steps) if obj.status.currentStepIndex ~= nil then - currentStepIndex = obj.status.currentStepIndex - isPaused = checkPaused(obj) - if isPaused ~= nil then + currentStepIndex = obj.status.currentStepIndex + isPaused = checkPaused(obj) + if isPaused ~= nil then return isPaused - end - - if paused then + end + + if paused then hs.status = "Suspended" hs.message = "Rollout is paused" return hs - end - if currentRSIsStable and stepCount == currentStepIndex then + end + if currentRSIsStable and stepCount == currentStepIndex then replicasHS = checkReplicasStatus(obj) if replicasHS ~= nil then - return replicasHS + return replicasHS end hs.status = "Healthy" hs.message = "The rollout has completed all steps" return hs - end + end end hs.status = "Progressing" hs.message = "Waiting for rollout to finish steps" return hs - end + end - -- The detecting the health of the Canary deployment when there are no steps - replicasHS = checkReplicasStatus(obj) - if replicasHS ~= nil then + -- The detecting the health of the Canary deployment when there are no steps + replicasHS = checkReplicasStatus(obj) + if replicasHS ~= nil then return replicasHS - end - if currentRSIsStable then + end + if currentRSIsStable then hs.status = "Healthy" hs.message = "The rollout has completed canary deployment" return hs - end - hs.status = "Progressing" - hs.message = "Waiting for rollout to finish canary deployment" + end + hs.status = "Progressing" + hs.message = "Waiting for rollout to finish canary deployment" end - end - end - hs.status = "Progressing" - hs.message = "Waiting for rollout to finish: status has not been reconciled." + + + return hs + end + + -- Main Code + hs = {} + if obj.status.phase ~= nil then + if obj.status.phase == "Paused" then + hs.status = "Progressing" + hs.message = "Rollout is paused" + elseif obj.status.phase == "Progressing" then + hs=statusfromcondition(obj) or hs + hs=statusfrompodhash(obj) or hs + elseif obj.status.phase == "Healthy" then + hs=statusfromcondition(obj) or hs + hs=statusfrompodhash(obj) or hs + else + hs.status = obj.status.phase + hs.message = obj.status.message + end + else + if obj.status ~= nil then + if obj.status.conditions ~= nil then + hs=statusfromcondition(obj) + end + if obj.status.currentPodHash ~= nil then + hs=statusfrompodhash(obj) + end + end + end return hs \ No newline at end of file diff --git a/charts/devtron/values.yaml b/charts/devtron/values.yaml index 4a0055aa41..88f1b8b7aa 100644 --- a/charts/devtron/values.yaml +++ b/charts/devtron/values.yaml @@ -274,12 +274,18 @@ argo-cd: # -- If defined, a repository applied to all Argo CD deployments repository: quay.io/argoproj/argocd # -- Overrides the global Argo CD image tag whose default is the chart appVersion - tag: "v2.5.2" + tag: "v2.13.3" # -- If defined, a imagePullPolicy applied to all Argo CD deployments imagePullPolicy: IfNotPresent configs: secret: createSecret: false + cm: + create: false + # argocd-rbac-cm + rbac: + create: true + policy.default: role:admin # argocd-application-controller controller: args: @@ -342,7 +348,6 @@ argo-cd: tag: 7.0.5-alpine # argocd-server server: - configEnabled: false affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -365,9 +370,6 @@ argo-cd: - all readOnlyRootFilesystem: true runAsNonRoot: true - # argocd-rbac-cm - rbacConfig: - policy.default: role:admin # argocd-repo-server repoServer: affinity: @@ -401,7 +403,7 @@ argo-cd: readOnlyRootFilesystem: true runAsNonRoot: true applicationSet: - enabled: false + replicas: 0 notifications: enabled: false # Values for security integration