[go: nahoru, domu]

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

feat: removed inception dependency for installation. #3228

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f0ee18f
changes in inception
jatin-jangir Apr 3, 2023
d0debb0
added kubewatch.yaml in templates
jatin-jangir Apr 3, 2023
883cbee
add the kubewatch.yaml
jatin-jangir Apr 3, 2023
e82aad8
Merge branch 'devtron-labs:main' into remove-kubewatch
jatin-jangir Apr 3, 2023
d10d676
add resources in kubewatch.yaml
jatin-jangir Apr 3, 2023
6ed767c
removed apply command for kubewatch
jatin-jangir Apr 3, 2023
ec1d6d4
add gitsensor in templates
jatin-jangir Apr 4, 2023
a4777b4
update gitsensor initcoontainer
jatin-jangir Apr 4, 2023
634a7da
updated for cicd module
jatin-jangir Apr 4, 2023
f865f1f
updated for installer for testing
jatin-jangir Apr 4, 2023
8ca9627
added migration for lens and gitsensor
jatin-jangir Apr 4, 2023
4e654f9
added random words to job
jatin-jangir Apr 4, 2023
9ce5fd7
deletion in inception
jatin-jangir Apr 4, 2023
0f6bb52
changed CM
jatin-jangir Apr 5, 2023
34cfbfc
Merge branch 'devtron-labs:main' into remove-kubewatch
jatin-jangir Apr 5, 2023
d95bc18
added nats
jatin-jangir Apr 5, 2023
c4958e7
added rollout
jatin-jangir Apr 5, 2023
acf4d6c
change crd
jatin-jangir Apr 5, 2023
91b3c75
change argocd-resources-json
jatin-jangir Apr 5, 2023
31c3a00
change argocd-resources-json fix
jatin-jangir Apr 5, 2023
8d204c6
added serviceAccount and CR and CRB
jatin-jangir Apr 6, 2023
5aa1af4
Merge branch 'devtron-labs:main' into remove-kubewatch
jatin-jangir Apr 6, 2023
23a1bf4
added secrets
jatin-jangir Apr 7, 2023
adef49d
Merge branch 'devtron-labs:main' into remove-kubewatch
jatin-jangir Apr 7, 2023
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
Prev Previous commit
Next Next commit
change argocd-resources-json
  • Loading branch information
jatin-jangir committed Apr 5, 2023
commit 91b3c757b46a69e7a53d3e7af604f3daa07172bc
175 changes: 175 additions & 0 deletions charts/devtron/templates/argocd-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,178 @@ data:
- name: kedacore
type: helm
url: https://kedacore.github.io/charts
resource.customizations: >
kubernetes-client.io/ExternalSecret:
health.lua: |
hs = {}
if obj.status ~= nil then
if obj.status.status ~= nil then
hs.status = "Degraded"
hs.message = obj.status.status
else
hs.status = "Healthy"
end
else
hs.status = "Healthy"
end
return hs
argoproj.io/Rollout:
health.lua: |
function checkReplicasStatus(obj)
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
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
hs.status = "Progressing"
hs.message = "Waiting for roll out to finish: old replicas are pending termination"
return hs
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

hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for _, condition in ipairs(obj.status.conditions) do
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
return hs
end
if condition.type == "Progressing" and condition.reason == "ProgressDeadlineExceeded" then
hs.status = "Degraded"
hs.message = condition.message
return hs
end
end
end
if obj.status.currentPodHash ~= nil then
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"
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"
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
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
return isPaused
end

if paused then
hs.status = "Suspended"
hs.message = "Rollout is paused"
return hs
end
if currentRSIsStable and stepCount == currentStepIndex then
replicasHS = checkReplicasStatus(obj)
if replicasHS ~= nil then
return replicasHS
end
hs.status = "Healthy"
hs.message = "The rollout has completed all steps"
return hs
end
end
hs.status = "Progressing"
hs.message = "Waiting for rollout to finish steps"
return hs
end

