Skip to content

Commit

Permalink
fix(Makefile) Set kustomize build reoder legacy
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
  • Loading branch information
sguyennet authored and holyhope committed Sep 14, 2020
1 parent a7f0e6f commit 5aea757
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 91 deletions.
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ DO_NOT_EDIT := Code generated by make. DO NOT EDIT.
$(CHART_CRDS_PATH)/$(CRD_GROUP)_%.yaml: kustomize config/crd/bases $(wildcard config/crd/*) $(wildcard config/helm/crds/*) $(wildcard config/crd/patches/*)
mkdir -p $(CHART_CRDS_PATH)
echo '# $(DO_NOT_EDIT)' > $(CHART_CRDS_PATH)/$*.yaml
$(KUSTOMIZE) build config/helm/crds | \
$(KUSTOMIZE) build --reorder legacy config/helm/crds | \
$(KUSTOMIZE) cfg grep --annotate=false 'metadata.name=$*\.$(subst .,\.,$(CRD_GROUP))' \
>> $(CHART_CRDS_PATH)/$*.yaml

.PHONY: $(CHART_TESTS_PATH)/test.yaml
$(CHART_TESTS_PATH)/test.yaml: kustomize config/tests/postgresql/helm.yaml $(wildcard config/helm/tests/*) $(wildcard config/samples/harbor-full/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TESTS_PATH)/test.yaml
$(KUSTOMIZE) build 'config/helm/tests' \
$(KUSTOMIZE) build --reorder legacy 'config/helm/tests' \
>> $(CHART_TESTS_PATH)/test.yaml

.PHONY: config/tests/postgresql/helm.yaml
Expand All @@ -269,7 +269,7 @@ config/tests/postgresql/helm.yaml: helm
$(CHART_TEMPLATE_PATH)/role.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/role.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/role.yaml
$(KUSTOMIZE) build config/helm/rbac | \
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=Role' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRole' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=RoleBinding' \
Expand All @@ -279,7 +279,7 @@ $(CHART_TEMPLATE_PATH)/role.yaml: kustomize config/rbac $(wildcard config/helm/r
$(CHART_TEMPLATE_PATH)/clusterrole.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/clusterrole.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrole.yaml
$(KUSTOMIZE) build config/helm/rbac | \
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRole' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' \
>> $(CHART_TEMPLATE_PATH)/clusterrole.yaml
Expand All @@ -288,7 +288,7 @@ $(CHART_TEMPLATE_PATH)/clusterrole.yaml: kustomize config/rbac $(wildcard config
$(CHART_TEMPLATE_PATH)/rolebinding.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/rolebinding.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/rolebinding.yaml
$(KUSTOMIZE) build config/helm/rbac | \
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=RoleBinding' | \
$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' \
>> $(CHART_TEMPLATE_PATH)/rolebinding.yaml
Expand All @@ -297,35 +297,35 @@ $(CHART_TEMPLATE_PATH)/rolebinding.yaml: kustomize config/rbac $(wildcard config
$(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
echo '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
$(KUSTOMIZE) build config/helm/rbac | \
$(KUSTOMIZE) build --reorder legacy config/helm/rbac | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRoleBinding' \
>> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml
echo '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml


$(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml: kustomize config/webhook $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml
$(KUSTOMIZE) build config/helm/webhook | \
$(KUSTOMIZE) build --reorder legacy config/helm/webhook | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=ValidatingWebhookConfiguration' | \
sed "s/'\({{.*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml

$(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml: kustomize config/webhook $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml
$(KUSTOMIZE) build config/helm/webhook | \
$(KUSTOMIZE) build --reorder legacy config/helm/webhook | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=MutatingWebhookConfiguration' | \
sed "s/'\({{.*}}\)'/\1/g" \
>> $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml

$(CHART_TEMPLATE_PATH)/certificate.yaml: kustomize config/certmanager $(wildcard config/helm/certmanager/*) $(wildcard config/certmanager/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/certificate.yaml
$(KUSTOMIZE) build config/helm/certificate | \
$(KUSTOMIZE) build --reorder legacy config/helm/certificate | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=Certificate' \
>> $(CHART_TEMPLATE_PATH)/certificate.yaml

$(CHART_TEMPLATE_PATH)/issuer.yaml: kustomize config/certmanager $(wildcard config/helm/certmanager/*) $(wildcard config/certmanager/*)
echo '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/issuer.yaml
$(KUSTOMIZE) build config/helm/certificate | \
$(KUSTOMIZE) build --reorder legacy config/helm/certificate | \
$(KUSTOMIZE) cfg grep --annotate=false 'kind=Issuer' \
>> $(CHART_TEMPLATE_PATH)/issuer.yaml

Expand Down Expand Up @@ -369,15 +369,15 @@ go-generate: controller-gen stringer
# Deploy RBAC in the configured Kubernetes cluster in ~/.kube/config
.PHONY: deploy-rbac
deploy-rbac: go-generate kustomize
$(KUSTOMIZE) build config/rbac \
$(KUSTOMIZE) build --reorder legacy config/rbac \
| kubectl apply --validate=false -f -

.PHONY: sample
sample: sample-harbor

.PHONY: sample-database
sample-database: kustomize
$(KUSTOMIZE) build 'config/samples/database' \
$(KUSTOMIZE) build --reorder legacy 'config/samples/database' \
| kubectl apply -f -

.PHONY: sample-github-secret
Expand All @@ -394,7 +394,7 @@ sample-github-secret:

.PHONY: sample-%
sample-%: kustomize postgresql sample-github-secret
$(KUSTOMIZE) build 'config/samples/$*' \
$(KUSTOMIZE) build --reorder legacy 'config/samples/$*' \
| kubectl apply -f -
kubectl get goharbor

Expand Down
80 changes: 2 additions & 78 deletions charts/harbor-operator/templates/tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ metadata:
app.kubernetes.io/managed-by: ""
helm.sh/chart: ""
helm.sh/hook: test
name: '{{ include "chart.fullname" . }}-test-postgresql'
name: '{{ include "chart.fullname" . }}-test-postgresql-67tt569477'
type: Opaque
---
apiVersion: v1
Expand Down Expand Up @@ -223,7 +223,7 @@ spec:
valueFrom:
secretKeyRef:
key: postgresql-password
name: '{{ include "chart.fullname" . }}-test-postgresql'
name: '{{ include "chart.fullname" . }}-test-postgresql-67tt569477'
- name: POSTGRESQL_ENABLE_LDAP
value: "no"
- name: POSTGRESQL_ENABLE_TLS
Expand Down Expand Up @@ -431,79 +431,3 @@ spec:
claimName: '{{ include "chart.fullname" . }}-sample-harbor-trivy-cache'
reportsPersistentVolume:
claimName: '{{ include "chart.fullname" . }}-sample-harbor-trivy-reports'
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
app.kubernetes.io/instance: ""
app.kubernetes.io/managed-by: ""
helm.sh/chart: ""
helm.sh/hook: test
labels:
sample: "true"
name: '{{ include "chart.fullname" . }}-sample-harbor-chart'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
app.kubernetes.io/instance: ""
app.kubernetes.io/managed-by: ""
helm.sh/chart: ""
helm.sh/hook: test
labels:
sample: "true"
name: '{{ include "chart.fullname" . }}-sample-harbor-registry'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
app.kubernetes.io/instance: ""
app.kubernetes.io/managed-by: ""
helm.sh/chart: ""
helm.sh/hook: test
labels:
sample: "true"
name: '{{ include "chart.fullname" . }}-sample-harbor-trivy-cache'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
app.kubernetes.io/instance: ""
app.kubernetes.io/managed-by: ""
helm.sh/chart: ""
helm.sh/hook: test
labels:
sample: "true"
name: '{{ include "chart.fullname" . }}-sample-harbor-trivy-reports'
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
volumeMode: Filesystem

0 comments on commit 5aea757

Please sign in to comment.