-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPSEXP-2452 Support share clustering (#207)
- Loading branch information
Showing
17 changed files
with
262 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tags: | ||
ci: true | ||
|
||
replicaCount: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- define "alfresco-share.custom-application-context.name" -}} | ||
{{- $scope := (dict "Values" (dict "nameOverride" "share-custom-application-context" ) "Chart" .Chart "Release" .Release) }} | ||
{{- include "alfresco-share.fullname" $scope }} | ||
{{- end }} | ||
|
||
{{- define "alfresco-share.service-hz.name" -}} | ||
{{- $scope := (dict "Values" (dict "nameOverride" "share-hz" ) "Chart" .Chart "Release" .Release) }} | ||
{{- include "alfresco-share.fullname" $scope }} | ||
{{- end }} | ||
|
||
{{- define "alfresco-share.cluster-role-hz.name" -}} | ||
{{- $scope := (dict "Values" (dict "nameOverride" "share-hazelcast-cluster-role" ) "Chart" .Chart "Release" .Release) }} | ||
{{- include "alfresco-share.fullname" $scope }} | ||
{{- end }} | ||
|
||
{{- define "alfresco-share.cluster-role-binding-hz.name" -}} | ||
{{- $scope := (dict "Values" (dict "nameOverride" "share-hazelcast-cluster-role-binding" ) "Chart" .Chart "Release" .Release) }} | ||
{{- include "alfresco-share.fullname" $scope }} | ||
{{- end }} |
33 changes: 33 additions & 0 deletions
33
charts/alfresco-share/templates/configmap-custom-application-context.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{- if and (gt (int .Values.replicaCount) 1) .Values.managedApplicationContext.enabled -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "alfresco-share.custom-application-context.name" . }} | ||
labels: | ||
{{- include "alfresco-share.labels" . | nindent 4 }} | ||
data: | ||
custom-slingshot-application-context.xml: |- | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:hz="http://www.hazelcast.com/schema/spring" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd | ||
http://www.hazelcast.com/schema/spring | ||
http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd"> | ||
<hz:topic id="topic" instance-ref="webframework.cluster.slingshot" name="slingshot-topic"/> | ||
<hz:hazelcast id="webframework.cluster.slingshot"> | ||
<hz:config> | ||
<hz:network port="{{ .Values.hazelcast.port }}" port-auto-increment="false"> | ||
<hz:join> | ||
<hz:kubernetes enabled="true" namespace="{{ .Release.Namespace }}" service-name="{{ template "alfresco-share.service-hz.name" . }}" /> | ||
</hz:join> | ||
</hz:network> | ||
</hz:config> | ||
</hz:hazelcast> | ||
<bean id="webframework.cluster.clusterservice" class="org.alfresco.web.site.ClusterTopicService" init-method="init"> | ||
<property name="hazelcastInstance" ref="webframework.cluster.slingshot" /> | ||
<property name="hazelcastTopicName"><value>slingshot-topic</value></property> | ||
</bean> | ||
</beans> | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{- if gt (int .Values.replicaCount) 1 -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ template "alfresco-share.cluster-role-hz.name" . }} | ||
rules: | ||
- apiGroups: | ||
- "" | ||
# Access to apps API is only required to support automatic cluster state management | ||
# when persistence (hot-restart) is enabled. | ||
- apps | ||
resources: | ||
- endpoints | ||
- pods | ||
- nodes | ||
- services | ||
# Access to statefulsets resource is only required to support automatic cluster state management | ||
# when persistence (hot-restart) is enabled. | ||
- statefulsets | ||
verbs: | ||
- get | ||
- list | ||
# Watching resources is only required to support automatic cluster state management | ||
# when persistence (hot-restart) is enabled. | ||
- watch | ||
- apiGroups: | ||
- "discovery.k8s.io" | ||
resources: | ||
- endpointslices | ||
verbs: | ||
- get | ||
- list | ||
|
||
--- | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ template "alfresco-share.cluster-role-binding-hz.name" . }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ template "alfresco-share.cluster-role-hz.name" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "alfresco-share.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if gt (int .Values.replicaCount) 1 }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "alfresco-share.service-hz.name" . }} | ||
labels: | ||
{{- include "alfresco-share.selectorLabels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- name: hazelcast | ||
port: {{ .Values.hazelcast.port }} | ||
selector: | ||
{{- include "alfresco-share.selectorLabels" . | nindent 4 }} | ||
{{- end -}} |
18 changes: 18 additions & 0 deletions
18
charts/alfresco-share/tests/configmap-custom-application-context_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
suite: test custom application context configmap | ||
templates: | ||
- configmap-custom-application-context.yaml | ||
tests: | ||
- it: should not render the configmap when replicaCount is 1 | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: should render default contents when replicaCount is 2 | ||
set: | ||
replicaCount: 2 | ||
asserts: | ||
- equal: | ||
path: metadata.name | ||
value: RELEASE-NAME-share-custom-application-context | ||
- isNotNullOrEmpty: | ||
path: data["custom-slingshot-application-context.xml"] |
2 changes: 1 addition & 1 deletion
2
charts/alfresco-share/tests/cm_test.yaml → .../alfresco-share/tests/configmap_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
suite: test Alfresco Share ingress | ||
suite: test share configmap | ||
templates: | ||
- configmap.yaml | ||
tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.