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

Prepare first release #7

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apis/installer/v1alpha1/inbox_agent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ type InboxAgentApiserver struct {
}

type InboxServerInfo struct {
Endpoint string `json:"endpoint"`
Token string `json:"token"`
JMAPEndpoint string `json:"jmapEndpoint"`
WebadminEndpoint string `json:"webadminEndpoint"`
Token string `json:"token"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
19 changes: 14 additions & 5 deletions apis/installer/v1alpha1/inbox_server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,18 @@ type InboxServerSpec struct {
}

type DnsSpec struct {
Domain string `json:"domain"`
EmailDomain string `json:"emailDomain"`
TargetIPs []string `json:"targetIPs"`
}

type JamesSpec struct {
ReplicaJmapInstanceCount int `json:"replicaJmapInstanceCount"`
ReplicaImapSmtpInstanceCount int `json:"replicaImapSmtpInstanceCount"`
Image string `json:"image"`
Env JamesEnv `json:"env"`
TLS TLSSpec `json:"tls"`
ReplicaJmapInstanceCount int `json:"replicaJmapInstanceCount"`
ReplicaImapSmtpInstanceCount int `json:"replicaImapSmtpInstanceCount"`
Image string `json:"image"`
Env JamesEnv `json:"env"`
TLS TLSSpec `json:"tls"`
Secret *JamesSecret `json:"secret,omitempty"`
}

type JamesEnv struct {
Expand All @@ -112,6 +114,13 @@ type JamesEnv struct {
JamesResources core.ResourceRequirements `json:"jamesResources"`
}

type JamesSecret struct {
AdminJWTPublicKey string `json:"adminJWTPublicKey"`
JwtPublicKey string `json:"jwtPublicKey"`
JwtPrivateKey string `json:"jwtPrivateKey"`
DkimPrivateKey string `json:"dkimPrivateKey"`
}

type GlowrootSpec struct {
Enabled bool `json:"enabled"`
}
Expand Down
20 changes: 20 additions & 0 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion charts/inbox-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ The following table lists the configurable parameters of the `inbox-agent` chart
| apiserver.servingCerts.serverKey | Private key for the serving certificate used by webhook server. | <code>""</code> |
| monitoring.agent | Name of monitoring agent (either "prometheus.io/operator" or "prometheus.io/builtin") | <code>"none"</code> |
| monitoring.serviceMonitor.labels | Specify the labels for ServiceMonitor. Prometheus crd will select ServiceMonitor using these labels. Only usable when monitoring agent is `prometheus.io/operator`. | <code>{}</code> |
| inboxServer.endpoint | | <code>""</code> |
| inboxServer.jmapEndpoint | | <code>""</code> |
| inboxServer.webadminEndpoint | | <code>""</code> |
| inboxServer.token | | <code>""</code> |


Expand Down
5 changes: 3 additions & 2 deletions charts/inbox-agent/templates/operator/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ metadata:
{{- include "inbox-agent.labels" . | nindent 4 }}
type: Opaque
stringData:
endpoint: {{ .Values.inboxServer.endpoint }}
token: {{ .Values.inboxServer.token }}
jmapEndpoint: {{ .Values.inboxServer.jmapEndpoint }}
webadminEndpoint: {{ .Values.inboxServer.webadminEndpoint }}
token: {{.Values.inboxServer.token}}
25 changes: 18 additions & 7 deletions charts/inbox-agent/templates/operator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ spec:
securityContext:
{{- toYaml .Values.operator.securityContext | nindent 10 }}
args:
- operator
- --v={{ .Values.logLevel }}
- --secure-port=8443
- --audit-log-path=-
- --tls-cert-file=/var/serving-cert/tls.crt
- --tls-private-key-file=/var/serving-cert/tls.key
- operator
- --v={{ .Values.logLevel }}
- --secure-port=8443
- --audit-log-path=-
- --tls-cert-file=/var/serving-cert/tls.crt
- --tls-private-key-file=/var/serving-cert/tls.key
{{- if .Values.inboxServer.jmapEndpoint }}
- --jmapEndpoint={{ .Values.inboxServer.jmapEndpoint }}
{{- end }}
{{- if .Values.inboxServer.webadminEndpoint }}
- --webadminEndpoint={{ .Values.inboxServer.webadminEndpoint }}
{{- end }}
ports:
- containerPort: 8443
env:
Expand All @@ -78,7 +84,12 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "inbox-agent.fullname" . }}-config
key: endpoint
key: jmapEndpoint
- name: INBOX_SERVER_WEBADMIN_ENDPOINT
valueFrom:
secretKeyRef:
name: {{ include "inbox-agent.fullname" . }}-config
key: webadminEndpoint
- name: INBOX_SERVER_TOKEN
valueFrom:
secretKeyRef:
Expand Down
17 changes: 14 additions & 3 deletions charts/inbox-agent/templates/webhook/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ spec:
securityContext:
{{- toYaml .Values.operator.securityContext | nindent 10 }}
args:
- webhook
- --webhook-name={{ include "inbox-agent.fullname" . }}
- webhook
- --webhook-name={{ include "inbox-agent.fullname" . }}
{{- if .Values.inboxServer.jmapEndpoint }}
- --jmapEndpoint={{ .Values.inboxServer.jmapEndpoint }}
{{- end }}
{{- if .Values.inboxServer.webadminEndpoint }}
- --webadminEndpoint={{ .Values.inboxServer.webadminEndpoint }}
{{- end }}
env:
- name: POD_NAME
valueFrom:
Expand All @@ -69,11 +75,16 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: INBOX_SERVER_WEBADMIN_ENDPOINT
valueFrom:
secretKeyRef:
name: {{ include "inbox-agent.fullname" . }}-config
key: webadminEndpoint
- name: INBOX_SERVER_JMAP_ENDPOINT
valueFrom:
secretKeyRef:
name: {{ include "inbox-agent.fullname" . }}-config
key: endpoint
key: jmapEndpoint
- name: INBOX_SERVER_TOKEN
valueFrom:
secretKeyRef:
Expand Down
7 changes: 5 additions & 2 deletions charts/inbox-agent/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -945,13 +945,16 @@ properties:
type: array
inboxServer:
properties:
endpoint:
jmapEndpoint:
type: string
token:
type: string
webadminEndpoint:
type: string
required:
- endpoint
- jmapEndpoint
- token
- webadminEndpoint
type: object
logLevel:
format: int32
Expand Down
3 changes: 2 additions & 1 deletion charts/inbox-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ monitoring:
labels: {}

inboxServer:
endpoint: ""
jmapEndpoint: ""
webadminEndpoint: ""
token: ""
5 changes: 3 additions & 2 deletions charts/inbox-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ The following table lists the configurable parameters of the `inbox-server` char

| Parameter | Description | Default |
|-------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| dns.emailDomain | # Default domain for all emailing components jmapUrl: "jmap.example.com" adminUrl: "admin.example.com" smtpHostname: "smtp.example.com" | <code>"example.com"</code> |
| dns.domain | # Default domain for all emailing components jmapUrl: "jmap.example.com" adminUrl: "admin.example.com" smtpHostname: "smtp.example.com" | <code>"example.com"</code> |
| dns.emailDomain | in ip mode, the emailDomain is ace.internal, otherwise same as domain | <code>"example.com"</code> |
| dns.targetIPs | | <code>[]</code> |
| james.replicaJmapInstanceCount | | <code>1</code> |
| james.replicaImapSmtpInstanceCount | | <code>1</code> |
Expand Down Expand Up @@ -132,7 +133,7 @@ The following table lists the configurable parameters of the `inbox-server` char
Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:

```bash
$ helm upgrade -i inbox-server appscode/inbox-server -n monitoring --create-namespace --version=v2024.5.3 --set dns.emailDomain="example.com"
$ helm upgrade -i inbox-server appscode/inbox-server -n monitoring --create-namespace --version=v2024.5.3 --set dns.domain="example.com"
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while
Expand Down
32 changes: 7 additions & 25 deletions charts/inbox-server/templates/james/james-admin-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@
{{- $fullName := printf "%s-admin" (include "inbox-server.fullname" .) -}}
{{- $svcPort := 8000 -}}

{{- if and .Values.adminIngress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.adminIngress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.adminIngress.annotations "kubernetes.io/ingress.class" .Values.adminIngress.className}}
{{- end }}
{{- end }}

{{- if and (not (hasKey .Values.adminIngress.annotations "external-dns.alpha.kubernetes.io/target")) .Values.dns.targetIPs }}
{{- $_ := set .Values.adminIngress.annotations "external-dns.alpha.kubernetes.io/target" (join "," .Values.dns.targetIPs)}}
{{- end }}
{{- $_ := set .Values.ingress.annotations "nginx.ingress.kubernetes.io/use-regex" "true" }}
{{- $_ := set .Values.ingress.annotations "nginx.ingress.kubernetes.io/rewrite-target" "/$2" }}

{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -30,31 +20,23 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.adminIngress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.adminIngress.className }}
ingressClassName: {{ .Values.adminIngress.className }}
{{- end }}
{{- if .Values.adminIngress.tls }}
tls:
- hosts:
- inbox-admin.{{ .Values.dns.emailDomain }}
- hosts: {{ list .Values.dns.domain | compact | toJson }}
{{- toYaml .Values.adminIngress.tls | nindent 4 }}
{{- end }}
rules:
- host: inbox-admin.{{ .Values.dns.emailDomain }}
- host: {{ .Values.dns.domain }}
http:
paths:
- path: /
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
- path: /inbox-admin(/|$)(.*)
pathType: ImplementationSpecific
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
32 changes: 7 additions & 25 deletions charts/inbox-server/templates/james/jmap-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@
{{- $fullName := printf "%s-jmap" (include "inbox-server.fullname" .) -}}
{{- $svcPort := 80 -}}

