# Argo CD Application — single source, values inlined.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: webapp
  namespace: argocd
spec:
  project: default
  destination:
    server: https://kubernetes.default.svc
    namespace: webapp
  source:
    repoURL: ghcr.io/purisev
    chart: universal-helm-chart
    targetRevision: 3.3.0
    helm:
      releaseName: webapp
      values: |
        fullnameOverride: webapp
        integrations:
          monitoring:
            defaults:
              enabled: true
              provider: prometheus
              discovery: crd
              type: service
        ingress:
          enabled: true
          ingressClassName: nginx
          annotations:
            cert-manager.io/cluster-issuer: letsencrypt-prod
          hosts:
            web.example.com:
              paths:
                - path: /
                  pathType: Prefix
                  serviceName: webapp-web
                  servicePort: 80
          tls:
            - hosts:
                - web.example.com
              secretName: web-example-tls
        deployments:
          web:
            enabled: true
            image:
              repository: nginx
              tag: "1.27"
            service:
              enabled: true
              type: ClusterIP
              ports:
                http:
                  port: 80
                  targetPort: 8080
                metrics:
                  port: 9090
                  targetPort: 9090
            metrics:
              enabled: true
              port: metrics
              path: /metrics
              interval: 30s
            hpa:
              enabled: true
              minReplicas: 2
              maxReplicas: 10
              metrics:
                - type: Resource
                  resource:
                    name: cpu
                    target:
                      type: Utilization
                      averageUtilization: 70
            resources:
              requests:
                cpu: 100m
                memory: 128Mi
              limits:
                memory: 256Mi
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
      - ServerSideApply=true
