diff --git a/.gitignore b/.gitignore index 01626b7..1af3ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ *.so *.dylib bin -adcs-issuer # Test binary, build with `go test -c` *.test diff --git a/charts/adcs-issuer/.helmignore b/charts/adcs-issuer/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/adcs-issuer/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/adcs-issuer/Chart.yaml b/charts/adcs-issuer/Chart.yaml new file mode 100644 index 0000000..24697db --- /dev/null +++ b/charts/adcs-issuer/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: adcs-issuer +description: ADCS issuser plugin for cert-manager +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 2.0.4 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "2.0.4" + diff --git a/charts/adcs-issuer/templates/_helpers.tpl b/charts/adcs-issuer/templates/_helpers.tpl new file mode 100644 index 0000000..7ba5edc --- /dev/null +++ b/charts/adcs-issuer/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chart.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "chart.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chart.labels" -}} +helm.sh/chart: {{ include "chart.chart" . }} +{{ include "chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/adcs-issuer/templates/adcsissuer-crd.yaml b/charts/adcs-issuer/templates/adcsissuer-crd.yaml new file mode 100644 index 0000000..8429050 --- /dev/null +++ b/charts/adcs-issuer/templates/adcsissuer-crd.yaml @@ -0,0 +1,87 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: adcsissuers.adcs.certmanager.csf.nokia.com + annotations: + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "chart.fullname" . }}- + controller-gen.kubebuilder.io/version: v0.7.0 + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + group: adcs.certmanager.csf.nokia.com + names: + kind: AdcsIssuer + listKind: AdcsIssuerList + plural: adcsissuers + singular: adcsissuer + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + description: AdcsIssuer is the Schema for the adcsissuers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: AdcsIssuerSpec defines the desired state of AdcsIssuer + properties: + caBundle: + description: CABundle is a PEM encoded TLS certifiate to use to verify + connections to the ADCS server. + format: byte + type: string + credentialsRef: + description: CredentialsRef is a reference to a Secret containing the + username and password for the ADCS server. The secret must contain + two keys, 'username' and 'password'. + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + retryInterval: + description: How often to retry in case of communication errors (in + time.ParseDuration() format) Default 1 hour. + type: string + statusCheckInterval: + description: How often to check for request status in the server (in + time.ParseDuration() format) Default 6 hours. + type: string + templateName: + description: Which ADCS Template should this issuer use Defaults to + the what is specified in main.go or as an cli option. + type: string + url: + description: URL is the base URL for the ADCS instance + type: string + required: + - credentialsRef + - url + type: object + status: + description: AdcsIssuerStatus defines the observed state of AdcsIssuer + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] \ No newline at end of file diff --git a/charts/adcs-issuer/templates/adcsrequest-crd.yaml b/charts/adcs-issuer/templates/adcsrequest-crd.yaml new file mode 100644 index 0000000..5c156c8 --- /dev/null +++ b/charts/adcs-issuer/templates/adcsrequest-crd.yaml @@ -0,0 +1,104 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: adcsrequests.adcs.certmanager.csf.nokia.com + annotations: + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "chart.fullname" . }}- + controller-gen.kubebuilder.io/version: v0.7.0 + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + group: adcs.certmanager.csf.nokia.com + names: + kind: AdcsRequest + listKind: AdcsRequestList + plural: adcsrequests + singular: adcsrequest + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.state + name: State + type: string + name: v1 + schema: + openAPIV3Schema: + description: AdcsRequest is the Schema for the adcsrequests API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: AdcsRequestSpec defines the desired state of AdcsRequest + properties: + csr: + description: Certificate signing request bytes in PEM encoding. This + will be used when finalizing the request. This field must be set on + the request. + format: byte + type: string + issuerRef: + description: IssuerRef references a properly configured AdcsIssuer which + should be used to serve this AdcsRequest. If the Issuer does not exist, + processing will be retried. If the Issuer is not an 'ADCS' Issuer, + an error will be returned and the ADCSRequest will be marked as failed. + properties: + group: + description: Group of the resource being referred to. + type: string + kind: + description: Kind of the resource being referred to. + type: string + name: + description: Name of the resource being referred to. + type: string + required: + - name + type: object + required: + - csr + - issuerRef + type: object + status: + description: AdcsRequestStatus defines the observed state of AdcsRequest + properties: + id: + description: ID of the Request assigned by the ADCS. This will initially + be empty when the resource is first created. The ADCSRequest controller + will populate this field when the Request is accepted by ADCS. This + field will be immutable after it is initially set. + type: string + reason: + description: Reason optionally provides more information about a why + the AdcsRequest is in the current state. + type: string + state: + description: State contains the current state of this ADCSRequest resource. + States 'ready' and 'rejected' are 'final' + enum: + - pending + - ready + - errored + - rejected + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] \ No newline at end of file diff --git a/charts/adcs-issuer/templates/cert-manager-controller-approve-dcs-certmanager-csf-nokia-com-rbac.yaml b/charts/adcs-issuer/templates/cert-manager-controller-approve-dcs-certmanager-csf-nokia-com-rbac.yaml new file mode 100644 index 0000000..8e8b1ec --- /dev/null +++ b/charts/adcs-issuer/templates/cert-manager-controller-approve-dcs-certmanager-csf-nokia-com-rbac.yaml @@ -0,0 +1,31 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "chart.fullname" . }}-cert-manager-controller-approve:adcs-certmanager-csf-nokia-com + labels: + {{- include "chart.labels" . | nindent 4 }} +rules: +- apiGroups: + - cert-manager.io + resourceNames: + - adcsissuers.adcs.certmanager.csf.nokia.com/* + - clusteradcsissuers.adcs.certmanager.csf.nokia.com/* + resources: + - signers + verbs: + - approve +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "chart.fullname" . }}-cert-manager-controller-approve:adcs-certmanager-csf-nokia-com + labels: + {{- include "chart.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: '{{ include "chart.fullname" . }}-cert-manager-controller-approve:adcs-certmanager-csf-nokia-com' +subjects: +- kind: ServiceAccount + name: '{{ include "chart.fullname" . }}-cert-manager' + namespace: '{{ .Release.Namespace }}' \ No newline at end of file diff --git a/charts/adcs-issuer/templates/clusteradcsissuer-crd.yaml b/charts/adcs-issuer/templates/clusteradcsissuer-crd.yaml new file mode 100644 index 0000000..16a3551 --- /dev/null +++ b/charts/adcs-issuer/templates/clusteradcsissuer-crd.yaml @@ -0,0 +1,87 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: clusteradcsissuers.adcs.certmanager.csf.nokia.com + annotations: + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "chart.fullname" . }}- + controller-gen.kubebuilder.io/version: v0.7.0 + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + group: adcs.certmanager.csf.nokia.com + names: + kind: ClusterAdcsIssuer + listKind: ClusterAdcsIssuerList + plural: clusteradcsissuers + singular: clusteradcsissuer + scope: Cluster + versions: + - name: v1 + schema: + openAPIV3Schema: + description: ClusterAdcsIssuer is the Schema for the clusteradcsissuers API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterAdcsIssuerSpec defines the desired state of ClusterAdcsIssuer + properties: + caBundle: + description: CABundle is a PEM encoded TLS certifiate to use to verify + connections to the ADCS server. + format: byte + type: string + credentialsRef: + description: CredentialsRef is a reference to a Secret containing the + username and password for the ADCS server. The secret must contain + two keys, 'username' and 'password'. + properties: + name: + description: Name of the referent. + type: string + required: + - name + type: object + retryInterval: + description: How often to retry in case of communication errors (in + time.ParseDuration() format) Default 1 hour. + type: string + statusCheckInterval: + description: How often to check for request status in the server (in + time.ParseDuration() format) Default 6 hours. + type: string + templateName: + description: Which ADCS Template should this issuer use Defaults to + the what is specified in main.go or as an cli option. + type: string + url: + description: URL is the base URL for the ADCS instance + type: string + required: + - credentialsRef + - url + type: object + status: + description: ClusterAdcsIssuerStatus defines the observed state of ClusterAdcsIssuer + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] \ No newline at end of file diff --git a/charts/adcs-issuer/templates/deployment.yaml b/charts/adcs-issuer/templates/deployment.yaml new file mode 100644 index 0000000..a91e123 --- /dev/null +++ b/charts/adcs-issuer/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chart.fullname" . }}-controller-manager + labels: + control-plane: controller-manager + {{- include "chart.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.controllerManager.replicas }} + selector: + matchLabels: + control-plane: controller-manager + {{- include "chart.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + control-plane: controller-manager + {{- include "chart.selectorLabels" . | nindent 8 }} + spec: + containers: + - args: + - --enable-leader-election + command: + - /manager + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ .Values.kubernetesClusterDomain }} + image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag + | default .Chart.AppVersion }} + name: manager + ports: + - containerPort: 9443 + name: webhook-server + protocol: TCP + resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10 + }} + volumeMounts: + - mountPath: /tmp/k8s-webhook-server/serving-certs + name: cert + readOnly: true + terminationGracePeriodSeconds: 10 + volumes: + - name: cert + secret: + defaultMode: 420 + secretName: webhook-server-cert \ No newline at end of file diff --git a/charts/adcs-issuer/templates/leader-election-rbac.yaml b/charts/adcs-issuer/templates/leader-election-rbac.yaml new file mode 100644 index 0000000..50fa582 --- /dev/null +++ b/charts/adcs-issuer/templates/leader-election-rbac.yaml @@ -0,0 +1,56 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "chart.fullname" . }}-leader-election-role + labels: + {{- include "chart.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - configmaps/status + verbs: + - get + - update + - patch +- apiGroups: + - "" + resources: + - events + verbs: + - create +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - update + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "chart.fullname" . }}-leader-election-rolebinding + labels: + {{- include "chart.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: '{{ include "chart.fullname" . }}-leader-election-role' +subjects: +- kind: ServiceAccount + name: default + namespace: '{{ .Release.Namespace }}' \ No newline at end of file diff --git a/charts/adcs-issuer/templates/manager-rbac.yaml b/charts/adcs-issuer/templates/manager-rbac.yaml new file mode 100644 index 0000000..138a0e9 --- /dev/null +++ b/charts/adcs-issuer/templates/manager-rbac.yaml @@ -0,0 +1,117 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "chart.fullname" . }}-manager-role + labels: + {{- include "chart.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - watch +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - adcsissuers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - adcsissuers/status + verbs: + - get + - patch + - update +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - adcsrequests + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - adcsrequests/status + verbs: + - get + - patch + - update +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - clusteradcsissuers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - adcs.certmanager.csf.nokia.com + resources: + - clusteradcsissuers/status + verbs: + - get + - patch + - update +- apiGroups: + - cert-manager.io + resources: + - certificaterequests + verbs: + - get + - list + - patch + - update + - watch +- apiGroups: + - cert-manager.io + resources: + - certificaterequests/finalizers + - certificaterequests/status + - certificates/finalizers + verbs: + - get + - patch + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "chart.fullname" . }}-manager-rolebinding + labels: + {{- include "chart.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: '{{ include "chart.fullname" . }}-manager-role' +subjects: +- kind: ServiceAccount + name: default + namespace: '{{ .Release.Namespace }}' \ No newline at end of file diff --git a/charts/adcs-issuer/templates/metrics-service.yaml b/charts/adcs-issuer/templates/metrics-service.yaml new file mode 100644 index 0000000..9fda9ee --- /dev/null +++ b/charts/adcs-issuer/templates/metrics-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chart.fullname" . }}-controller-manager-metrics-service + labels: + control-plane: controller-manager + {{- include "chart.labels" . | nindent 4 }} + annotations: + prometheus.io/port: "8443" + prometheus.io/scheme: https + prometheus.io/scrape: "true" +spec: + type: {{ .Values.metricsService.type }} + selector: + control-plane: controller-manager + {{- include "chart.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.metricsService.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/charts/adcs-issuer/templates/mutating-webhook-configuration.yaml b/charts/adcs-issuer/templates/mutating-webhook-configuration.yaml new file mode 100644 index 0000000..886dc5a --- /dev/null +++ b/charts/adcs-issuer/templates/mutating-webhook-configuration.yaml @@ -0,0 +1,49 @@ +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: {{ include "chart.fullname" . }}-mutating-webhook-configuration + annotations: + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "chart.fullname" . }}- + labels: + {{- include "chart.labels" . | nindent 4 }} +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: '{{ include "chart.fullname" . }}-webhook-service' + namespace: '{{ .Release.Namespace }}' + path: /mutate-adcs-certmanager-csf-nokia-com-v1-adcsissuer + failurePolicy: Fail + name: adcsissuer-mutation.adcs.certmanager.csf.nokia.com + rules: + - apiGroups: + - adcs.certmanager.csf.nokia.com + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - adcsissuer + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: '{{ include "chart.fullname" . }}-webhook-service' + namespace: '{{ .Release.Namespace }}' + path: /mutate-batch-certmanager-csf-nokia-com-v1-clusteradcsissuer + failurePolicy: Fail + name: mclusteradcsissuer.kb.io + rules: + - apiGroups: + - batch.certmanager.csf.nokia.com + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - clusteradcsissuers + sideEffects: None \ No newline at end of file diff --git a/charts/adcs-issuer/templates/proxy-rbac.yaml b/charts/adcs-issuer/templates/proxy-rbac.yaml new file mode 100644 index 0000000..fc3eea3 --- /dev/null +++ b/charts/adcs-issuer/templates/proxy-rbac.yaml @@ -0,0 +1,34 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "chart.fullname" . }}-proxy-role + labels: + {{- include "chart.labels" . | nindent 4 }} +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "chart.fullname" . }}-proxy-rolebinding + labels: + {{- include "chart.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: '{{ include "chart.fullname" . }}-proxy-role' +subjects: +- kind: ServiceAccount + name: default + namespace: '{{ .Release.Namespace }}' \ No newline at end of file diff --git a/charts/adcs-issuer/templates/serving-cert.yaml b/charts/adcs-issuer/templates/serving-cert.yaml new file mode 100644 index 0000000..45dc2ec --- /dev/null +++ b/charts/adcs-issuer/templates/serving-cert.yaml @@ -0,0 +1,15 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ include "chart.fullname" . }}-serving-cert + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + commonName: $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc + dnsNames: + - '{{ include "chart.fullname" . }}-$(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.{{ .Values.kubernetesClusterDomain + }}' + issuerRef: + kind: ClusterIssuer + name: selfsigned + secretName: webhook-server-cert \ No newline at end of file diff --git a/charts/adcs-issuer/templates/validating-webhook-configuration.yaml b/charts/adcs-issuer/templates/validating-webhook-configuration.yaml new file mode 100644 index 0000000..fb6af54 --- /dev/null +++ b/charts/adcs-issuer/templates/validating-webhook-configuration.yaml @@ -0,0 +1,49 @@ +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + name: {{ include "chart.fullname" . }}-validating-webhook-configuration + annotations: + cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "chart.fullname" . }}- + labels: + {{- include "chart.labels" . | nindent 4 }} +webhooks: +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: '{{ include "chart.fullname" . }}-webhook-service' + namespace: '{{ .Release.Namespace }}' + path: /validate-adcs-certmanager-csf-nokia-com-v1-adcsissuer + failurePolicy: Fail + name: adcsissuer-validation.adcs.certmanager.csf.nokia.com + rules: + - apiGroups: + - adcs.certmanager.csf.nokia.com + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - adcsissuer + sideEffects: None +- admissionReviewVersions: + - v1 + clientConfig: + service: + name: '{{ include "chart.fullname" . }}-webhook-service' + namespace: '{{ .Release.Namespace }}' + path: /validate-batch-certmanager-csf-nokia-com-v1-clusteradcsissuer + failurePolicy: Fail + name: vclusteradcsissuer.kb.io + rules: + - apiGroups: + - batch.certmanager.csf.nokia.com + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - clusteradcsissuers + sideEffects: None \ No newline at end of file diff --git a/charts/adcs-issuer/templates/webhook-service.yaml b/charts/adcs-issuer/templates/webhook-service.yaml new file mode 100644 index 0000000..82d3451 --- /dev/null +++ b/charts/adcs-issuer/templates/webhook-service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chart.fullname" . }}-webhook-service + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + type: {{ .Values.webhookService.type }} + selector: + control-plane: controller-manager + {{- include "chart.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.webhookService.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/charts/adcs-issuer/values.yaml b/charts/adcs-issuer/values.yaml new file mode 100644 index 0000000..d3a17ab --- /dev/null +++ b/charts/adcs-issuer/values.yaml @@ -0,0 +1,26 @@ +controllerManager: + manager: + image: + repository: djkormo/adcs-issuer + tag: latest + resources: + limits: + cpu: 100m + memory: 500Mi + requests: + cpu: 100m + memory: 100Mi + replicas: 1 +kubernetesClusterDomain: cluster.local +metricsService: + ports: + - name: https + port: 8443 + targetPort: https + type: ClusterIP +webhookService: + ports: + - port: 443 + targetPort: 9443 + type: ClusterIP +