Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/adrianliechti/devkube into …
Browse files Browse the repository at this point in the history
…feature/registry
  • Loading branch information
adrianliechti committed Sep 23, 2022
2 parents 1548ac2 + 9b8ac7b commit 74cdb0e
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 157 deletions.
6 changes: 4 additions & 2 deletions app/cluster/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cluster

import (
"os"
"path"
"path/filepath"

"github.com/adrianliechti/devkube/app"
"github.com/adrianliechti/devkube/pkg/cli"
Expand Down Expand Up @@ -55,12 +55,14 @@ func CreateCommand() *cli.Command {

defer os.RemoveAll(dir)

kubeconfig := path.Join(dir, "kubeconfig")
kubeconfig := filepath.Join(dir, "kubeconfig")

if err := provider.Create(c.Context, cluster, kubeconfig); err != nil {
return err
}

kubectl.Invoke(c.Context, []string{"create", "namespace", DefaultNamespace}, kubectl.WithKubeconfig(kubeconfig))

if err := observability.InstallCRD(c.Context, kubeconfig, DefaultNamespace); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions app/flag_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"errors"
"os"
"path"
"path/filepath"
"strings"

"github.com/adrianliechti/devkube/pkg/cli"
Expand Down Expand Up @@ -150,7 +150,7 @@ func MustClusterKubeconfig(c *cli.Context, provider provider.Provider, name stri
os.RemoveAll(dir)
}

path := path.Join(dir, "kubeconfig")
path := filepath.Join(dir, "kubeconfig")

if err := provider.Export(c.Context, name, path); err != nil {
closer()
Expand Down
24 changes: 10 additions & 14 deletions extension/certmanager/certmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
)

const (
certmanagerRepo = "https://charts.jetstack.io"
certmanagerNamespace1 = "cert-manager"
certmanagerRepo = "https://charts.jetstack.io"
certmanagerNamespace = "cert-manager"

certmanager = "cert-manager"
certmanagerChart = "cert-manager"
Expand All @@ -28,11 +28,9 @@ var (
)

func Install(ctx context.Context, kubeconfig, namespace string) error {
// if namespace == "" {
// namespace = "default"
// }

namespace = certmanagerNamespace1
if namespace == "" {
namespace = "default"
}

client, err := kubernetes.NewFromConfig(kubeconfig)

Expand Down Expand Up @@ -63,7 +61,7 @@ func Install(ctx context.Context, kubeconfig, namespace string) error {
}
}

if err := helm.Install(ctx, certmanager, certmanagerRepo, certmanagerChart, certmanagerVersion, values, helm.WithKubeconfig(kubeconfig), helm.WithNamespace(namespace), helm.WithWait(true), helm.WithDefaultOutput()); err != nil {
if err := helm.Install(ctx, certmanager, certmanagerRepo, certmanagerChart, certmanagerVersion, values, helm.WithKubeconfig(kubeconfig), helm.WithNamespace(certmanagerNamespace), helm.WithWait(true), helm.WithDefaultOutput()); err != nil {
return err
}

Expand All @@ -75,17 +73,15 @@ func Install(ctx context.Context, kubeconfig, namespace string) error {
}

func Uninstall(ctx context.Context, kubeconfig, namespace string) error {
// if namespace == "" {
// namespace = "default"
// }

namespace = certmanagerNamespace1
if namespace == "" {
namespace = "default"
}

if err := kubectl.Invoke(ctx, []string{"delete", "-f", "-"}, kubectl.WithKubeconfig(kubeconfig), kubectl.WithNamespace(namespace), kubectl.WithInput(strings.NewReader(manifest)), kubectl.WithDefaultOutput()); err != nil {
// return err
}

if err := helm.Uninstall(ctx, certmanager, helm.WithKubeconfig(kubeconfig), helm.WithNamespace(namespace)); err != nil {
if err := helm.Uninstall(ctx, certmanager, helm.WithKubeconfig(kubeconfig), helm.WithNamespace(certmanagerNamespace)); err != nil {
//return err
}

Expand Down
6 changes: 3 additions & 3 deletions extension/certmanager/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
kind: Issuer
metadata:
name: selfsigned
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
kind: Issuer
metadata:
name: platform
spec:
Expand All @@ -27,7 +27,7 @@ spec:
size: 256
issuerRef:
name: selfsigned
kind: ClusterIssuer
kind: Issuer
group: cert-manager.io
---
apiVersion: apps/v1
Expand Down
2 changes: 1 addition & 1 deletion extension/falco/falco.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
const (
falco = "falco"
falcoChart = "falco"
falcoVersion = "2.0.17"
falcoVersion = "2.0.18"

exporter = "falco-exporter"
exporterChart = "falco-exporter"
Expand Down
2 changes: 1 addition & 1 deletion extension/observability/observability_grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
const (
grafana = "grafana"
grafanaChart = "grafana"
grafanaVersion = "6.37.3"
grafanaVersion = "6.38.6"
)

func installGrafana(ctx context.Context, kubeconfig, namespace string) error {
Expand Down
50 changes: 32 additions & 18 deletions extension/observability/observability_loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,48 @@ import (
const (
loki = "loki"
lokiChart = "loki"
lokiVersion = "2.16.0"
lokiVersion = "3.1.0"
)

func installLoki(ctx context.Context, kubeconfig, namespace string) error {
values := map[string]any{
"rbac": map[string]any{
"pspEnabled": false,
"loki": map[string]any{
"commonConfig": map[string]any{
"replication_factor": 1,
},

"auth_enabled": false,

"storage": map[string]any{
"type": "filesystem",
},
},

"persistence": map[string]any{
"enabled": true,
"size": "10Gi",
"singleBinary": map[string]any{
"persistence": map[string]any{
"size": "10Gi",
},
},

"ruler": map[string]any{
"storage": map[string]any{
"type": "local",
"local": map[string]any{
"directory": "/rules",
"gateway": map[string]any{
"enabled": false,
},

"monitoring": map[string]any{
"serviceMonitor": map[string]any{
"enabled": true,
},

"selfMonitoring": map[string]any{
"enabled": false,

"lokiCanary": map[string]any{
"enabled": false,
},
"rule_path": "/tmp/scratch",
"alertmanager_url": "http://" + prometheus + "-alertmanager:9093",
"ring": map[string]any{
"kvstore": map[string]any{
"store": "inmemory",
},

"grafanaAgent": map[string]any{
"installOperator": false,
},
"enable_api": true,
},
},
}
Expand Down
26 changes: 22 additions & 4 deletions extension/observability/observability_prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
const (
prometheus = "monitoring"
prometheusChart = "kube-prometheus-stack"
prometheusVersion = "39.12.0"
prometheusVersion = "40.1.1"
)

func installPrometheus(ctx context.Context, kubeconfig, namespace string) error {
Expand All @@ -20,10 +20,28 @@ func installPrometheus(ctx context.Context, kubeconfig, namespace string) error

"cleanPrometheusOperatorObjectNames": true,

"coreDns": map[string]any{
"enabled": false,
},

"kubeDns": map[string]any{
"enabled": false,
},

"kubeEtcd": map[string]any{
"service": map[string]any{
"targetPort": 2381,
},
"enabled": false,
},

"kubeScheduler": map[string]any{
"enabled": false,
},

"kubeProxy": map[string]any{
"enabled": false,
},

"kubeControllerManager": map[string]any{
"enabled": false,
},

"grafana": map[string]any{
Expand Down
2 changes: 1 addition & 1 deletion extension/observability/observability_tempo.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
const (
tempo = "tempo"
tempoChart = "tempo"
tempoVersion = "0.16.1"
tempoVersion = "0.16.2"
)

func installTempo(ctx context.Context, kubeconfig, namespace string) error {
Expand Down
2 changes: 1 addition & 1 deletion extension/trivy/trivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (

trivy = "trivy"
trivyChart = "trivy-operator"
trivyVersion = "0.1.9"
trivyVersion = "0.2.1"
)

func Install(ctx context.Context, kubeconfig, namespace string) error {
Expand Down
40 changes: 20 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
module github.com/adrianliechti/devkube

go 1.18
go 1.19

require (
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0
github.com/Masterminds/semver v1.5.0
github.com/digitalocean/godo v1.83.0
github.com/linode/linodego v1.9.1
github.com/digitalocean/godo v1.85.0
github.com/linode/linodego v1.9.2
github.com/manifoldco/promptui v0.9.0
github.com/olekukonko/tablewriter v0.0.5
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/urfave/cli/v2 v2.11.2
github.com/urfave/cli/v2 v2.16.3
github.com/vultr/govultr/v2 v2.17.2
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/client-go v0.25.0
sigs.k8s.io/kind v0.14.0
k8s.io/api v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/client-go v0.25.2
sigs.k8s.io/kind v0.16.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.3 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.6.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect
github.com/BurntSushi/toml v1.2.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/chzyer/readline v1.5.1 // indirect
Expand Down Expand Up @@ -54,32 +54,32 @@ require (
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.3.4 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/cobra v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 // indirect
golang.org/x/net v0.0.0-20220921203646-d300de134e69 // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 // indirect
k8s.io/utils v0.0.0-20220922133306-665eaaec4324 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down
Loading

0 comments on commit 74cdb0e

Please sign in to comment.