feat: [PLG-3124]: add podinfo appset manifests (#40)
* Create git-generator-files.yaml * Create config.json * Create config.json * Create deployment.yaml * Create kustomization.yaml * Create service.yaml * Update application.yml * Create environment-dev.yml * Create environment-prod.yml * Create github-connector.yml * Create service.yml * Create trigger.yml * Create pipeline.yml * Update pipeline.yml
+415 −3 · 13 files changed
-
podinfo/apps/podinfo/deployment.yaml+75 −0 -
podinfo/apps/podinfo/kustomization.yaml+5 −0 -
podinfo/apps/podinfo/service.yaml+17 −0 -
podinfo/configs/git-generator-files-discovery /cluster-config/engineering/dev/config.json+10 −0 -
podinfo/configs/git-generator-files-discovery /cluster-config/engineering/prod/config.json+10 −0 -
podinfo/configs/git-generator-files-discovery /git-generator-files.yaml+26 −0 -
podinfo/harness-gitops/application.yml+3 −3 -
podinfo/harness-gitops/environment-dev.yml+8 −0 -
podinfo/harness-gitops/environment-prod.yml+1 −0 -
podinfo/harness-gitops/github-connector.yml+23 −0 -
podinfo/harness-gitops/pipeline.yml+164 −0 -
podinfo/harness-gitops/service.yml+34 −0 -
podinfo/harness-gitops/trigger.yml+39 −0
@@ -0,0 +1,75 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podinfo +spec: + minReadySeconds: 3 + revisionHistoryLimit: 5 + progressDeadlineSeconds: 60 + strategy: + rollingUpdate: + maxUnavailable: 0 + type: RollingUpdate + selector: + matchLabels: + app: podinfo + template: + metadata: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9797" + labels: + app: podinfo + spec: + containers: + - name: podinfod + image: ghcr.io/stefanprodan/podinfo:6.5.3 + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 9898 + protocol: TCP + - name: http-metrics + containerPort: 9797 + protocol: TCP + - name: grpc + containerPort: 9999 + protocol: TCP + command: + - ./podinfo + - --port=9898 + - --port-metrics=9797 + - --grpc-port=9999 + - --grpc-service-name=podinfo + - --level=info + - --random-delay=false + - --random-error=false + env: + - name: PODINFO_UI_COLOR + value: "#34577c" + livenessProbe: + exec: + command: + - podcli + - check + - http + - localhost:9898/healthz + initialDelaySeconds: 5 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - podcli + - check + - http + - localhost:9898/readyz + initialDelaySeconds: 5 + timeoutSeconds: 5 + resources: + limits: + cpu: 2000m + memory: 512Mi + requests: + cpu: 100m + memory: 64Mi + @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - deployment.yaml + - service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: podinfo +spec: + type: ClusterIP + selector: + app: podinfo + ports: + - name: http + port: 9898 + protocol: TCP + targetPort: http + - port: 9999 + targetPort: grpc + protocol: TCP + name: grpc @@ -0,0 +1,10 @@ +{ + "cluster" : { + "owner" : "cluster-admin@company.com", + "address" : "https://kubernetes.default.svc", + "name" : "gitopscluster", + "namespace" : "dev" + }, + "asset_id" : "12345678", + "aws_account" : "654321" +} @@ -0,0 +1,10 @@ +{ + "cluster" : { + "owner" : "cluster-admin@company.com", + "address" : "https://kubernetes.default.svc", + "name" : "gitopscluster", + "namespace" : "prod" + }, + "asset_id" : "12345678", + "aws_account" : "123456" +} @@ -0,0 +1,26 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: podinfo +spec: + generators: + - git: + repoURL: https://github.com/GITHUB_USERNAME/harnesscd-example-apps.git + revision: HEAD + files: + - path: "podinfo/configs/git-generator-files-discovery/cluster-config/**/config.json" + template: + metadata: + name: '{{cluster.namespace}}-podinfo' + spec: + project: YOUR_ARGO_PROJECT_ID + source: + repoURL: https://github.com/YOUR_GITHUB_USERNAME/harness-gitops-workshop.git + targetRevision: HEAD + path: "podinfo/configs/git-generator-files-discovery/apps/podinfo" + destination: + server: '{{cluster.address}}' + namespace: '{{cluster.namespace}}' + syncPolicy: + syncOptions: + - CreateNamespace=true @@ -11,9 +11,9 @@ gitops: harness.io/envRef: "" spec: source: - repoURL: https://github.com/harness-community/harnesscd-example-apps - path: podinfo - targetRevision: master + repoURL: https://github.com/YOUR_GITHUB_USERNAME/harnesscd-example-apps + path: podinfo/configs/git-generator-files-discovery + targetRevision: main destination: server: https://kubernetes.default.svc namespace: default @@ -0,0 +1,8 @@ +environment: + name: dev + identifier: dev + tags: {} + type: PreProduction + orgIdentifier: default + projectIdentifier: default_project + variables: [] @@ -0,0 +1 @@ + @@ -0,0 +1,23 @@ +connector: + name: github-connector + identifier: githubconnector + description: "" + accountIdentifier: YOUR_HARNESS_ACCOUNT_ID + orgIdentifier: default + projectIdentifier: default_project + type: Github + spec: + url: https://github.com/GITHUB_USERNAME/harness-gitops-workshop + authentication: + type: Http + spec: + type: UsernameToken + spec: + username: GITHUB_USERNAME + tokenRef: github_pat + apiAccess: + type: Token + spec: + tokenRef: github_pat + executeOnDelegate: false + type: Repo @@ -0,0 +1,164 @@ +pipeline: + name: cd-gitops-pipeline + identifier: cdgitopspipeline + projectIdentifier: default_project + orgIdentifier: default + tags: {} + properties: + ci: + codebase: + connectorRef: githubconnector + build: <+input> + stages: + - stage: + name: DeployDev + identifier: DeployDev + description: "" + type: Deployment + spec: + deploymentType: Kubernetes + gitOpsEnabled: true + service: + serviceRef: podinfoservice + execution: + steps: + - step: + type: GitOpsUpdateReleaseRepo + name: Update Release Repo + identifier: updateReleaseRepo + timeout: 10m + spec: + variables: + - name: cluster.name + type: String + value: <+input> + - name: cluster.owner + type: String + value: <+input> + - name: cluster.address + type: String + value: <+input> + - name: cluster.namespace + type: String + value: <+input> + - name: asset_id + type: String + value: <+input> + - name: aws_account + type: String + value: <+input> + - step: + type: MergePR + name: Merge PR + identifier: mergePR + spec: + deleteSourceBranch: true + timeout: 10m + - step: + type: GitOpsFetchLinkedApps + name: Fetch Linked Apps + identifier: fetchLinkedApps + timeout: 10m + spec: {} + rollbackSteps: [] + environment: + environmentRef: dev + deployToAll: false + gitOpsClusters: + - identifier: gitopscluster + tags: {} + failureStrategies: + - onFailure: + errors: + - AllErrors + action: + type: StageRollback + - stage: + name: ApprovePromoteProd + identifier: ApprovePromoteProd + description: "" + type: Approval + spec: + execution: + steps: + - step: + name: ApprovePromoteProd + identifier: ApprovePromoteProd + type: HarnessApproval + timeout: 1d + spec: + approvalMessage: |- + Please review the following information + and approve the pipeline progression + includePipelineExecutionHistory: true + approvers: + minimumCount: 1 + disallowPipelineExecutor: false + userGroups: + - account._account_all_users + isAutoRejectEnabled: false + approverInputs: [] + tags: {} + - stage: + name: DeployProd + identifier: DeployProd + description: "" + type: Deployment + spec: + deploymentType: Kubernetes + gitOpsEnabled: true + service: + serviceRef: podinfoservice + execution: + steps: + - step: + type: GitOpsUpdateReleaseRepo + name: Update Release Repo + identifier: updateReleaseRepo + timeout: 10m + spec: + variables: + - name: cluster.name + type: String + value: <+input> + - name: cluster.owner + type: String + value: <+input> + - name: cluster.address + type: String + value: <+input> + - name: cluster.namespace + type: String + value: <+input> + - name: asset_id + type: String + value: <+input> + - name: aws_account + type: String + value: <+input> + - step: + type: MergePR + name: Merge PR + identifier: mergePR + spec: + deleteSourceBranch: true + timeout: 10m + - step: + type: GitOpsFetchLinkedApps + name: Fetch Linked Apps + identifier: fetchLinkedApps + timeout: 10m + spec: {} + rollbackSteps: [] + environment: + environmentRef: prod + deployToAll: false + gitOpsClusters: + - identifier: gitopscluster + tags: {} + failureStrategies: + - onFailure: + errors: + - AllErrors + action: + type: StageRollback @@ -0,0 +1,34 @@ +service: + name: podinfoservice + identifier: podinfoservice + orgIdentifier: default + projectIdentifier: default_project + serviceDefinition: + spec: + manifests: + - manifest: + identifier: configjson + type: ReleaseRepo + spec: + store: + type: Github + spec: + connectorRef: githubconnector + gitFetchType: Branch + paths: + - podinfo/configs/git-generator-files-discovery/cluster-config/engineering/<+env.name>/config.json + branch: main + - manifest: + identifier: podinfodeployment + type: DeploymentRepo + spec: + store: + type: Github + spec: + connectorRef: githubconnector + gitFetchType: Branch + paths: + - podinfo/configs/git-generator-files-discovery/git-generator-files.yaml + branch: main + type: Kubernetes + gitOpsEnabled: true @@ -0,0 +1,39 @@ +trigger: + name: gitopstrigger + identifier: gitopstrigger + enabled: true + encryptedWebhookSecretIdentifier: "" + description: "" + tags: {} + orgIdentifier: default + stagesToExecute: [] + projectIdentifier: default_project + pipelineIdentifier: cdgitopspipeline + source: + type: Webhook + spec: + type: Github + spec: + type: Push + spec: + connectorRef: githubconnector + autoAbortPreviousExecutions: false + payloadConditions: + - key: changedFiles + operator: NotIn + value: podinfo/configs/git-generator-files-discovery/ + - key: targetBranch + operator: Equals + value: main + headerConditions: [] + actions: [] + inputYaml: | + pipeline: + identifier: cdgitopspipeline + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch>