|
|
@@ -15,6 +15,7 @@ import (
|
|
|
"github.com/porter-dev/porter/internal/helm"
|
|
|
"github.com/porter-dev/porter/internal/helm/loader"
|
|
|
"github.com/porter-dev/porter/internal/kubernetes"
|
|
|
+ "github.com/porter-dev/porter/internal/kubernetes/nodes"
|
|
|
"github.com/porter-dev/porter/internal/models"
|
|
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
)
|
|
|
@@ -96,19 +97,11 @@ func (c *InstallAgentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- porterAgentValues := map[string]interface{}{
|
|
|
- "agent": map[string]interface{}{
|
|
|
- "image": "public.ecr.aws/o1j4x7p4/porter-agent:latest",
|
|
|
- "porterHost": c.Config().ServerConf.ServerURL,
|
|
|
- "porterPort": "443",
|
|
|
- "porterToken": encoded,
|
|
|
- "privateRegistry": map[string]interface{}{
|
|
|
- "enabled": false,
|
|
|
- },
|
|
|
- "clusterID": fmt.Sprintf("%d", cluster.ID),
|
|
|
- "projectID": fmt.Sprintf("%d", proj.ID),
|
|
|
- },
|
|
|
- "loki": map[string]interface{}{
|
|
|
+ lokiValues := make(map[string]interface{})
|
|
|
+
|
|
|
+ // case on whether a node with porter.run/workload-kind=monitoring exists. If it does, we place loki in that node group.
|
|
|
+ if nodes, err := nodes.ListNodesByLabels(k8sAgent.Clientset, "porter.run/workload-kind=monitoring"); err == nil && len(nodes) >= 1 {
|
|
|
+ lokiValues = map[string]interface{}{
|
|
|
"nodeSelector": map[string]interface{}{
|
|
|
"porter.run/workload-kind": "monitoring",
|
|
|
},
|
|
|
@@ -120,7 +113,22 @@ func (c *InstallAgentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
|
|
"effect": "NoSchedule",
|
|
|
},
|
|
|
},
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ porterAgentValues := map[string]interface{}{
|
|
|
+ "agent": map[string]interface{}{
|
|
|
+ "image": "public.ecr.aws/o1j4x7p4/porter-agent:latest",
|
|
|
+ "porterHost": c.Config().ServerConf.ServerURL,
|
|
|
+ "porterPort": "443",
|
|
|
+ "porterToken": encoded,
|
|
|
+ "privateRegistry": map[string]interface{}{
|
|
|
+ "enabled": false,
|
|
|
+ },
|
|
|
+ "clusterID": fmt.Sprintf("%d", cluster.ID),
|
|
|
+ "projectID": fmt.Sprintf("%d", proj.ID),
|
|
|
},
|
|
|
+ "loki": lokiValues,
|
|
|
}
|
|
|
|
|
|
conf := &helm.InstallChartConfig{
|