Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow KustomizationRef.Path and PolicyRef.Path to be template #533

Merged
merged 1 commit into from
May 8, 2024

Commits on May 8, 2024

  1. Allow KustomizationRef.Path and PolicyRef.Path to be template

    This allow Sveltos to decide which path to use at run-time.
    
    For instance, this repo https://github.com/gianlucam76/kustomize
    has two directories with kustomize files:
    
    1. production
    2. pre-production
    
    The only difference between the two is that Deployment in production/helloWorld
    has replicas set to 3, while the Deployment in pre-production/helloWorld has
    replicase set to 1.
    
    By creating this ClusterProfile:
    
    ```yaml
    apiVersion: config.projectsveltos.io/v1alpha1
    kind: ClusterProfile
    metadata:
      name: flux-system
    spec:
      clusterSelector: region=west
      syncMode: Continuous
      kustomizationRefs:
      - namespace: flux-system
        name: flux-system
        kind: GitRepository
        path: '{{ index .Cluster.metadata.annotations "environment" }}/helloWorld'
        targetNamespace: eng
    ```
    
    For every matching cluster, Sveltos will first instantiate the __path__ so:
    
    1. picking production/helloWorld path if cluster has annotation ```environment: production```
    2. picking pre-production/helloWorld path if cluster has annotation ```environment: pre-production```
    mgianluc committed May 8, 2024
    Configuration menu
    Copy the full SHA
    d4cb603 View commit details
    Browse the repository at this point in the history