diff --git a/flux_local/git_repo.py b/flux_local/git_repo.py index 75fef081..7c0f5a91 100644 --- a/flux_local/git_repo.py +++ b/flux_local/git_repo.py @@ -42,7 +42,7 @@ import git -from . import kustomize +from . import kustomize, helm from .exceptions import FluxException, KustomizePathException from .manifest import ( CRD_KIND, @@ -694,12 +694,12 @@ async def update_kustomization(cluster: Cluster) -> None: await asyncio.gather(*kustomization_tasks) # Handle any HelmRelease value references - # for cluster in clusters: - # for kustomization in cluster.kustomizations: - # kustomization.helm_releases = [ - # expand_value_references(helm_release, kustomization) - # for helm_release in kustomization.helm_releases - # ] + for cluster in clusters: + for kustomization in cluster.kustomizations: + kustomization.helm_releases = [ + helm.expand_value_references(helm_release, kustomization) + for helm_release in kustomization.helm_releases + ] # Visit Helm resources diff --git a/tests/testdata/cluster8/apps/podinfo-tls-values.yaml b/tests/testdata/cluster8/apps/podinfo-tls-values.yaml index e8ce331c..3bed1343 100644 --- a/tests/testdata/cluster8/apps/podinfo-tls-values.yaml +++ b/tests/testdata/cluster8/apps/podinfo-tls-values.yaml @@ -4,4 +4,4 @@ kind: Secret metadata: name: podinfo-tls-values data: - crt: dmFsdWUtMg0KDQo= \ No newline at end of file + crt: dmFsdWUtMg0KDQo= diff --git a/tests/tool/__snapshots__/test_build.ambr b/tests/tool/__snapshots__/test_build.ambr index bc467753..e6d0af21 100644 --- a/tests/tool/__snapshots__/test_build.ambr +++ b/tests/tool/__snapshots__/test_build.ambr @@ -1055,6 +1055,41 @@ name: flux-system --- + # Source: podinfo/templates/redis/config.yaml + apiVersion: v1 + kind: ConfigMap + metadata: + name: podinfo-redis + annotations: + config.kubernetes.io/index: '0' + internal.config.kubernetes.io/index: '0' + data: + redis.conf: | + maxmemory 64mb + maxmemory-policy allkeys-lru + save "" + appendonly no + --- + # Source: podinfo/templates/redis/service.yaml + apiVersion: v1 + kind: Service + metadata: + name: podinfo-redis + labels: + app: podinfo-redis + annotations: + config.kubernetes.io/index: '1' + internal.config.kubernetes.io/index: '1' + spec: + type: ClusterIP + selector: + app: podinfo-redis + ports: + - name: redis + port: 6379 + protocol: TCP + targetPort: redis + --- # Source: podinfo/templates/service.yaml apiVersion: v1 kind: Service @@ -1066,8 +1101,8 @@ app.kubernetes.io/version: "6.5.4" app.kubernetes.io/managed-by: Helm annotations: - config.kubernetes.io/index: '0' - internal.config.kubernetes.io/index: '0' + config.kubernetes.io/index: '2' + internal.config.kubernetes.io/index: '2' spec: type: ClusterIP ports: @@ -1093,8 +1128,8 @@ app.kubernetes.io/version: "6.5.4" app.kubernetes.io/managed-by: Helm annotations: - config.kubernetes.io/index: '1' - internal.config.kubernetes.io/index: '1' + config.kubernetes.io/index: '3' + internal.config.kubernetes.io/index: '3' spec: replicas: 1 strategy: @@ -1124,6 +1159,7 @@ - --port-metrics=9797 - --grpc-port=9999 - --grpc-service-name=podinfo + - --cache-server=tcp://podinfo-redis:6379 - --level=info - --random-delay=false - --random-error=false @@ -1175,6 +1211,101 @@ volumes: - name: data emptyDir: {} + --- + # Source: podinfo/templates/redis/deployment.yaml + apiVersion: apps/v1 + kind: Deployment + metadata: + name: podinfo-redis + labels: + app: podinfo-redis + annotations: + config.kubernetes.io/index: '4' + internal.config.kubernetes.io/index: '4' + spec: + strategy: + type: Recreate + selector: + matchLabels: + app: podinfo-redis + template: + metadata: + labels: + app: podinfo-redis + annotations: + checksum/config: "34c601c9d39797bbf53d1c7a278976609301f637ec11dc0253563729dfad4f8e" + spec: + containers: + - name: redis + image: "public.ecr.aws/docker/library/redis:7.0.6" + imagePullPolicy: IfNotPresent + command: + - redis-server + - "/redis-master/redis.conf" + ports: + - name: redis + containerPort: 6379 + protocol: TCP + livenessProbe: + tcpSocket: + port: redis + initialDelaySeconds: 5 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - redis-cli + - ping + initialDelaySeconds: 5 + timeoutSeconds: 5 + resources: + limits: + cpu: 1000m + memory: 128Mi + requests: + cpu: 100m + memory: 32Mi + volumeMounts: + - mountPath: /var/lib/redis + name: data + - mountPath: /redis-master + name: config + volumes: + - name: data + emptyDir: {} + - name: config + configMap: + name: podinfo-redis + items: + - key: redis.conf + path: redis.conf + --- + # Source: podinfo/templates/ingress.yaml + apiVersion: networking.k8s.io/v1 + kind: Ingress + metadata: + name: podinfo + labels: + helm.sh/chart: podinfo-6.5.4 + app.kubernetes.io/name: podinfo + app.kubernetes.io/version: "6.5.4" + app.kubernetes.io/managed-by: Helm + annotations: + config.kubernetes.io/index: '5' + internal.config.kubernetes.io/index: '5' + spec: + ingressClassName: nginx + rules: + - host: "podinfo.production" + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: podinfo + port: + number: 9898 ''' diff --git a/tests/tool/__snapshots__/test_get_cluster.ambr b/tests/tool/__snapshots__/test_get_cluster.ambr index cc1b3d52..f24341c7 100644 --- a/tests/tool/__snapshots__/test_get_cluster.ambr +++ b/tests/tool/__snapshots__/test_get_cluster.ambr @@ -241,6 +241,7 @@ repo_namespace: flux-system images: - ghcr.io/stefanprodan/podinfo:6.5.4 + - public.ecr.aws/docker/library/redis:7.0.6 cluster_policies: [] config_maps: - name: podinfo-values @@ -284,6 +285,7 @@ repo_namespace: flux-system images: - ghcr.io/stefanprodan/podinfo:6.5.4 + - public.ecr.aws/docker/library/redis:7.0.6 cluster_policies: [] config_maps: - name: podinfo-values