Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Use helper for st2-config-vol volume/volumeMounts definitions #198

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Jun 16, 2021

This reduces duplication of the st2-config-vol definitions in volumes: and volumeMounts: blocks.

@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Jun 16, 2021
@cognifloyd cognifloyd force-pushed the st2-conf-helper branch 4 times, most recently from cc16fe1 to d330e35 Compare June 16, 2021 13:47
@cognifloyd cognifloyd requested a review from arm4b June 16, 2021 14:06
@cognifloyd
Copy link
Member Author

cognifloyd commented Jun 17, 2021

pull-request-size bot says that this PR is size/L because it deletes a lot of lines. In templates/deployments.yaml and templates/jobs.yaml I added two lines for every 9 lines I removed:

---
apiVersion: ...
kind: ...
metadata:
  ...
spec:
  template:
    metadata:
      ...
    spec:
      ...
      containers:
      - name: ...
        ...
        volumeMounts:
-       - name: st2-config-vol
-         mountPath: /etc/st2/st2.docker.conf
-         subPath: st2.docker.conf
-       - name: st2-config-vol
-         mountPath: /etc/st2/st2.user.conf
-         subPath: st2.user.conf
+      {{- include "st2-config-volume-mounts" . | nindent 8 }}
      volumes:
-       - name: st2-config-vol
-         configMap:
-           name: {{ .Release.Name }}-st2-config
+      {{- include "st2-config-volume" . | nindent 8 }}

And then the template definition is just:
https://github.com/StackStorm/stackstorm-ha/blob/d330e353ab7a312cb7647c56e0bd441ee10b2509/templates/_helpers.tpl#L74-L87

@ericreeves
Copy link
Contributor

This seems like a great change.

@cognifloyd
Copy link
Member Author

rebased on master

Copy link
Contributor

@ericreeves ericreeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

@cognifloyd
Copy link
Member Author

rebased on master

@cognifloyd cognifloyd added the Helm label Jul 2, 2021
@cognifloyd cognifloyd changed the title Move st2-config-vol volume/volumeMounts definitions to helpers Refactor: Use helper for st2-config-vol volume/volumeMounts definitions Jul 3, 2021
@cognifloyd cognifloyd force-pushed the st2-conf-helper branch 2 times, most recently from 1c538d4 to 3a2ee8d Compare July 3, 2021 02:08
Copy link
Contributor

@ericreeves ericreeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more much needed deduplication!

@cognifloyd cognifloyd force-pushed the st2-conf-helper branch 3 times, most recently from d0f6fcb to 75ff9cd Compare July 6, 2021 15:18
@cognifloyd
Copy link
Member Author

@armab This one is the next easiest PR to review. Please and thank you!

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cognifloyd
Copy link
Member Author

Tests are green :)

@arm4b arm4b merged commit 824bf74 into StackStorm:master Jul 6, 2021
@cognifloyd cognifloyd removed the RFR label Jul 10, 2021
@cognifloyd cognifloyd deleted the st2-conf-helper branch November 11, 2021 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Helm size/L PR that changes 100-499 lines. Requires some effort to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants