Skip to content

Commit

Permalink
Merge pull request #462 from kube-tarian/kadIssuefix
Browse files Browse the repository at this point in the history
Fixed namespace issue
  • Loading branch information
share2kanna authored Apr 16, 2024
2 parents b9f2caf + 6fc9025 commit 6d9b0ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions capten/deployment-worker/internal/captensdk/mtls_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (m *MTLSClient) CreateCertificates(certName, namespace, issuerRefName, cmNa
return err
}

err = k8sClient.CreateNamespace(context.Background(), namespace)
if err != nil {
return fmt.Errorf("failed to create namespace: %v", err)
}

// Create cert-manager certificate for client and server
for _, isClient := range []bool{true, false} {
err = m.generateCertificate(cmClient, namespace, certName, issuerRefName, isClient)
Expand All @@ -50,6 +55,7 @@ func (m *MTLSClient) CreateCertificates(certName, namespace, issuerRefName, cmNa
}

func (m *MTLSClient) generateCertificate(cmClient *cmclient.Clientset, namespace string, certName string, issuerRefName string, isClient bool) error {

var usages []v1.KeyUsage
if isClient {
usages = []v1.KeyUsage{v1.UsageDigitalSignature, v1.UsageKeyEncipherment, v1.UsageClientAuth}
Expand Down

0 comments on commit 6d9b0ee

Please sign in to comment.