{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}

{{- if and (not (hasKey .Values.ingress.annotations "external-dns.alpha.kubernetes.io/target")) .Values.dns.targetIPs }}
{{- $_ := set .Values.ingress.annotations "external-dns.alpha.kubernetes.io/target" (join "," .Values.dns.targetIPs)}}
{{- end }}
{{- $_ := set .Values.ingress.annotations "nginx.ingress.kubernetes.io/use-regex" "true" }}
{{- $_ := set .Values.ingress.annotations "nginx.ingress.kubernetes.io/rewrite-target" "/$2" }}

{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -30,31 +20,23 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
- hosts:
- jmap.{{ .Values.dns.emailDomain }}
- hosts: {{ list .Values.dns.domain | compact | toJson }}
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{- end }}
rules:
- host: jmap.{{ .Values.dns.emailDomain }}
- host: {{ .Values.dns.domain }}
http:
paths:
- path: /
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
- path: /jmap(/|$)(.*)
pathType: ImplementationSpecific
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/inbox-server/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,13 +1065,16 @@ properties:
type: object
dns:
properties:
domain:
type: string
emailDomain:
type: string
targetIPs:
items:
type: string
type: array
required:
- domain
- emailDomain
- targetIPs
type: object
Expand Down Expand Up @@ -1221,6 +1224,22 @@ properties:
type: integer
replicaJmapInstanceCount:
type: integer
secret:
properties:
adminJWTPublicKey:
type: string
dkimPrivateKey:
type: string
jwtPrivateKey:
type: string
jwtPublicKey:
type: string
required:
- adminJWTPublicKey
- dkimPrivateKey
- jwtPrivateKey
- jwtPublicKey
type: object
tls:
properties:
secretName:
Expand Down
2 changes: 2 additions & 0 deletions charts/inbox-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ dns:
# jmapUrl: "jmap.example.com"
# adminUrl: "admin.example.com"
# smtpHostname: "smtp.example.com"
domain: "example.com"
# in ip mode, the emailDomain is ace.internal, otherwise same as domain
emailDomain: "example.com"
targetIPs: []

Expand Down
Loading