mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-13 08:02:40 +02:00
fix: pulumi - fix go's import paths
This commit is contained in:
@@ -1,15 +1,16 @@
|
|||||||
package monitoring
|
package monitoring
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "github.com/pulumi/pulumi-kubernetes/sdk/go/kubernetes/core/v1"
|
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
||||||
|
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
|
||||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewMonitoring(ctx *pulumi.Context, env string) error {
|
func NewMonitoring(ctx *pulumi.Context, env string) error {
|
||||||
// Create a Kubernetes Namespace
|
// Create a Kubernetes Namespace
|
||||||
namespaceName := "monitoring"
|
namespaceName := "monitoring"
|
||||||
namespace, err := v1.NewNamespace(ctx, namespaceName, &v1.NamespaceArgs{
|
namespace, err := corev1.NewNamespace(ctx, namespaceName, &corev1.NamespaceArgs{
|
||||||
Metadata: &v1.ObjectMetaArgs{
|
Metadata: &metav1.ObjectMetaArgs{
|
||||||
Name: pulumi.String(namespaceName),
|
Name: pulumi.String(namespaceName),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -20,7 +21,7 @@ func NewMonitoring(ctx *pulumi.Context, env string) error {
|
|||||||
// Export the name of the namespace
|
// Export the name of the namespace
|
||||||
ctx.Export("monitoringNamespaceName", namespace.Metadata.Name())
|
ctx.Export("monitoringNamespaceName", namespace.Metadata.Name())
|
||||||
|
|
||||||
if err := NewVictoriaMetrics(ctx, env); err != nil {
|
if err := NewVictoriaMetrics(ctx, env, namespace); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
package monitoring
|
package monitoring
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
||||||
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3"
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3"
|
||||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewVictoriaMetrics(ctx *pulumi.Context, env string) error {
|
func NewVictoriaMetrics(ctx *pulumi.Context, env string, namespace corev1.Namespace) error {
|
||||||
|
var opts []pulumi.ResourceOption
|
||||||
|
opts = append(opts, pulumi.DependsOn([]pulumi.Resource{namespace}))
|
||||||
|
|
||||||
// https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack
|
// https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack
|
||||||
_, err := helm.NewChart(ctx, "victoria-metrics-k8s-stack", helm.ChartArgs{
|
_, err := helm.NewChart(ctx, "victoria-metrics-k8s-stack", helm.ChartArgs{
|
||||||
Chart: pulumi.String("victoria-metrics-k8s-stack"),
|
Chart: pulumi.String("victoria-metrics-k8s-stack"),
|
||||||
Version: pulumi.String("0.19.0"),
|
Version: pulumi.String("0.19.0"),
|
||||||
Namespace: pulumi.String("monitoring"),
|
Namespace: pulumi.String(namespace.Metadata.Name()),
|
||||||
FetchArgs: helm.FetchArgs{
|
FetchArgs: helm.FetchArgs{
|
||||||
Repo: pulumi.String("https://victoriametrics.github.io/helm-charts/"),
|
Repo: pulumi.String("https://victoriametrics.github.io/helm-charts/"),
|
||||||
},
|
},
|
||||||
@@ -76,6 +80,6 @@ func NewVictoriaMetrics(ctx *pulumi.Context, env string) error {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}, opts...)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
package networking
|
package networking
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
||||||
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3"
|
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3"
|
||||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewCertManager(ctx *pulumi.Context, env string) error {
|
func NewCertManager(ctx *pulumi.Context, env string, namespace corev1.Namespace) error {
|
||||||
|
var opts []pulumi.ResourceOption
|
||||||
|
opts = append(opts, pulumi.DependsOn([]pulumi.Resource{namespace}))
|
||||||
|
|
||||||
_, err := helm.NewChart(ctx, "cert-manager", helm.ChartArgs{
|
_, err := helm.NewChart(ctx, "cert-manager", helm.ChartArgs{
|
||||||
Chart: pulumi.String("cert-manager"),
|
Chart: pulumi.String("cert-manager"),
|
||||||
Version: pulumi.String("v1.14.2 "),
|
Version: pulumi.String("corev1.14.2 "),
|
||||||
Namespace: pulumi.String("cert-manager"),
|
Namespace: pulumi.String(namespace.Metadata.Name()),
|
||||||
FetchArgs: helm.FetchArgs{
|
FetchArgs: helm.FetchArgs{
|
||||||
Repo: pulumi.String("https://charts.jetstack.io"),
|
Repo: pulumi.String("https://charts.jetstack.io"),
|
||||||
},
|
},
|
||||||
// https://cert-manager.io/docs/installation/helm/
|
// https://cert-manager.io/docs/installation/helm/
|
||||||
Values: pulumi.Map{},
|
Values: pulumi.Map{},
|
||||||
})
|
}, opts...)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
package networking
|
package networking
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "github.com/pulumi/pulumi-kubernetes/sdk/go/kubernetes/core/v1"
|
corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
|
||||||
|
metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
|
||||||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewNetworking(ctx *pulumi.Context, env string) error {
|
func NewNetworking(ctx *pulumi.Context, env string) error {
|
||||||
// Create a Kubernetes Namespace
|
// Create a Kubernetes Namespace
|
||||||
namespaceName := "networking"
|
namespaceName := "networking"
|
||||||
namespace, err := v1.NewNamespace(ctx, namespaceName, &v1.NamespaceArgs{
|
namespace, err := corev1.NewNamespace(ctx, namespaceName, &corev1.NamespaceArgs{
|
||||||
Metadata: &v1.ObjectMetaArgs{
|
Metadata: &metav1.ObjectMetaArgs{
|
||||||
Name: pulumi.String(namespaceName),
|
Name: pulumi.String(namespaceName),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -20,7 +21,7 @@ func NewNetworking(ctx *pulumi.Context, env string) error {
|
|||||||
// Export the name of the namespace
|
// Export the name of the namespace
|
||||||
ctx.Export("networkingNamespaceName", namespace.Metadata.Name())
|
ctx.Export("networkingNamespaceName", namespace.Metadata.Name())
|
||||||
|
|
||||||
if err := NewCertManager(ctx, env); err != nil {
|
if err := NewCertManager(ctx, env, namespace); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user