Skip to content

Commit

Permalink
[119] Add CRD autocopy from kustomize to helm (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenmarten committed Apr 9, 2024
1 parent fdca0b9 commit 39e8d17
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ repos:
entry: sh -c "make helm-docs-run"
language: system
require_serial: true
- id: make-helm-crd-copy
name: make-helm-crd-copy
entry: sh -c "make helm-crd-copy"
language: system
require_serial: true
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ helm-schema-run: helm-schema ## Run helm schema over chart
helm-docs-run: helm-docs ## Run helm schema over chart
$(HELM_DOCS)

.PHONY: helm-crd-copy
helm-crd-copy: yq kustomize ## Copy CRDs from kustomize to helm-chart
@$(eval TMP := $(shell mktemp -d))
@$(KUSTOMIZE) build config/default > $(TMP)/manifest.yaml && cd $(TMP) && $(YQ) -s '.kind + "-" + .metadata.name' --no-doc manifest.yaml && cd $(OLDPWD)
@mv $(TMP)/CustomResourceDefinition-etcdclusters.etcd.aenix.io charts/etcd-operator/crds/etcd-cluster.yaml
@rm -rf $(TMP)

##@ Build

.PHONY: build
Expand Down Expand Up @@ -211,6 +218,7 @@ GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
KIND ?= $(LOCALBIN)/kind
HELM ?= $(LOCALBIN)/helm
HELM_DOCS ?= $(LOCALBIN)/helm-docs
YQ = $(LOCALBIN)/yq

## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
Expand All @@ -221,6 +229,7 @@ KIND_VERSION ?= v0.22.0
HELM_VERSION ?= v3.14.3
HELM_SCHEMA_VERSION ?= v1.2.2
HELM_DOCS_VERSION ?= v1.13.1
YQ_VERSION ?= v4.42.1

## Tool install scripts
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
Expand Down Expand Up @@ -271,3 +280,8 @@ helm-schema: helm $(HELM_PLUGINS)
helm-docs: $(LOCALBIN)
@test -x $(HELM_DOCS) && $(HELM_DOCS) version | grep -q $(HELM_DOCS_VERSION) || \
GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION)

.PHONY: yq
yq: $(LOCALBIN)
@test -x $(YQ) && $(YQ) version | grep -q $(YQ_VERSION) || \
GOBIN=$(LOCALBIN) go install github.com/mikefarah/yq/v4@$(YQ_VERSION)
20 changes: 17 additions & 3 deletions charts/etcd-operator/crds/etcd-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2283,9 +2283,6 @@ spec:
- name
type: object
type: array
image:
description: Image is the etcd container image name
type: string
imagePullSecrets:
description: |-
ImagePullSecrets An optional list of references to secrets in the same namespace
Expand Down Expand Up @@ -2313,6 +2310,20 @@ spec:
priorityClassName:
description: PriorityClassName is the name of the PriorityClass for this pod.
type: string
readinessGates:
description: |-
ReadinessGates is an optional list of conditions that must be true for the pod to be considered ready for
traffic. A pod is considered ready when all of its containers are ready.
items:
description: PodReadinessGate contains the reference to a pod condition
properties:
conditionType:
description: ConditionType refers to a condition in the pod's condition list with matching type.
type: string
required:
- conditionType
type: object
type: array
runtimeClassName:
description: RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod.
type: string
Expand Down Expand Up @@ -2488,6 +2499,9 @@ spec:
type: string
type: object
type: object
serviceAccountName:
description: ServiceAccountName is the name of the ServiceAccount to use to run the etcd pods.
type: string
terminationGracePeriodSeconds:
description: TerminationGracePeriodSeconds is the time to wait before forceful pod shutdown.
format: int64
Expand Down

0 comments on commit 39e8d17

Please sign in to comment.