-- 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
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
end
end
hs.status = "Progressing"
hs.message = "Waiting for rollout to finish: status has not been reconciled."
return hs
33 changes: 1 addition & 32 deletions manifests/installation-script
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ operatorSecret = kubectl get secret -n devtroncd devtron-operator-secret;
operatorConfigMap = kubectl get cm -n devtroncd devtron-operator-cm;
postgresqlPassword = jsonSelect(operatorSecret, "data.POSTGRESQL_PASSWORD");
webHookToken = jsonSelect(operatorSecret, "data.WEBHOOK_TOKEN");
postgresSecret = kubectl get secret -n devtroncd postgresql-postgresql;
setupDevtronIngress = jsonSelect(operatorConfigMap, "data.ENABLE_INGRESS");
devtronIngressAnnotations = jsonSelect(operatorConfigMap, "data.INGRESS_ANNOTATIONS");

Expand All @@ -25,19 +24,8 @@ base64DecoderPrefix = `#!/bin/bash
`;
base64DecoderSuffix = ` | base64 -d | tr -d ':\n'`;

existingPostgresSecret = jsonSelect(postgresSecret, "data.postgresql-password");

if existingPostgresSecret {
postgresqlPassword = existingPostgresSecret;
}

log("postgres pwd");
log(existingPostgresSecret);
log(existingPostgresSecretPlain);

if !postgresqlPassword {
postgresqlPassword = shellScript passwordGen;
}
if !baseURL {
log("baseURL is mandatory");
}
Expand All @@ -52,25 +40,14 @@ if !defaultCacheBucket {

######Generating raw urls
argocdResource_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/argocd-resource.json";
devtronHousekeeping_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/devtron-housekeeping.yaml";
devtron_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/devtron.yaml";
devtronIngress_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/devtron-ingress.yaml";
if enableLegacyApi=="true" {
devtronIngress_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/devtron-ingress-legacy.yaml";
}
log(devtronIngress_raw);
serviceAccount_raw = REPO_RAW_URL + LTAG + "/manifests/yamls/serviceaccount.yaml";

######Downloading the manifests
argocdResource = download(argocdResource_raw);
devtronHousekeeping = download(devtronHousekeeping_raw);
devtron = download(devtron_raw);
devtronIngress = download(devtronIngress_raw);
serviceAccount = download(serviceAccount_raw);

######Getting the ConfigMap

devtronHousekeepingOverride = kubectl get cm -n devtroncd devtron-housekeeping-override-cm;
devtronOverride = kubectl get cm -n devtroncd devtron-override-cm;
serviceAccountOverride = kubectl get cm -n devtroncd devtron-service-account-override-cm;

Expand All @@ -93,8 +70,6 @@ dexJwtKey = shellScript passwordGen;
dexCStoreKey = shellScript passwordGen;
externalCIAPISecret = shellScript passwordGen;

kubeYamlEdit(devtron, "data.PG_PASSWORD", postgresqlPassword, `/Secret//devtron-secret`);

if hasDevtron {
devtronSecret = kubectl get secret -n devtroncd devtron-secret;
texternalCIAPISecret = jsonSelect(devtronSecret, "data.EXTERNAL_CI_API_SECRET");
Expand Down Expand Up @@ -124,18 +99,12 @@ if tdexCStoreKey {
dexCStoreKey = tdexCStoreKey;
}


kubeYamlEdit(devtron, "data.EXTERNAL_CI_API_SECRET", externalCIAPISecret, `/Secret//devtron-secret`);
kubeYamlEdit(devtron, "data.WEBHOOK_TOKEN", webHookToken, `/Secret//devtron-secret`);
kubeYamlEdit(devtron, "data.ORCH_TOKEN", orchToken, `/Secret//devtron-secret`);
kubeYamlEdit(devtron, "data.DEX_SECRET", dexSecret, `/Secret//devtron-secret`);
kubeYamlEdit(devtron, "data.DEX_JWTKEY", dexJwtKey, `/Secret//devtron-secret`);
kubeYamlEdit(devtron, "data.DEX_CSTOREKEY", dexCStoreKey, `/Secret//devtron-secret`);


devtron = kubectl apply -n devtroncd devtron -u devtronOverride;
log("executed devtron setup");

## Applying Housekeeping Job
appHousekeeping = kubectl apply -n devtroncd devtronHousekeeping -u devtronHousekeepingOverride;
log("executed devtron-housekeeping setup");
log("executed devtron setup");