Skip to content

Commit

Permalink
fix: [CDS-87155]: Fix Configs for GitOps Agent (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mankrit-singh authored Jan 8, 2024
1 parent e55b576 commit 40e1f90
Show file tree
Hide file tree
Showing 26 changed files with 279 additions and 597 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

.idea/workspace.xml
output.yaml
3 changes: 2 additions & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apiVersion: v2
name: harness-gitops
name: gitops-helm
description: A Helm chart for Harness GitOps Agent - for more information, please visit https://developer.harness.io/docs/category/gitops.
version: 1.0.0
dependencies:
- name: argo-cd
version: 5.51.6
repository: https://argoproj.github.io/argo-helm
condition: argo-cd.enabled
4 changes: 2 additions & 2 deletions templates/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Common labels
helm.sh/chart: {{ include "harness.chart" .context }}
{{ include "harness.selectorLabels" (dict "context" .context "component" .component "name" .name) }}
app.kubernetes.io/managed-by: {{ .context.Release.Service }}
app.kubernetes.io/part-of: argocd
app.kubernetes.io/part-of: harness-gitops
app.kubernetes.io/version: {{ include "harness.versionLabelValue" .context }}
{{- with .context.Values.global.additionalLabels }}
{{ toYaml . }}
Expand All @@ -41,7 +41,7 @@ Selector labels
{{- if .name -}}
app.kubernetes.io/name: {{ include "harness.name" .context }}-{{ .name }}
{{ end -}}
app.kubernetes.io/instance: {{ .context.Release.Name }}
app.kubernetes.io/instance: gitops
{{- if .component }}
app.kubernetes.io/component: {{ .component }}
{{- end }}
Expand Down
14 changes: 7 additions & 7 deletions templates/argocd-application-controller/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
{{- include "harness.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
name: {{ template "argo-cd.controller.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
spec:
ingress:
- from:
- namespaceSelector: {}
ports:
- port: metrics
- from:
- namespaceSelector: {}
ports:
- port: metrics
podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
policyTypes:
- Ingress
- Ingress
{{- end }}
18 changes: 9 additions & 9 deletions templates/argocd-applicationset/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ metadata:
name: {{ template "argo-cd.applicationSet.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
{{- include "harness.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }}
spec:
ingress:
{{- if $argo.applicationSet.webhook.ingress.enabled }}
- ports:
- port: webhook
- ports:
- port: webhook
{{- end }}
{{- if $argo.applicationSet.metrics.enabled }}
- from:
- namespaceSelector: {}
ports:
- port: metrics
- from:
- namespaceSelector: {}
ports:
- port: metrics
{{- end }}
podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 6 }}
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 6 }}
policyTypes:
- Ingress
- Ingress
{{- end }}
18 changes: 0 additions & 18 deletions templates/argocd-configs/argocd-cmd-params-cm.yaml

This file was deleted.

45 changes: 20 additions & 25 deletions templates/argocd-repo-server/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,35 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }}
{{- include "harness.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }}
name: {{ template "argo-cd.repoServer.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
spec:
ingress:
- from:
- podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.agent.name) | nindent 10 }}
- podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 10 }}
{{- if $argo.notifications.enabled }}
- podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" $argo.notifications.name) | nindent 10 }}
{{- end }}
- from:
- podSelector:
matchLabels:
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.agent.name) | nindent 10 }}
- podSelector:
matchLabels:
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 10 }}
{{- if $argo.applicationSet.enabled }}
- podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 10 }}
- podSelector:
matchLabels:
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.applicationSet.name) | nindent 10 }}
{{- end }}
ports:
- port: repo-server
protocol: TCP
ports:
- port: repo-server
protocol: TCP
{{- if $argo.repoServer.metrics.enabled }}
- from:
- namespaceSelector: {}
ports:
- port: metrics
- from:
- namespaceSelector: {}
ports:
- port: metrics
{{- end }}
podSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.repoServer.name) | nindent 6 }}
{{- include "harness.selectorLabels" (dict "context" . "name" .Values.repoServer.name) | nindent 6 }}
policyTypes:
- Ingress
- Ingress
{{- end }}
5 changes: 3 additions & 2 deletions templates/gitops-agent/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: .Values.agent.name
name: {{ .Values.agent.name }}
labels:
{{- include "harness.labels" (dict "context" . "component" $argo.server.name "name" .Values.agent.name) | nindent 4 }}
{{- include "harness.labels" (dict "context" . "component" .Values.agent.name "name" .Values.agent.name) | nindent 4 }}
rules:
- apiGroups:
- '*'
Expand Down Expand Up @@ -46,6 +46,7 @@ rules:
resources:
- applications
- applicationsets
- appprojects
verbs:
- get
- list
Expand Down
6 changes: 3 additions & 3 deletions templates/gitops-agent/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: .Values.agent.name
name: {{ .Values.agent.name }}
labels:
{{- include "harness.labels" (dict "context" . "component" $argo.server.name "name" .Values.agent.name) | nindent 4 }}
{{- include "harness.labels" (dict "context" . "component" .Values.agent.name "name" .Values.agent.name) | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: .Values.agent.name
name: {{ .Values.agent.name }}
subjects:
- kind: ServiceAccount
name: {{ include "harness.agentServiceAccountName" . }}
Expand Down
37 changes: 37 additions & 0 deletions templates/gitops-agent/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: v1
data:
GITOPS_ACCOUNT_IDENTIFIER: {{ .Values.harness.identity.accountId }}
GITOPS_AGENT_IDENTIFIER: {{ .Values.harness.identity.agentId }}
{{- if ne .Values.harness.identity.orgId "" }}
GITOPS_ORG_IDENTIFIER: {{ .Values.harness.identity.orgId }}
{{- end }}
{{- if ne .Values.harness.identity.projectId "" }}
GITOPS_PROJECT_IDENTIFIER: {{ .Values.harness.identity.projectId }}
{{- end }}
{{- if .Values.harness.disasterRecovery.enabled }}
GITOPS_DISASTER_RECOVERY_IDENTIFIER: {{ .Values.harness.disasterRecovery.identifier }}
{{- end }}
GITOPS_SERVICE_HTTP_TLS_ENABLED: "{{ .Values.harness.configMap.http.tlsEnabled }}"
GITOPS_SERVICE_HTTP_CERT_FILES: {{ .Values.harness.configMap.http.certPath }}
AGENT_HTTP_TARGET: {{ .Values.harness.configMap.http.agentHttpTarget }}
AGENT_GRPC_TARGET: {{ .Values.harness.configMap.grpc.agentGrpcTarget }}
AGENT_GRPC_AUTHORITY: {{ .Values.harness.configMap.grpc.agentGrpcAuthority }}
GITOPS_SERVICE_GRPC_INSECURE: "{{ .Values.harness.configMap.grpc.serviceGrpcInsecure }}"
GITOPS_SERVICE_PROTOCOL: {{ .Values.harness.configMap.agentProtocol }}
GITOPS_AGENT_ENABLE_RECONCILE: "{{ .Values.harness.configMap.reconcile.enabled }}"
GITOPS_AGENT_RECONCILE_INTERVAL: "{{ .Values.harness.configMap.reconcile.interval }}"
GITOPS_AGENT_DISCOVER_APPLICATION_PODS_DURATION_IN_SECS: "{{ .Values.harness.configMap.reconcile.podsDiscovery }}"
LOG_LEVEL: {{ .Values.harness.configMap.logLevel }}
GITOPS_AGENT_FETCH_TYPE: "{{ .Values.harness.configMap.agentFetchType }}"
REDIS_COMPRESSION: "{{ .Values.harness.configMap.redisCompression }}"
{{- if .Values.agent.proxy.enabled }}
HTTPS_PROXY: {{ .Values.agent.proxy.httpsProxy }}
HTTP_PROXY: {{ .Values.agent.proxy.httpProxy }}
NO_PROXY: localhost,argocd-repo-server,argocd-redis,127.0.0.1,argocd-redis-ha-haproxy,$(KUBERNETES_SERVICE_HOST),kubernetes.default.svc,{{ .Values.agent.name }}
{{- end }}
kind: ConfigMap
metadata:
labels:
{{- include "harness.labels" (dict "context" . "component" .Values.agent.name "name" (printf "%s-cm" .Values.agent.name)) | nindent 4 }}
name: {{ .Values.agent.name }}
namespace: {{ .Release.Namespace }}
Loading

0 comments on commit 40e1f90

Please sign in to comment.