From 94b8d282f81ef96026e4f00cfb12e9f3711b1d17 Mon Sep 17 00:00:00 2001 From: Ferenc HERNADI Date: Fri, 6 Dec 2019 17:11:45 +0100 Subject: [PATCH] - Helm3 suppport (#281) * - Helm3 suppport --- Makefile | 2 +- charts/logging-operator/README.md | 6 +++++- .../logging.banzaicloud.io_clusterflows.yaml | 0 .../logging.banzaicloud.io_clusteroutputs.yaml | 0 .../{templates => crds}/logging.banzaicloud.io_flows.yaml | 0 .../logging.banzaicloud.io_loggings.yaml | 0 .../{templates => crds}/logging.banzaicloud.io_outputs.yaml | 0 charts/logging-operator/templates/crds.yaml | 6 ++++++ charts/logging-operator/values.yaml | 4 ++++ 9 files changed, 16 insertions(+), 2 deletions(-) rename charts/logging-operator/{templates => crds}/logging.banzaicloud.io_clusterflows.yaml (100%) rename charts/logging-operator/{templates => crds}/logging.banzaicloud.io_clusteroutputs.yaml (100%) rename charts/logging-operator/{templates => crds}/logging.banzaicloud.io_flows.yaml (100%) rename charts/logging-operator/{templates => crds}/logging.banzaicloud.io_loggings.yaml (100%) rename charts/logging-operator/{templates => crds}/logging.banzaicloud.io_outputs.yaml (100%) create mode 100644 charts/logging-operator/templates/crds.yaml diff --git a/Makefile b/Makefile index 0678b593e..dac654d7a 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ deploy: manifests # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen cd pkg/sdk && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=../../config/crd/bases output:webhook:artifacts:config=../../config/webhook - cp config/crd/bases/* charts/logging-operator/templates/ + cp config/crd/bases/* charts/logging-operator/crds/ # Run go fmt against code fmt: diff --git a/charts/logging-operator/README.md b/charts/logging-operator/README.md index 7fcddb06c..d4eb6d676 100644 --- a/charts/logging-operator/README.md +++ b/charts/logging-operator/README.md @@ -26,6 +26,9 @@ To install the chart with the release name `my-release`: $ helm install --name my-release banzaicloud-stable/logging-operator ``` +### CRDs +Use `createCustomResource=false` with Helm v3 to avoid trying to create CRDs from the `crds` folder and from templates at the same time. + The command deploys **logging-operator** on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. ## Uninstalling the Chart @@ -58,7 +61,8 @@ The following tables lists the configurable parameters of the logging-operator c | `nodeSelector` | Define which Nodes the Pods are scheduled on. | `{}` | | `annotations` | Define annotations for logging-operator pods | `{}` | | `podSecurityContext` | Pod SecurityContext for Logging operator. [More info](https://kubernetes.io/docs/concepts/policy/security-context/) | `{"runAsNonRoot": true, "runAsUser": 1000, "fsGroup": 2000}` | -| `securityContext` | Container SecurityContext for Logging operator. [More info](https://kubernetes.io/docs/concepts/policy/security-context/) | `{"allowPrivilegeEscalation": false, "readOnlyRootFilesystem": true}` | +| `securityContext` | Container SecurityContext for Logging operator. [More info](https://kubernetes.io/docs/concepts/policy/security-context/) | `{"allowPrivilegeEscalation": false, "readOnlyRootFilesystem": true}` | +| `createCustomResource` | Create CRDs. | `true` | Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example: diff --git a/charts/logging-operator/templates/logging.banzaicloud.io_clusterflows.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_clusterflows.yaml similarity index 100% rename from charts/logging-operator/templates/logging.banzaicloud.io_clusterflows.yaml rename to charts/logging-operator/crds/logging.banzaicloud.io_clusterflows.yaml diff --git a/charts/logging-operator/templates/logging.banzaicloud.io_clusteroutputs.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_clusteroutputs.yaml similarity index 100% rename from charts/logging-operator/templates/logging.banzaicloud.io_clusteroutputs.yaml rename to charts/logging-operator/crds/logging.banzaicloud.io_clusteroutputs.yaml diff --git a/charts/logging-operator/templates/logging.banzaicloud.io_flows.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_flows.yaml similarity index 100% rename from charts/logging-operator/templates/logging.banzaicloud.io_flows.yaml rename to charts/logging-operator/crds/logging.banzaicloud.io_flows.yaml diff --git a/charts/logging-operator/templates/logging.banzaicloud.io_loggings.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml similarity index 100% rename from charts/logging-operator/templates/logging.banzaicloud.io_loggings.yaml rename to charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml diff --git a/charts/logging-operator/templates/logging.banzaicloud.io_outputs.yaml b/charts/logging-operator/crds/logging.banzaicloud.io_outputs.yaml similarity index 100% rename from charts/logging-operator/templates/logging.banzaicloud.io_outputs.yaml rename to charts/logging-operator/crds/logging.banzaicloud.io_outputs.yaml diff --git a/charts/logging-operator/templates/crds.yaml b/charts/logging-operator/templates/crds.yaml new file mode 100644 index 000000000..f573652d0 --- /dev/null +++ b/charts/logging-operator/templates/crds.yaml @@ -0,0 +1,6 @@ +{{- if .Values.createCustomResource -}} +{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }} +{{ $.Files.Get $path }} +--- +{{- end }} +{{- end }} diff --git a/charts/logging-operator/values.yaml b/charts/logging-operator/values.yaml index c846dee7d..92358c64c 100644 --- a/charts/logging-operator/values.yaml +++ b/charts/logging-operator/values.yaml @@ -13,6 +13,10 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +## Deploy CRDs used by Logging Operator. +## +createCustomResource: true + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little