### Install Chart with Dependencies Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/quick-reference.md Before installing, ensure dependencies are fetched using 'make deps'. ```bash # With dependencies make deps helm install myapp . -f values.yaml -n default ``` -------------------------------- ### Install Chart from Local Directory Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/quick-reference.md Install the chart from a local directory, optionally specifying a values file. ```bash # From local directory helm install myapp . -f values.yaml -n default ``` -------------------------------- ### Install Helm Chart with Default Values Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Installs the Helm chart using default values, which typically means no resources are rendered. Use this for initial setup or when no specific configurations are needed. ```bash # Install with default values (renders no resources) helm install myapp . --namespace app-system --create-namespace ``` -------------------------------- ### Job Configuration Examples Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Examples for configuring job-specific fields such as parallelism, completions, deadlines, and restart policies. ```yaml parallelism: 1 ``` ```yaml completions: 1 ``` ```yaml activeDeadlineSeconds: 600 ``` ```yaml backoffLimit: 1 ``` ```yaml ttlSecondsAfterFinished: 3600 ``` ```yaml restartPolicy: Never ``` ```yaml commandDurationAlert: "900" ``` ```yaml commandDurationAlertNamespace: monitoring ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/CONTRIBUTING.md Install the local git hooks for pre-commit. Run this command once to set up the hooks. ```shell pre-commit install pre-commit install-hooks ``` -------------------------------- ### Example Shared Environment Variables Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/values-schema.md An example demonstrating how to define shared environment variables for a ConfigMap. ```yaml envs: LOG_LEVEL: info APP_MODE: production PORT: "8080" ``` -------------------------------- ### Argo CD Application Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md This example demonstrates enabling Argo CD and defining an Application resource. Use this to manage Kubernetes applications declaratively with Argo CD. ```yaml nuc-argocd: enabled: true gitops: argo: enabled: true syncWave: "0" extraDeploy: argo-application: | apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: {{ include "helpers.app.fullname" . }} namespace: argocd spec: project: default source: repoURL: https://github.com/example/apps targetRevision: HEAD path: ./app destination: server: https://kubernetes.default.svc namespace: default syncPolicy: automated: prune: true selfHeal: true ``` -------------------------------- ### Install Helm Chart Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/INDEX.md Installs the Helm chart to the default namespace. Ensure you are in the chart's directory. ```bash helm install myapp . --namespace default ``` -------------------------------- ### Hook Configuration Examples Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Examples for configuring hook-specific fields like kind, weight, and delete policy for Helm execution. ```yaml kind: "pre-install,pre-upgrade" ``` ```yaml weight: "5" ``` ```yaml deletePolicy: "before-hook-creation" ``` -------------------------------- ### Install and Verify Stateless Web Application Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Installs the configured stateless web application using Helm and provides commands to verify the deployment, check logs, and test locally via port forwarding. ```bash # Install helm install webapp . -f values.yaml --namespace default ``` ```bash # Verification # Check deployment kubectl get deployment,pods,svc,ingress -n default # View logs kubectl logs -n default deployment/webapp-app # Port forward for local testing kubectl port-forward -n default svc/webapp-app 8080:80 curl http://localhost:8080 ``` -------------------------------- ### Istio Gateway and VirtualService Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example for enabling Istio integration, demonstrating the configuration of an Istio Gateway for ingress traffic and a VirtualService for routing traffic to different backend services. This snippet illustrates advanced traffic management within a service mesh. ```yaml nuc-istio: enabled: true extraDeploy: istio-gateway: | apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: name: {{ include "helpers.app.fullname" . }} spec: selector: istio: ingressgateway servers: - port: number: 80 name: http protocol: HTTP hosts: - "app.example.com" istio-virtualservice: | apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: {{ include "helpers.app.fullname" . }} spec: hosts: - app.example.com gateways: - {{ include "helpers.app.fullname" . }} http: - match: - uri: prefix: /v1 route: - destination: host: api-v1 port: number: 8080 - route: - destination: host: api-v2 port: number: 8080 ``` -------------------------------- ### Deployment Processing Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Illustrates how input values map to Deployment resource fields, such as replica count and container image configuration. ```yaml deployments.api.replicas: 3 └─> Deployment spec.replicas: 3 deployments.api.containers.[0].image: myapp deployments.api.containers.[0].imageTag: 1.0 deployments.api.containers.[0].env: [...] └─> Container spec with image: myapp:1.0, env resolved ``` -------------------------------- ### Install and Verify Stateful Database Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Installs the configured stateful database using Helm and provides commands to verify the stateful set, persistent volume claims, and services. ```bash # Install helm install postgres . -f values.yaml --namespace databases kubectl get statefulset,pvc,svc -n databases ``` -------------------------------- ### Install Chart from OCI Registry Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/quick-reference.md Use this command to add the Nixys chart repository and install the chart from the OCI registry. ```bash # From OCI registry helm repo add nixys oci://registry.nixys.ru/nuc helm install myapp nixys/nxs-universal-chart -n default ``` -------------------------------- ### CronJob Configuration Examples Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Examples for configuring cronjob-specific fields including schedule, suspension, timezone, and history limits. ```yaml schedule: "*/15 * * * *" ``` ```yaml suspend: false ``` ```yaml timeZone: UTC ``` ```yaml singleOnly: true ``` ```yaml startingDeadlineSeconds: 120 ``` ```yaml successfulJobsHistoryLimit: 3 ``` ```yaml failedJobsHistoryLimit: 1 ``` -------------------------------- ### Run End-to-End Test Flow Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/TESTS.MD Executes the default end-to-end test flow, which includes starting a kind cluster, installing the chart, and verifying resources. Dependencies must be installed first. ```bash make deps bash tests/e2e/test-e2e.sh ``` -------------------------------- ### Install and Monitor Batch Application Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Commands to install the batch application using Helm and monitor the pre-install hook and import job status. ```bash helm install batch-app . -f values.yaml --namespace default # Watch pre-install hook kubectl get jobs -n default -w # Check import job status kubectl get job -n default kubectl logs -n default job/batch-app-import-data ``` -------------------------------- ### Example of Enabling a Subchart Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/values-schema.md Example configuration to enable the 'nuc-istio' subchart by setting its 'enabled' property to true. ```yaml nuc-istio: enabled: true # Other custom properties allowed ``` -------------------------------- ### Enable KEDA with TriggerAuthentication and ScaledObject Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md This example shows how to enable KEDA for autoscaling by defining a TriggerAuthentication and a ScaledObject. Ensure KEDA is installed in your cluster. ```yaml nuc-keda: enabled: true extraDeploy: trigger-auth: | apiVersion: keda.sh/v1alpha1 kind: TriggerAuthentication metadata: name: {{ include "helpers.app.fullname" . }} spec: secretTargetRef: - parameter: connectionString name: queue-credentials key: connection scaled-object: | apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: {{ include "helpers.app.fullname" . }} spec: scaleTargetRef: name: api kind: Deployment minReplicaCount: 1 maxReplicaCount: 20 triggers: - type: azure-queue metadata: queueName: events authenticationRef: name: {{ include "helpers.app.fullname" . }} ``` -------------------------------- ### Install NXS Universal Chart Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Installs the nxs-universal-chart with custom values on a Kubernetes/OpenShift cluster. Ensure you have Helm installed and configured. ```bash helm install nxs-universal-chart oci://registry.nixys.ru/nuc/nxs-universal-chart \ --namespace app-system \ --create-namespace ``` -------------------------------- ### Deployment Configuration Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/resource-types.md Configure a Kubernetes Deployment for stateless workloads with rolling updates. Specify replicas, update strategy, and container details. ```yaml deployments: api: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 containers: - name: api image: myapp/api imageTag: "1.2.3" ports: - name: http containerPort: 8080 ``` -------------------------------- ### Configuring Kubernetes Gateway API Resources Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example showing how to enable the nuc-native-gateway and deploy GatewayClass, Gateway, and HTTPRoute resources for L4/L7 routing. ```yaml nuc-native-gateway: enabled: true extraDeploy: gateway-class: | apiVersion: gateway.networking.k8s.io/v1 kind: GatewayClass metadata: name: standard spec: controllerName: gateway.example.com/controller gateway: | apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: {{ include "helpers.app.fullname" . }} spec: gatewayClassName: standard listeners: - name: http protocol: HTTP port: 80 http-route: | apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: {{ include "helpers.app.fullname" . }} spec: parentRefs: - name: {{ include "helpers.app.fullname" . }} hostnames: - example.com rules: - matches: - path: type: PathPrefix value: /api backendRefs: - name: api-service port: 8080 ``` -------------------------------- ### Pod Configuration Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/resource-types.md Configure a raw Kubernetes Pod manifest for debugging or one-off tasks. This example runs a simple busybox container that sleeps. ```yaml pods: debug: containers: - name: shell image: busybox command: ["sh", "-c"] args: ["sleep 3600"] ``` -------------------------------- ### Ingress Processing Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Shows how input values are translated into Ingress resource configurations, including ingress class, hosts, and path routing. ```yaml ingresses.app: ingressClassName: nginx hosts: - hostname: app.example.com paths: - path: /api pathType: Prefix serviceName: api servicePort: http └─> Ingress spec.ingressClassName, spec.rules[0].host, spec.rules[0].http.paths[0] ``` -------------------------------- ### KServe InferenceService Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md This example demonstrates enabling KServe and defining an InferenceService resource for ML model serving. It specifies the predictor type and the storage URI for the model. ```yaml nuc-kserve: enabled: true extraDeploy: kserve-isvc: | apiVersion: serving.kserve.io/v1beta1 kind: InferenceService metadata: name: {{ include "helpers.app.fullname" . }} spec: predictor: sklearn: storageUri: s3://bucket/model.pkl ``` -------------------------------- ### Install Helm Chart from OCI Registry Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Installs the Helm chart directly from an OCI registry. This is useful for managing chart versions and distributions. ```bash # Install from OCI registry helm install myapp oci://registry.nixys.ru/nuc/nxs-universal-chart \ --namespace app-system --create-namespace ``` -------------------------------- ### Example: Defining an Init Container Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md The `initContainers.prepare.image` field specifies the image for an init container. Init containers run before the main application containers. ```yaml initContainers.prepare.image: busybox ``` -------------------------------- ### Setting up Vault Authentication and Static Secrets Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example demonstrating how to enable the vault-secret-operator and configure VaultAuth and VaultStaticSecret resources for managing secrets from HashiCorp Vault. ```yaml nuc-vault-secret-operator: enabled: true extraDeploy: vault-auth: | apiVersion: secrets.hashicorp.com/v1beta1 kind: VaultAuth metadata: name: {{ include "helpers.app.fullname" . }} spec: vaultConnectionRef: vault method: kubernetes kubernetes: role: app vault-secret: | apiVersion: secrets.hashicorp.com/v1beta1 kind: VaultStaticSecret metadata: name: {{ include "helpers.app.fullname" . }} spec: vaultAuthRef: {{ include "helpers.app.fullname" . }} mount: secret path: data/app destination: name: app-secrets create: true ``` -------------------------------- ### Example Shared Secret Environment Variables Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/values-schema.md An example showing how to define shared secret environment variables for a Secret. ```yaml secretEnvs: API_KEY: secret-value DATABASE_PASSWORD: db-password ``` -------------------------------- ### Deploy Helm Chart with Values File Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/INDEX.md Installs the Helm chart using a specified values file. This allows for custom deployment configurations. ```bash helm install myapp . -f values.yaml ``` -------------------------------- ### Deploying Prometheus with ServiceMonitor and PrometheusRule Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example demonstrating how to enable the kube-prometheus-stack and define custom ServiceMonitor and PrometheusRule resources for metrics collection and alerting. ```yaml nuc-kube-prometheus-stack: enabled: true deployments: api: containers: - name: api image: myapp/api ports: - name: metrics containerPort: 8081 services: api-metrics: ports: - name: metrics port: 8081 targetPort: metrics extraDeploy: service-monitor: | apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "helpers.app.fullname" . }} spec: selector: matchLabels: monitoring: enabled endpoints: - port: metrics interval: 30s path: /metrics prometheus-rule: | apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: {{ include "helpers.app.fullname" . }} spec: groups: - name: app.rules interval: 30s rules: - alert: AppHighErrorRate expr: | rate(app_errors_total[5m]) > 0.1 for: 5m ``` -------------------------------- ### Example: GitOps Override for Sync Wave Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md The `gitops.argo.syncWave` field allows for resource-level GitOps overrides, specifically for Argo CD in this example. It controls the synchronization wave. ```yaml gitops.argo.syncWave: "20" ``` -------------------------------- ### Horizontal Pod Autoscaler Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Shows how to configure a Horizontal Pod Autoscaler with target CPU and memory, and replica bounds. ```yaml hpas.api: scaleTargetRef: {kind: Deployment, name: api} targetCPU: 70 targetMemory: 80 minReplicas: 2 maxReplicas: 10 └─> HPA metrics[0] (CPU), metrics[1] (memory), with scale bounds ``` -------------------------------- ### Helm Hook Job Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Shows how to define a Helm hook job with specific hook annotations and weights. ```yaml hooks.setup: kind: "pre-install" weight: "1" deletePolicy: "before-hook-creation" containers: [...] └─> Job with hook annotations and weights ``` -------------------------------- ### ConfigMap Data Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Illustrates how to define data for a ConfigMap and how it maps to the generated ConfigMap. ```yaml configMaps.app-config: data: LOG_LEVEL: info └─> ConfigMap data.LOG_LEVEL: info envs: APP_MODE: production └─> ConfigMap named {fullname}-envs with data.APP_MODE ``` -------------------------------- ### Cert-Manager ClusterIssuer and Certificate Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example for enabling cert-manager and configuring a ClusterIssuer for Let's Encrypt, along with a Certificate resource for TLS management. This shows how to set up automated certificate issuance. ```yaml nuc-certificates: enabled: true extraDeploy: letsencrypt-issuer: | apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: letsencrypt-prod spec: acme: server: https://acme-v02.api.letsencrypt.org/directory email: admin@example.com privateKeySecretRef: name: letsencrypt-key solvers: - http01: ingress: class: nginx app-certificate: | apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: app-tls spec: secretName: app-tls-secret commonName: app.example.com issuerRef: name: letsencrypt-prod kind: ClusterIssuer ``` -------------------------------- ### Resource Fallback Chain Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/quick-reference.md Illustrates the order of precedence for resource settings, from highest (Container-level) to lowest (Generic). This applies to settings like `resources`. ```text Container.resources → DeploymentsGeneral.resources → Generic.resources ``` -------------------------------- ### Manage Configuration-Heavy Application Deployment Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Commands for installing and updating a configuration-heavy application. It includes steps for initial deployment and forcing rollouts after configuration changes. ```bash helm install config-app . -f values.yaml # Update configuration kubectl edit configmap config-app-app-settings # Force rollout of deployments (via checksum annotations) helm upgrade config-app . -f values.yaml ``` -------------------------------- ### Extra Deploy Custom Resource Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Demonstrates rendering a custom resource definition (CRD) using templated YAML. ```yaml extraDeploy: custom-crd: | apiVersion: custom.io/v1 kind: MyResource metadata: name: {{ include "helpers.app.fullname" . }} spec: value: "{{ .Values.generic.defaultURL }}" └─> Rendered MyResource with template variables substituted ``` -------------------------------- ### Job Processing Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Shows the mapping of input values to Job resource fields, including container commands and backoff limits. ```yaml jobs.migrate.containers.[0].command: ["./migrate.sh"] └─> Job spec.template.spec.containers[0].command jobs.migrate.backoffLimit: 3 └─> Job spec.backoffLimit: 3 ``` -------------------------------- ### Kubernetes Hook Configuration Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/resource-types.md Define pre-install hooks for setup tasks. Ensure 'kind', 'weight', and 'containers' are specified. ```yaml hooks: pre-install: kind: "pre-install" weight: "1" containers: - name: setup image: busybox command: ["sh", "-c"] args: ["echo Setting up..."] ``` -------------------------------- ### Service Processing Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Illustrates the mapping of input values to Service resource fields, specifically for port configurations and service type. ```yaml services.api.ports[0]: name: http port: 80 targetPort: http └─> Service spec.ports[0] services.api.type: LoadBalancer services.api.loadBalancerIP: 10.0.0.10 └─> Service spec.type, spec.loadBalancerIP ``` -------------------------------- ### CronJob Processing Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Demonstrates how input values are processed for CronJob resources, including schedule, timezone, and container commands. ```yaml cronJobs.cleanup.schedule: "0 2 * * *" cronJobs.cleanup.timeZone: "UTC" └─> CronJob spec.schedule, spec.timeZone cronJobs.cleanup.containers.[0].command: ["./cleanup.sh"] └─> CronJob spec.jobTemplate.spec.template.spec.containers[0].command ``` -------------------------------- ### CronJob General Configuration Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Sets default resources, environment sources, and schedule controls for all CronJobs. Container-level resources will override these defaults. ```yaml cronJobsGeneral: suspend: true singleOnly: true timeZone: UTC restartPolicy: Never successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 ttlSecondsAfterFinished: 7200 activeDeadlineSeconds: 7200 backoffLimit: 3 resources: requests: cpu: 10m memory: 30Mi limits: cpu: 2 memory: 3072Mi envSecrets: - web-monolith-secret-envs envConfigmaps: - web-monolith-envs ``` -------------------------------- ### Deploy Configuration-Heavy Application Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md This example shows how to define multiple ConfigMaps, environment variables, and secrets for an application. It includes deployment configurations for both the application and Nginx, along with volume mounts for configuration files. ```yaml nameOverride: config-app envs: APP_NAME: config-app LOG_LEVEL: info DEBUG: "false" secretEnvs: API_SECRET_KEY: "secret-key-value" DATABASE_PASSWORD: "secure-password" configMaps: app-settings: data: app.yaml: | server: port: 8080 workers: 4 database: pool_size: 20 nginx.conf: | worker_processes auto; events { worker_connections 1024; } http: { upstream backend { server localhost:8080; } } feature-flags: data: NEW_UI_ENABLED: "true" BETA_FEATURE: "false" EXPERIMENT_A: "50" deployments: app: replicas: 3 containers: - name: app image: myapp imageTag: "2.1.0" ports: - name: http containerPort: 8080 envConfigmaps: - envs - feature-flags envsFromSecret: secret-envs: - API_SECRET_KEY - DATABASE_PASSWORD env: - name: ENVIRONMENT value: production - name: LOG_FORMAT value: json volumeMounts: - name: config mountPath: /etc/app readOnly: true resources: requests: cpu: 200m memory: 256Mi limits: cpu: 1 memory: 512Mi nginx: replicas: 2 containers: - name: nginx image: nginx imageTag: "1.27" ports: - name: http containerPort: 80 volumeMounts: - name: nginx-config mountPath: /etc/nginx readOnly: true resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi generic: volumes: - name: config type: configMap originalName: config-app-app-settings - name: nginx-config type: configMap originalName: config-app-app-settings ``` -------------------------------- ### DaemonSet Configuration Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/resource-types.md Configure a Kubernetes DaemonSet to run a pod on each node. Suitable for cluster-wide agents like node-exporter. Includes tolerations for all nodes. ```yaml daemonSets: node-exporter: containers: - name: exporter image: prom/node-exporter imageTag: "v1.7.0" ports: - containerPort: 9100 tolerations: - operator: Exists ``` -------------------------------- ### Verify Local Toolchain Versions Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/DEPENDENCY.md Checks the installed versions of essential development tools. Run these commands to ensure your local environment is correctly configured. ```bash git --version helm version kubectl version --client kind version docker version python3 --version pre-commit --version kubeconform -v helm plugin list ``` -------------------------------- ### Install Helm Chart Dependencies Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md These commands are used to install or update Helm chart dependencies, ensuring all necessary subcharts are fetched and available for linting, templating, or installation. This is crucial for managing the chart's ecosystem. ```bash make deps ``` ```bash bash scripts/helm-deps.sh . ``` -------------------------------- ### Image Pull Secret Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/values-schema.md An example of how to configure image pull secrets for a specific registry. ```yaml imagePullSecrets: my-registry: | { "auths": { "registry.example.com": { "username": "user", "password": "token" } } } ``` -------------------------------- ### FluxCD GitRepository and Kustomization Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md This snippet shows how to enable FluxCD and define a GitRepository and Kustomization resource. It's useful for setting up GitOps workflows with FluxCD. ```yaml nuc-fluxcd: enabled: true gitops: flux: enabled: true labels: kustomize.toolkit.fluxcd.io/name: "{{ include 'helpers.app.fullname' . }}" extraDeploy: flux-git-repo: | apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: {{ include "helpers.app.fullname" . }} spec: interval: 1m url: https://github.com/example/config ref: branch: main secretRef: name: git-credentials flux-kustomization: | apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: {{ include "helpers.app.fullname" . }} spec: sourceRef: kind: GitRepository name: {{ include "helpers.app.fullname" . }} path: ./kubernetes prune: true interval: 5m ``` -------------------------------- ### Dry Run Helm Install Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md This bash command performs a dry run installation of a Helm release. It simulates the installation process without actually making any changes to the cluster, allowing you to check for errors and review the intended resources. ```bash helm install myrelease . -f values.yaml --dry-run --debug ``` -------------------------------- ### Install and Monitor Scheduled Jobs Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Commands to install scheduled tasks using Helm and monitor cron jobs, including checking their status and logs. ```bash helm install scheduled-tasks . -f values.yaml # View cron jobs kubectl get cronjobs kubectl describe cronjob cleanup # Check last run kubectl get jobs -l cronjob-name=cleanup kubectl logs -l cronjob-name=cleanup ``` -------------------------------- ### Install Python Dependencies for Smoke Tests Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/TESTS.MD Installs the necessary Python packages required for running the smoke tests. This is typically done using pip. ```bash pip3 install -r tests/smokes/requirements.txt ``` -------------------------------- ### Example: Defining a Volume Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md The `volumes` field allows you to define volumes for your workload pods. This example defines a volume named 'app' of type 'configMap'. ```yaml volumes: [{name: app, type: configMap}] ``` -------------------------------- ### Example: Adding Pod Tolerations Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md The `tolerations` field allows pods to be scheduled on nodes with matching taints. This example adds a toleration for a 'dedicated' taint. ```yaml tolerations: [{key: dedicated, operator: Exists}] ``` -------------------------------- ### Batch Job with Pre-install Hook Configuration Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Configure a batch application with a pre-install database setup hook and a data import job. Ensure database credentials are provided via secrets. ```yaml nameOverride: batch-app hooks: db-setup: kind: pre-install weight: "1" deletePolicy: before-hook-creation backoffLimit: 1 containers: - name: setup image: mycompany/migrations imageTag: "latest" command: ["/bin/sh", "-c"] args: - | set -e echo "Setting up database..." ./setup.sh env: - name: DB_HOST value: postgres.databases.svc - name: DB_NAME value: myapp envSecrets: - db-creds envsFromSecret: db-creds: - DB_USER - DB_PASSWORD jobs: import-data: parallelism: 1 completions: 1 backoffLimit: 3 activeDeadlineSeconds: 3600 ttlSecondsAfterFinished: 86400 containers: - name: import image: mycompany/data-import imageTag: "1.0.0" command: ["/bin/sh", "-c"] args: - | set -e echo "Importing data..." python3 import.py env: - name: DB_HOST value: postgres.databases.svc - name: DB_NAME value: myapp envSecrets: - db-creds envsFromSecret: db-creds: - DB_USER - DB_PASSWORD resources: requests: cpu: 1 memory: 2Gi limits: cpu: 2 memory: 4Gi secrets: db-creds: type: Opaque data: DB_USER: myappuser DB_PASSWORD: SecurePassword123! ``` -------------------------------- ### Example: Setting Container Resource Requests Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Define `resources.requests.cpu` to specify the minimum CPU resources required by a container. This acts as a fallback for containers that omit their own resource definitions. ```yaml resources.requests.cpu: 100m ``` -------------------------------- ### Deploy Multi-Tier Application Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md This example defines a multi-tier application with frontend, backend API, and database components within a single Helm release. It configures deployments, services, ingress, horizontal pod autoscaling, and secrets. ```yaml nameOverride: multitier-app # Frontend StaticAssets deployments: frontend: replicas: 2 containers: - name: web image: myapp/frontend imageTag: "3.0.0" ports: - name: http containerPort: 3000 env: - name: API_BASE_URL value: "http://api.example.com/api" resources: requests: cpu: 100m memory: 128Mi api: replicas: 3 containers: - name: api image: myapp/api imageTag: "2.5.0" ports: - name: http containerPort: 8080 env: - name: DATABASE_URL value: "postgresql://postgres.databases.svc:5432/myapp" envSecrets: - db-credentials envsFromSecret: db-credentials: - DB_USER - DB_PASSWORD resources: requests: cpu: 200m memory: 256Mi services: frontend: type: ClusterIP ports: - port: 80 targetPort: 3000 api: type: ClusterIP ports: - port: 8080 targetPort: 8080 ingresses: app: ingressClassName: nginx hosts: - hostname: example.com paths: - path: / pathType: Prefix serviceName: frontend servicePort: 80 - path: /api pathType: Prefix serviceName: api servicePort: 8080 hpas: api-scale: scaleTargetRef: kind: Deployment name: api minReplicas: 2 maxReplicas: 10 targetCPU: 70 secrets: db-credentials: type: Opaque data: DB_USER: appuser DB_PASSWORD: "SecurePassword123" ``` -------------------------------- ### Traefik IngressRoute Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md Example of enabling and configuring a Traefik IngressRoute for advanced routing. This snippet demonstrates how to define an IngressRoute with specific host matching and service routing. ```yaml nuc-traefik: enabled: true extraDeploy: traefik-route: | apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: name: {{ include "helpers.app.fullname" . }} spec: entryPoints: - web routes: - match: Host(`example.com`) kind: Rule services: - name: api port: 8080 ``` -------------------------------- ### Run End-to-End Test Flow with Debugging Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/TESTS.MD Executes the end-to-end test flow with additional debug arguments passed to `helm upgrade --install`. Dependencies must be installed first. ```bash make deps bash tests/e2e/test-e2e.sh --debug ``` -------------------------------- ### Generate Docs with Make Source: https://github.com/nixys/nxs-universal-chart/blob/main/docs/CONTRIBUTING.md Use the local wrapper script to regenerate the chart documentation. This is a convenient alternative to running `pre-commit` directly. ```shell make docs ``` -------------------------------- ### Deploy Multi-Tier Application Stack Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Commands for deploying a complete multi-tier application stack to a production namespace. It also shows how to verify the deployment status. ```bash helm install multitier-app . -f values.yaml --namespace production kubectl get all -n production ``` -------------------------------- ### StatefulSet with Persistent Storage Configuration Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/configuration.md Sets up a stateful application, such as a database, with persistent storage. This example configures a PostgreSQL instance with a persistent volume claim for its data directory. The `services.db-headless` configuration is crucial for stateful applications requiring stable network identities. ```yaml statefulSets: database: serviceName: db-headless containers: - name: postgres image: postgres imageTag: "16" volumeMounts: - name: data mountPath: /var/lib/postgresql/data services: db-headless: clusterIP: None ports: - port: 5432 pvcs: data: accessModes: ["ReadWriteOnce"] size: 10Gi ``` -------------------------------- ### Knative Service Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/subcharts.md This snippet shows how to enable Knative and define a Service resource for deploying serverless workloads. It includes basic container configuration and environment variables. ```yaml nuc-knative: enabled: true extraDeploy: knative-service: | apiVersion: serving.knative.dev/v1 kind: Service metadata: name: {{ include "helpers.app.fullname" . }} spec: template: metadata: annotations: autoscaling.knative.dev/minScale: "0" autoscaling.knative.dev/maxScale: "10" spec: containers: - image: myapp:latest env: - name: TARGET value: "World" ``` -------------------------------- ### Metadata Application Helpers in _compat.tpl Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md These helpers are used to apply various types of metadata, including labels and annotations, to Kubernetes resources for management and tracking. ```go-template include "helpers.metadata.labels" include "helpers.metadata.annotations" include "helpers.metadata.gitopsLabels" include "helpers.metadata.hookAnnotations" ``` -------------------------------- ### Rendered Argo CD Metadata Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/usage-examples.md Example of how Argo CD metadata annotations are rendered for a Deployment. ```yaml apiVersion: apps/v1 kind: Deployment metadata: annotations: argocd.argoproj.io/sync-wave: "10" argocd.argoproj.io/sync-options: CreateNamespace=true,ServerSideApply=true labels: app.kubernetes.io/part-of: platform ``` -------------------------------- ### Workload Containers in Array Form Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/values-schema.md Example of defining containers using an array, where each element is a container specification. ```yaml containers: - name: app image: myapp - name: sidecar image: sidecar ``` -------------------------------- ### Service Account RBAC Example Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/templates.md Illustrates the creation of a ServiceAccount with associated Role, RoleBinding, ClusterRole, and ClusterRoleBinding resources. ```yaml serviceAccount.app-admin: role: rules: [{apiGroups: [""], resources: ["pods"], verbs: ["get"]}] clusterRole: rules: [{apiGroups: [""], resources: ["nodes"], verbs: ["list"]}] └─> ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding ``` -------------------------------- ### Example: Defining a Main Container Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md The `containers.api.image` field defines the image for the main application container. This is a required field for most workloads. ```yaml containers.api.image: nginx ``` -------------------------------- ### Example: Configuring Pod Security Context Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Set `securityContext.runAsNonRoot: true` to enforce that containers run as a non-root user. Add `mergeWithGeneric: true` to merge with generic pod security contexts. ```yaml securityContext.runAsNonRoot: true ``` -------------------------------- ### Example: Setting DNS Policy Source: https://github.com/nixys/nxs-universal-chart/blob/main/README.md Configure the `dnsPolicy` for your pods. `ClusterFirst` is a common setting for pods within a Kubernetes cluster. ```yaml dnsPolicy: ClusterFirst ``` -------------------------------- ### Minimal App with Service Configuration Source: https://github.com/nixys/nxs-universal-chart/blob/main/_autodocs/quick-reference.md This configuration defines a basic application deployment with a service to expose it. ```yaml nameOverride: myapp deployments: app: containers: - name: app image: myapp ports: - containerPort: 8080 services: app: ports: - port: 8080 targetPort: 8080 ```