Skip to content

Commit

Permalink
feat: add checksum to deployment so pod restarts when changes are made
Browse files Browse the repository at this point in the history
  • Loading branch information
philipsens committed Nov 15, 2023
1 parent beba4f1 commit 60bb964
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 97 deletions.
2 changes: 1 addition & 1 deletion charts/ff-common/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
description: ff-common chart building components and helpers for the Frank!Framework
name: ff-common
version: 0.1.15
version: 0.1.16
appVersion: "7.8"
home: https://frankframework.org
icon: https://raw.githubusercontent.com/ibissource/charts/master/charts/ff-common/icon.svg
8 changes: 6 additions & 2 deletions charts/ff-common/templates/_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ spec:
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
checksum/configmap.context: {{ include ("ff-common.configmap.context.tpl") . | sha256sum }}
checksum/configmap.env: {{ include ("ff-common.configmap.env.tpl") . | sha256sum }}
checksum/configmap.ldap-role-mapping: {{ include ("ff-common.configmap.ldap-role-mapping.tpl") . | sha256sum }}
checksum/configmap.tomcat-users: {{ include ("ff-common.configmap.tomcat-users.tpl") . | sha256sum }}
{{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{ end }}
spec:
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
Expand Down
6 changes: 3 additions & 3 deletions charts/ff-test/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: ff-common
repository: file://../ff-common
version: 0.1.15
digest: sha256:caf99e060cfb3b84f47b11e36d6ab50dc46a730dadee220877dfed8c8c18d964
generated: "2023-10-03T02:29:47.789425366+02:00"
version: 0.1.16
digest: sha256:2f2cfe01345e8bc408d1f4099233b5393d9cdb3ecfce2c010da6245d75a5c32b
generated: "2023-11-09T14:14:33.445460255+01:00"
4 changes: 2 additions & 2 deletions charts/ff-test/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ description: A Helm chart for testing the Frank!Framework on Kubernetes
name: ff-test
icon: https://raw.githubusercontent.com/ibissource/charts/master/charts/ff-test/icon.svg
type: application
version: 0.2.26
version: 0.2.27

dependencies:
- name: ff-common
version: ~0.1.15
version: ~0.1.16
repository: file://../ff-common
28 changes: 14 additions & 14 deletions charts/ff-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ helm delete my-ff-test

### Frank!Framework Connection parameters

| Name | Description | Value |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `connections.create` | Create a `context.xml` and possibly overwrite the existing one, to configure the connections/resources. | `false` |
| `connections.jdbc` | Set one database connections. The connection should match one in the context.xml | `{}` |
| `connections.jdbc.host` | Host of where the database can be reached (like in the same cluster e.g. `<service>.<namespace>.svc.cluster.local`). For H2 it can be `mem` or a file location | `""` |
| `connections.jdbc.port` | Port for the database (leave empty for default) | `""` |
| `connections.jdbc.database` | Name of the database to use (default is `.Release.name`) | `""` |
| `connections.jdbc.username` | Username to connect to the database (or use string template for use with credentials e.g. `${database/username}`) | `""` |
| `connections.jdbc.password` | Password to connect to the database (or use string template for use with credentials e.g. `${database/password}`) | `""` |
| `connections.jdbc.ssl` | Set to `true` is the connection uses SSL, default is `false` | `""` |
| `connections.jms` | Set one massage services. The connection should match one in the context.xml | `[]` |
| `connections.jms.host` | Host of where the MQ can be reached (like in the same cluster e.g. `<service>.<namespace>.svc.cluster.local`) | `""` |
| `connections.jms.port` | Port for the MQ (leave empty for default) | `""` |
| `connections.jms.url` | URL for Tibco | `""` |
| Name | Description | Value |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `connections.create` | Create a `context.xml` and possibly overwrite the existing one, to configure the connections/resources. | `false` |
| `connections.preDefinedJdbc` | Set one database connections. The connection should match one in the context.xml | `{}` |
| `connections.preDefinedJdbc.host` | Host of where the database can be reached (like in the same cluster e.g. `<service>.<namespace>.svc.cluster.local`). For H2 it can be `mem` or a file location | `""` |
| `connections.preDefinedJdbc.port` | Port for the database (leave empty for default) | `""` |
| `connections.preDefinedJdbc.database` | Name of the database to use (default is `.Release.name`) | `""` |
| `connections.preDefinedJdbc.username` | Username to connect to the database (or use string template for use with credentials e.g. `${database/username}`) | `""` |
| `connections.preDefinedJdbc.password` | Password to connect to the database (or use string template for use with credentials e.g. `${database/password}`) | `""` |
| `connections.preDefinedJdbc.ssl` | Set to `true` is the connection uses SSL, default is `false` | `""` |
| `connections.preDefinedJms` | Set one massage services. The connection should match one in the context.xml | `[]` |
| `connections.preDefinedJms.host` | Host of where the MQ can be reached (like in the same cluster e.g. `<service>.<namespace>.svc.cluster.local`) | `""` |
| `connections.preDefinedJms.port` | Port for the MQ (leave empty for default) | `""` |
| `connections.preDefinedJms.url` | URL for Tibco | `""` |

### Frank!Framework deployment parameters

Expand Down
43 changes: 5 additions & 38 deletions charts/ff-test/templates/configmap.context.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
{{- if .Values.connections.create -}}
{{/*
This is a copy of https://github.com/ibissource/iaf/blob/master/test/src/main/webapp/META-INF/context.xml
*/}}
{{- template "ff-common.configmap.context" (list . "ff-test.configmap.context" ) -}}
{{- define "ff-test.configmap.context" -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ff-common.fullname" . }}-context
labels:
{{- include "ff-common.labels" . | nindent 4 }}
data:
context.xml: |-
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"/>
<!--
Support for XA using BTM requires JDBC datasources to be configured via
factory="org.apache.naming.factory.BeanFactory" and a proper XADataSource classname.
Configuration via driverClassName only works for the standard transaction manager.
-->
<!-- IbisProp table has a column named VALUE. VALUE is a keyword in h2 db. -->
{{- with .Values.connections.jdbc }}
{{- with .Values.connections.preDefinedJdbc }}
<Resource
name="jdbc/ibis4test-h2"
factory="org.apache.naming.factory.BeanFactory"
type="org.h2.jdbcx.JdbcDataSource"
URL="jdbc:h2:mem:{{ .database | default (include "ff-common.instance.name" $) }};NON_KEYWORDS=VALUE;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;TRACE_LEVEL_FILE=0;"
/>
<Resource
name="jdbc/ibis4test-oracle-orcldb"
factory="org.apache.naming.factory.BeanFactory"
Expand All @@ -37,7 +31,6 @@ data:
user="{{ .username }}"
password="{{ .password }}"
/>
<Resource
name="jdbc/ibis4test-oracle-xe"
type="javax.sql.DataSource"
Expand All @@ -48,7 +41,6 @@ data:
maxTotal="10"
maxWaitMillis="5000"
/>
<Resource
name="jdbc/ibis4test-oracle"
factory="org.apache.naming.factory.BeanFactory"
Expand All @@ -57,7 +49,6 @@ data:
user="{{ .username }}"
password="{{ .password }}"
/>
<Resource
name="jdbc/ibis4test-mssql"
auth="Container"
Expand All @@ -79,7 +70,6 @@ data:
applicationName="iaf-test on TomCat"
applicationIntent="readwrite"
/>
<!-- serverTimezone is set for docker instances -->
<Resource
name="jdbc/ibis4test-mysql"
Expand All @@ -94,9 +84,7 @@ data:
pinGlobalTxToPhysicalConnection="true"
socketTimeout="5000"
/>
<!-- pinGlobalTxToPhysicalConnection appears to be required to avoid locking problems under XA -->
<!-- Use MySQL driver for MariaDB for proper XA support. --> <!-- serverTimezone is set for docker instances -->
<Resource
name="jdbc/ibis4test-mariadb"
Expand All @@ -122,8 +110,6 @@ data:
/>
-->
<!-- pinGlobalTxToPhysicalConnection does not work the same for mariadb as it does for mysql, therefor still locking problems under XA for mariadb -->
<Resource
name="jdbc/ibis4test-postgres-xa"
factory="org.apache.naming.factory.BeanFactory"
Expand All @@ -132,7 +118,6 @@ data:
user="{{ .username }}"
password="{{ .password }}"
/>
<!-- Postgres XA does not work without BTM/Narayana, gives ClassCastException casting the XA datasource to Java datasource, so add non-XA for those cases -->
<Resource name="jdbc/ibis4test-postgres" auth="Container"
type="javax.sql.DataSource"
Expand All @@ -143,7 +128,6 @@ data:
maxTotal="10"
maxWaitMillis="5000"
/>
<Resource name="jdbc/ibis4test-db2-xa" auth="Container"
factory="org.apache.naming.factory.BeanFactory"
type="com.ibm.db2.jcc.DB2XADataSource"
Expand All @@ -154,7 +138,6 @@ data:
user="{{ .username }}"
password="{{ .password }}"
/>
<!-- DB2 XA does not work without BTM/Narayana, gives ClassCastException casting the XA datasource to Java datasource, so add non-XA for those cases -->
<Resource name="jdbc/ibis4test-db2" auth="Container"
type="javax.sql.DataSource"
Expand All @@ -163,7 +146,6 @@ data:
username="{{ .username }}"
password="{{ .password }}"
/>
<Resource
name="mongodb/ibis4test"
type="com.mongodb.MongoClient"
Expand All @@ -172,79 +154,64 @@ data:
auth="Container"
singleton="true"
/>
{{- end }}
{{- with .Values.connections.jms }}
{{- with .Values.connections.preDefinedJms }}
<!-- Tibco crendentials can be set here via 'userName' and 'userPassword' attributes, or in the jmsRealm via authAlias (not via username and password) -->
<Resource
name="jms/qcf_tibco_esb_ff"
factory="nl.nn.adapterframework.jndi.TomcatJndiProxy"
delegate_name="SLXHP_Queue_ConnectionFactory"
delegate_jndiProperties="TibcoJndi.properties"
delegate_providerURL="{{ .url }}"
userName="{{ .username }}"
userPassword="{{ .password }}"
SSLEnableVerifyHost="{{ .ssl }}"
/>
<Resource
name="jms/qcf_tibco_esb_rr"
factory="nl.nn.adapterframework.jndi.TomcatJndiProxy"
delegate_name="SLNHN_Queue_ConnectionFactory"
delegate_jndiProperties="TibcoJndi.properties"
delegate_providerURL="{{ .url }}"
userName="{{ .username }}"
userPassword="{{ .password }}"
SSLEnableVerifyHost="{{ .ssl }}"
/>
<!-- delegate_providerURL="tibjmsnaming://DEVESBLARGEDC1:37243,tibjmsnaming://DEVESBLARGEDC2:37243"-->
<Resource
name="jms/GetMessageRequest"
factory="nl.nn.adapterframework.jndi.TomcatJndiProxy"
delegate_name="ESB.Infrastructure.TS.Test.TestIAF.1.GetMessage.1.Request"
delegate_jndiProperties="TibcoJndi.properties"
delegate_providerURL="{{ .url }}"
/>
<Resource
name="jms/UpdateMessageAction"
factory="nl.nn.adapterframework.jndi.TomcatJndiProxy"
delegate_name="ESB.Infrastructure.TS.Test.TestIAF.1.UpdateMessage.1.Action"
delegate_jndiProperties="TibcoJndi.properties"
delegate_providerURL="{{ .url }}"
/>
<Resource name="jms/qcf-activemq"
factory="org.apache.naming.factory.BeanFactory"
type="org.apache.activemq.ActiveMQXAConnectionFactory"
brokerURL="tcp://{{ .host }}:{{ default 61616 .port }}?jms.xaAckMode=1"
/>
<!-- Activemq-artemis resource configuration -->
<Resource name="jms/qcf-artemis"
factory="org.apache.naming.factory.BeanFactory"
type="org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory"
brokerURL="tcp://{{ .host }}:{{ default 61616 .port }}"
/>
<!-- AWS SQS resource configuration -->
<!-- The queues configured in the queues attribute will be created if they do not exist -->
<Resource name="jms/qcf-aws_sqs"
factory="nl.nn.adapterframework.jms.AmazonSqsFactory"
type="javax.jms.ConnectionFactory"
region="eu-west-1"
authAlias="aws"
queues="i4testiaf_ff,i4testiaf_in,i4testiaf_out"
/>
{{- end }}
</Context>
{{- end }}
{{- end -}}
4 changes: 2 additions & 2 deletions charts/ff-test/templates/configmap.env.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- template "ff-common.configmap.env" (list . "frank2example.configmap.env" ) -}}
{{- define "frank2example.configmap.env" -}}
{{- template "ff-common.configmap.env" (list . "ff-test.configmap.env" ) -}}
{{- define "ff-test.configmap.env" -}}
data:
instance.name: Ibis4Test
{{- end -}}
8 changes: 6 additions & 2 deletions charts/ff-test/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
{{- define "ff-test.deployment" -}}
spec:
template:
metadata:
annotations:
checksum/configmap.context: {{ include (print $.Template.BasePath "/configmap.context.yaml") . | sha256sum }}
checksum/configmap.env: {{ include (print $.Template.BasePath "/configmap.env.yaml") . | sha256sum }}
spec:
containers:
-
Expand Down Expand Up @@ -36,12 +40,12 @@ volumeMounts:
mountPath: /opt/frank/secrets/
readOnly: true
{{- end }}
{{- if .Values.connections.create }}
{{- if .Values.connections.create }}
- name: {{ template "ff-common.fullname" . }}-context
mountPath: /usr/local/tomcat/conf/Catalina/localhost/iaf-test.xml
subPath: context.xml
readOnly: true
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /iaf-test/iaf/
Expand Down
2 changes: 1 addition & 1 deletion charts/ff-test/templates/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
{{ template "ff-common.configmap.ldap-role-mapping.tpl" . }}
---
{{ template "ff-common.hpa.tpl"}}
{{ template "ff-common.hpa.tpl" . }}
---
{{ template "ff-common.serviceAccount.tpl" . }}
---
Expand Down
4 changes: 2 additions & 2 deletions charts/ff-test/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"description": "Create a `context.xml` and possibly overwrite the existing one, to configure the connections/resources.",
"default": false
},
"jdbc": {
"preDefinedJdbc": {
"type": "object",
"properties": {
"host": {
Expand Down Expand Up @@ -236,7 +236,7 @@
}
}
},
"jms": {
"preDefinedJms": {
"type": "object",
"properties": {
"host": {
Expand Down
Loading

0 comments on commit 60bb964

Please sign in to comment.