This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from jfrog/add-cert-manager-certs
add cert-manager tls certs generation
- Loading branch information
Showing
15 changed files
with
291 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
apiVersion: v1 | ||
appVersion: "0.0.5" | ||
description: A Helm chart for Kubenab | ||
name: kubenab | ||
version: 0.2.1 | ||
version: 0.0.5 | ||
appVersion: 0.3.0 | ||
home: https://github.com/jfrog/kubenab | ||
description: Kubenab Helm chart | ||
keywords: | ||
- DevOps | ||
- devops | ||
- helm | ||
- kubernetes | ||
- docker | ||
home: https://github.com/kubenab/kubenab | ||
- jfrog | ||
- security | ||
sources: | ||
- https://github.com/kubenab/kubenab | ||
- https://github.com/jfrog/kubenab | ||
maintainers: | ||
- name: kubenab | ||
email: jainishshah@yahoo.com | ||
icon: https://raw.githubusercontent.com/kubenab/containerize-go-microservice/master/static/logo.jpg | ||
- name: rimusz | ||
email: rimasm@jfrog.com | ||
icon: https://raw.githubusercontent.com/jfrog/artifactory-dcos/master/images/jfrog_med.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range .Values.ingress.hosts }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} | ||
{{- if not .Values.docker.registryUrl }} | ||
|
||
############################################################# | ||
#### ERROR: You did not provide Private Registry RUL #### | ||
############################################################# | ||
|
||
All pods do not go to the running state if the instances | ||
settings were not provided. | ||
|
||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "kubenab.fullname" . }}) | ||
|
||
1. Get the application URL by running these commands: | ||
{{- if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kubenab.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get svc -w {{ template "kubenab.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "kubenab.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "kubenab.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kubenab.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- if .Values.mutatingWebhook.enabled -}} | ||
apiVersion: admissionregistration.k8s.io/v1beta1 | ||
kind: MutatingWebhookConfiguration | ||
metadata: | ||
name: {{ include "kubenab.fullname" . }}-mutate | ||
labels: | ||
app.kubernetes.io/name: {{ include "kubenab.name" . }} | ||
helm.sh/chart: {{ include "kubenab.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
annotations: | ||
certmanager.k8s.io/inject-ca-from: "{{ .Release.Namespace }}/{{ include "kubenab.servingCertificate" . }}" | ||
webhooks: | ||
- name: kubenab-mutate.k8s.io | ||
rules: | ||
- operations: [ "CREATE" ] | ||
apiGroups: [""] | ||
apiVersions: ["v1"] | ||
resources: ["pods"] | ||
failurePolicy: Ignore | ||
clientConfig: | ||
service: | ||
name: {{ include "kubenab.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
path: "/mutate" | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{{- if not .Values.tls.secretName -}} | ||
{{- if or .Values.mutatingWebhook.enabled .Values.validatingWebhook.enabled }} | ||
--- | ||
# Create a selfsigned Issuer, in order to create a root CA certificate for | ||
# signing kubenab serving certificates | ||
apiVersion: certmanager.k8s.io/v1alpha1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "kubenab.selfSignedIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "kubenab.name" . }} | ||
helm.sh/chart: {{ include "kubenab.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
selfSigned: {} | ||
|
||
--- | ||
|
||
# Generate a CA Certificate used to sign certificates for the kubenab | ||
apiVersion: certmanager.k8s.io/v1alpha1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "kubenab.rootCACertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "kubenab.name" . }} | ||
helm.sh/chart: {{ include "kubenab.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
secretName: {{ include "kubenab.rootCACertificate" . }} | ||
duration: 43800h # 5y | ||
issuerRef: | ||
name: {{ include "kubenab.selfSignedIssuer" . }} | ||
commonName: "ca.kubenab.kubenab" | ||
isCA: true | ||
|
||
--- | ||
|
||
# Create an Issuer that uses the above generated CA certificate to issue certs | ||
apiVersion: certmanager.k8s.io/v1alpha1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "kubenab.rootCAIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "kubenab.name" . }} | ||
helm.sh/chart: {{ include "kubenab.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
ca: | ||
secretName: {{ include "kubenab.rootCACertificate" . }} | ||
|
||
--- | ||
|
||
# Finally, generate a serving certificate for the kubenab to use | ||
apiVersion: certmanager.k8s.io/v1alpha1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "kubenab.servingCertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "kubenab.name" . }} | ||
helm.sh/chart: {{ include "kubenab.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
secretName: {{ include "kubenab.servingCertificate" . }} | ||
duration: 8760h # 1y | ||
issuerRef: | ||
name: {{ include "kubenab.rootCAIssuer" . }} | ||
dnsNames: | ||
- {{ include "kubenab.fullname" . }} | ||
- {{ include "kubenab.fullname" . }}.{{ .Release.Namespace }} | ||
- {{ include "kubenab.fullname" . }}.{{ .Release.Namespace }}.svc | ||
{{- end }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.