Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
feat(reconciler): Move crd install, upgrade and management from Helm …
Browse files Browse the repository at this point in the history
…to OSM

Move the crd install, upgrade and management from helm to osm-bootstrap.
This will help OSM manage the crd entirely.

Part of #4065

Signed-off-by: Sneha Chhabria <[email protected]>
  • Loading branch information
snehachhabria committed Sep 9, 2021
1 parent 7a4366b commit 924155d
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 156 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ build-osm-injector: clean-osm-injector

.PHONY: build-osm-crds
build-osm-crds: clean-osm-crds
cp -R ./charts/osm/crds ./bin/osm-crds
cp -R ./cmd/osm-bootstrap/crds ./bin/osm-crds

.PHONY: build-osm-bootstrap
build-osm-bootstrap: clean-osm-bootstrap
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./bin/osm-bootstrap/osm-bootstrap -ldflags "-X $(BUILD_DATE_VAR)=$(BUILD_DATE) -X $(BUILD_VERSION_VAR)=$(VERSION) -X $(BUILD_GITCOMMIT_VAR)=$(GIT_SHA) -s -w" ./cmd/osm-bootstrap
cp -R ./cmd/osm-bootstrap/crds ./bin/osm-crds

.PHONY: build-osm
build-osm: cmd/cli/chart.tgz
Expand Down
17 changes: 7 additions & 10 deletions charts/osm/templates/cleanup-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,19 @@ spec:
restartPolicy: Never
containers:
- name: garbage-collector
image: bitnami/kubectl
imagePullPolicy: IfNotPresent
image: "{{ .Values.OpenServiceMesh.image.registry }}/osm-crds:{{ .Values.OpenServiceMesh.image.tag }}"
imagePullPolicy: {{ .Values.OpenServiceMesh.image.pullPolicy }}
command:
- sh
- -c
- >
kubectl delete --ignore-not-found meshconfig -n '{{ include "osm.namespace" . }}' osm-mesh-config;
kubectl patch crd/meshconfigs.config.openservicemesh.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/traffictargets.access.smi-spec.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/httproutegroups.specs.smi-spec.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/multiclusterservices.config.openservicemesh.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/egresses.policy.openservicemesh.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/ingressbackends.policy.openservicemesh.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/trafficsplits.split.smi-spec.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl patch crd/tcproutes.specs.smi-spec.io -p '{"spec":{"conversion":{"strategy":"None", "webhook":null}}}' --type=merge;
kubectl apply -f /osm-crds;
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
{{- if .Values.OpenServiceMesh.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.OpenServiceMesh.imagePullSecrets | indent 8 }}
{{- end }}

144 changes: 0 additions & 144 deletions charts/osm/templates/crds-upgrade-hook.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions charts/osm/templates/osm-bootstrap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ spec:
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
initContainers:
- name: init-osm-bootstrap
image: "{{ .Values.OpenServiceMesh.image.registry }}/osm-crds:{{ .Values.OpenServiceMesh.image.tag }}"
imagePullPolicy: {{ .Values.OpenServiceMesh.image.pullPolicy }}
args:
- apply
- -f
- /osm-crds
containers:
- name: osm-bootstrap
image: "{{ .Values.OpenServiceMesh.image.registry }}/osm-bootstrap:{{ .Values.OpenServiceMesh.image.tag }}"
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.osm-bootstrap
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM gcr.io/distroless/static
COPY osm-bootstrap /
COPY . /

0 comments on commit 924155d

Please sign in to comment.