Skip to content

Commit

Permalink
use local ca issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianliechti committed Sep 18, 2022
1 parent 24000c1 commit 75e7810
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 2 additions & 0 deletions app/cluster/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func CreateCommand() *cli.Command {
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
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

0 comments on commit 75e7810

Please sign in to comment.