added manifest changes for ci and 3.0.0 (#4195)

* added manifest changes for ci and 3.0.0

Signed-off-by: Sarthak Jain <sarthak.jain@harness.io>

* changed panic to fatal

Signed-off-by: Sarthak Jain <sarthak.jain@harness.io>

* removed unused envs and code

Signed-off-by: Sarthak Jain <sarthak.jain@harness.io>

---------

Signed-off-by: Sarthak Jain <sarthak.jain@harness.io>
This commit is contained in:
Sarthak Jain 2023-10-03 10:58:30 +05:30 committed by GitHub
parent 48c2ee0977
commit dd3a7ef7fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 160 deletions

View File

@ -143,7 +143,7 @@ func validatedAdminSetup(service services.ApplicationService) {
if err != nil && err == utils.ErrUserExists {
log.Println("Admin already exists in the database, not creating a new admin")
} else if err != nil {
log.Panicf("Unable to create admin, error: %v", err)
log.Fatalf("Unable to create admin, error: %v", err)
}
}

View File

@ -1,99 +0,0 @@
package self_deployer
import (
"context"
"encoding/json"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model"
chaos_infra "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaos_infrastructure"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_infrastructure"
"log"
"strings"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/k8s"
"github.com/litmuschaos/litmus/chaoscenter/graphql/server/utils"
)
// StartDeployer registers a new internal self-infra and starts the deployer
func StartDeployer(projectID string, mongoOp mongodb.MongoOperator) {
var (
isAllManifestInstall = true
deployerNamespace = utils.Config.InfraDeployments
agentScope = utils.Config.InfraScope
skipSSL = utils.Config.SkipSslVerify
selfInfrastructureNodeSelector = utils.Config.SelfInfraNodeSelector
selfInfrastructureTolerations = utils.Config.SelfInfraTolerations
failedManifest string
)
tolerations := []*model.Toleration{}
nodeSelector := &selfInfrastructureNodeSelector
if selfInfrastructureNodeSelector == "" {
nodeSelector = nil
}
if selfInfrastructureTolerations != "" {
err := json.Unmarshal([]byte(selfInfrastructureTolerations), &tolerations)
if err != nil {
log.Print("SELF CLUSTER REG FAILED[TOLERATION-PARSING] : ", err)
// if toleration parsing fails skip actual manifest apply
return
}
} else {
tolerations = nil
}
infraInput := model.RegisterInfraRequest{
Name: "Self-Infrastructure",
InfrastructureType: model.InfrastructureTypeKubernetes,
PlatformName: "others",
InfraScope: agentScope,
InfraNamespace: &deployerNamespace,
NodeSelector: nodeSelector,
Tolerations: tolerations,
}
if strings.ToLower(skipSSL) == "true" {
skip := true
infraInput.SkipSsl = &skip
}
infraOps := chaos_infrastructure.NewInfrastructureOperator(mongoOp)
infrastructureService := chaos_infra.NewChaosInfrastructureService(infraOps)
resp, err := infrastructureService.RegisterInfra(context.Background(), projectID, infraInput)
if err != nil {
log.Print("SELF CLUSTER REG FAILED[DB-REG] : ", err)
// if infra registration fails skip actual manifest apply
return
}
response, statusCode, err := infrastructureService.GetManifest(resp.Token)
if err != nil {
log.Print("ERROR", err)
}
if statusCode == 200 {
manifests := strings.Split(string(response), "---")
for _, manifest := range manifests {
if len(strings.TrimSpace(manifest)) > 0 {
_, err = k8s.InfraResource(manifest, deployerNamespace)
if err != nil {
log.Print(err)
failedManifest = failedManifest + manifest
isAllManifestInstall = false
}
}
}
}
if isAllManifestInstall == true {
log.Print("ALL MANIFESTS HAS BEEN INSTALLED:")
} else {
log.Print("SOME MANIFESTS HAS NOT BEEN INSTALLED:", failedManifest)
}
}

View File

@ -647,8 +647,6 @@ spec:
- secretRef:
name: litmus-portal-admin-secret
env:
- name: SELF_AGENT
value: "true"
# if self-signed certificate are used pass the k8s tls secret name created in portal ns, to allow agents to use tls for communication
- name: TLS_SECRET_NAME
value: ""
@ -667,23 +665,19 @@ spec:
- name: ARGO_WORKFLOW_EXECUTOR_IMAGE
value: "litmuschaos/argoexec:v3.3.1"
- name: LITMUS_CHAOS_OPERATOR_IMAGE
value: "litmuschaos/chaos-operator:3.0.0-beta3"
value: "litmuschaos/chaos-operator:3.0.0-beta11"
- name: LITMUS_CHAOS_RUNNER_IMAGE
value: "litmuschaos/chaos-runner:3.0.0-beta3"
value: "litmuschaos/chaos-runner:3.0.0-beta11"
- name: LITMUS_CHAOS_EXPORTER_IMAGE
value: "litmuschaos/chaos-exporter:3.0.0-beta3"
value: "litmuschaos/chaos-exporter:3.0.0-beta11"
- name: SERVER_SERVICE_NAME
value: "litmusportal-server-service"
- name: INFRA_DEPLOYMENTS
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller"]'
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller", "app=event-tracker"]'
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SELF_AGENT_NODE_SELECTOR
value: ""
- name: SELF_AGENT_TOLERATIONS
value: ""
- name: CHAOS_CENTER_UI_ENDPOINT
value: ""
- name: INGRESS
@ -693,9 +687,7 @@ spec:
- name: CONTAINER_RUNTIME_EXECUTOR
value: "k8sapi"
- name: DEFAULT_HUB_BRANCH_NAME
value: "refactor-hub-3.0.0"
- name: HUB_BRANCH_NAME
value: "refactor-hub-3.0.0"
value: "master"
- name: LITMUS_AUTH_GRPC_ENDPOINT
value: "litmusportal-auth-server-service.litmus.svc.cluster.local"
- name: LITMUS_AUTH_GRPC_PORT
@ -705,7 +697,7 @@ spec:
- name: REMOTE_HUB_MAX_SIZE
value: "5000000"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["0.3.0", "0.2.0", "0.1.0","ci"]'
value: '["ci"]'
ports:
- containerPort: 8080
- containerPort: 8000

View File

@ -416,7 +416,7 @@ metadata:
name: litmus-portal-admin-config
data:
INFRA_SCOPE: namespace
DB_SERVER: mongodb://my-release-mongodb-0.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-1.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-2.my-release-mongodb-headless.litmus.svc.cluster.local:27017/admin
DB_SERVER: mongodb://my-release-mongodb-0.my-release-mongodb-headless:27017,my-release-mongodb-1.my-release-mongodb-headless:27017,my-release-mongodb-2.my-release-mongodb-headless:27017/admin
VERSION: "ci"
SKIP_SSL_VERIFY: "false"
---
@ -425,7 +425,7 @@ kind: ConfigMap
metadata:
name: litmusportal-frontend-nginx-configuration
data:
default.conf: |
nginx.conf: |
pid /tmp/nginx.pid;
events {
@ -539,10 +539,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 8185
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
resources:
requests:
memory: "250Mi"
@ -552,6 +548,10 @@ spec:
memory: "512Mi"
cpu: "550m"
ephemeral-storage: "1Gi"
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
volumes:
- name: nginx-config
configMap:
@ -595,7 +595,7 @@ spec:
- name: graphql-server
image: litmuschaos/litmusportal-server:ci
volumeMounts:
- mountPath: /tmp/gitops
- mountPath: /tmp/
name: gitops-storage
- mountPath: /tmp/version
name: hub-storage
@ -618,19 +618,13 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SELF_AGENT
value: "true"
- name: SELF_AGENT_NODE_SELECTOR
value: ""
- name: SELF_AGENT_TOLERATIONS
value: ""
# if self-signed certificate are used pass the base64 tls certificate, to allow agents to use tls for communication
- name: TLS_CERT_B64
value: ""
- name: CHAOS_CENTER_SCOPE
value: "namespace"
- name: INFRA_DEPLOYMENTS
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller"]'
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller", "app=event-tracker"]'
- name: SERVER_SERVICE_NAME
value: "litmusportal-server-service"
- name: CHAOS_CENTER_UI_ENDPOINT
@ -644,15 +638,15 @@ spec:
- name: ARGO_WORKFLOW_EXECUTOR_IMAGE
value: "litmuschaos/argoexec:v3.3.1"
- name: LITMUS_CHAOS_OPERATOR_IMAGE
value: "litmuschaos/chaos-operator:3.0.0-beta3"
value: "litmuschaos/chaos-operator:3.0.0-beta11"
- name: LITMUS_CHAOS_RUNNER_IMAGE
value: "litmuschaos/chaos-runner:3.0.0-beta3"
value: "litmuschaos/chaos-runner:3.0.0-beta11"
- name: LITMUS_CHAOS_EXPORTER_IMAGE
value: "litmuschaos/chaos-exporter:3.0.0-beta3"
value: "litmuschaos/chaos-exporter:3.0.0-beta11"
- name: CONTAINER_RUNTIME_EXECUTOR
value: "k8sapi"
- name: HUB_BRANCH_NAME
value: "refactor-hub-3.0.0"
- name: DEFAULT_HUB_BRANCH_NAME
value: "master"
- name: LITMUS_AUTH_GRPC_ENDPOINT
value: "litmusportal-auth-server-service"
- name: LITMUS_AUTH_GRPC_PORT
@ -665,6 +659,8 @@ spec:
value: "false"
- name: INGRESS_NAME
value: "litmus-ingress"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["ci"]'
ports:
- containerPort: 8080
- containerPort: 8000

View File

@ -442,7 +442,6 @@ metadata:
data:
DB_SERVER: mongodb://my-release-mongodb-0.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-1.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-2.my-release-mongodb-headless.litmus.svc.cluster.local:27017/admin
INFRA_SCOPE: cluster
INFRA_NAMESPACE: litmus
VERSION: "3.0.0"
SKIP_SSL_VERIFY: "false"
# Configurations if you are using dex for OAuth
@ -665,23 +664,19 @@ spec:
- name: ARGO_WORKFLOW_EXECUTOR_IMAGE
value: "litmuschaos/argoexec:v3.3.1"
- name: LITMUS_CHAOS_OPERATOR_IMAGE
value: "litmuschaos/chaos-operator:3.0.0-beta10"
value: "litmuschaos/chaos-operator:3.0.0"
- name: LITMUS_CHAOS_RUNNER_IMAGE
value: "litmuschaos/chaos-runner:3.0.0-beta10"
value: "litmuschaos/chaos-runner:3.0.0"
- name: LITMUS_CHAOS_EXPORTER_IMAGE
value: "litmuschaos/chaos-exporter:3.0.0-beta10"
value: "litmuschaos/chaos-exporter:3.0.0"
- name: SERVER_SERVICE_NAME
value: "litmusportal-server-service"
- name: INFRA_DEPLOYMENTS
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller"]'
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller", "app=event-tracker"]'
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SELF_AGENT_NODE_SELECTOR
value: ""
- name: SELF_AGENT_TOLERATIONS
value: ""
- name: CHAOS_CENTER_UI_ENDPOINT
value: ""
- name: INGRESS
@ -697,11 +692,11 @@ spec:
- name: LITMUS_AUTH_GRPC_PORT
value: ":3030"
- name: WORKFLOW_HELPER_IMAGE_VERSION
value: "3.0.0-beta10"
value: "3.0.0"
- name: REMOTE_HUB_MAX_SIZE
value: "5000000"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["0.3.0", "0.2.0", "0.1.0","ci"]'
value: '["3.0.0"]'
ports:
- containerPort: 8080
- containerPort: 8000

View File

@ -416,7 +416,7 @@ metadata:
name: litmus-portal-admin-config
data:
INFRA_SCOPE: namespace
DB_SERVER: mongodb://my-release-mongodb-0.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-1.my-release-mongodb-headless.litmus.svc.cluster.local:27017,my-release-mongodb-2.my-release-mongodb-headless.litmus.svc.cluster.local:27017/admin
DB_SERVER: mongodb://my-release-mongodb-0.my-release-mongodb-headless:27017,my-release-mongodb-1.my-release-mongodb-headless:27017,my-release-mongodb-2.my-release-mongodb-headless:27017/admin
VERSION: "3.0.0"
SKIP_SSL_VERIFY: "false"
---
@ -425,7 +425,7 @@ kind: ConfigMap
metadata:
name: litmusportal-frontend-nginx-configuration
data:
default.conf: |
nginx.conf: |
pid /tmp/nginx.pid;
events {
@ -539,10 +539,6 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 8185
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
resources:
requests:
memory: "250Mi"
@ -552,6 +548,10 @@ spec:
memory: "512Mi"
cpu: "550m"
ephemeral-storage: "1Gi"
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
volumes:
- name: nginx-config
configMap:
@ -595,7 +595,7 @@ spec:
- name: graphql-server
image: litmuschaos/litmusportal-server:3.0.0
volumeMounts:
- mountPath: /tmp/gitops
- mountPath: /tmp/
name: gitops-storage
- mountPath: /tmp/version
name: hub-storage
@ -614,17 +614,17 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SELF_AGENT_NODE_SELECTOR
value: ""
- name: SELF_AGENT_TOLERATIONS
value: ""
- name: INFRA_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# if self-signed certificate are used pass the base64 tls certificate, to allow agents to use tls for communication
- name: TLS_CERT_B64
value: ""
- name: CHAOS_CENTER_SCOPE
value: "namespace"
- name: INFRA_DEPLOYMENTS
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller"]'
value: '["app=chaos-exporter", "name=chaos-operator", "app=workflow-controller", "app=event-tracker"]'
- name: SERVER_SERVICE_NAME
value: "litmusportal-server-service"
- name: CHAOS_CENTER_UI_ENDPOINT
@ -638,11 +638,11 @@ spec:
- name: ARGO_WORKFLOW_EXECUTOR_IMAGE
value: "litmuschaos/argoexec:v3.3.1"
- name: LITMUS_CHAOS_OPERATOR_IMAGE
value: "litmuschaos/chaos-operator:3.0.0-beta10"
value: "litmuschaos/chaos-operator:3.0.0"
- name: LITMUS_CHAOS_RUNNER_IMAGE
value: "litmuschaos/chaos-runner:3.0.0-beta10"
value: "litmuschaos/chaos-runner:3.0.0"
- name: LITMUS_CHAOS_EXPORTER_IMAGE
value: "litmuschaos/chaos-exporter:3.0.0-beta10"
value: "litmuschaos/chaos-exporter:3.0.0"
- name: CONTAINER_RUNTIME_EXECUTOR
value: "k8sapi"
- name: DEFAULT_HUB_BRANCH_NAME
@ -652,13 +652,15 @@ spec:
- name: LITMUS_AUTH_GRPC_PORT
value: ":3030"
- name: WORKFLOW_HELPER_IMAGE_VERSION
value: "3.0.0-beta10"
value: "3.0.0"
- name: REMOTE_HUB_MAX_SIZE
value: "5000000"
- name: INGRESS
value: "false"
- name: INGRESS_NAME
value: "litmus-ingress"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["3.0.0"]'
ports:
- containerPort: 8080
- containerPort: 8000