Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
feat: enhance NamespacedIngress API (#48)
Browse files Browse the repository at this point in the history
* chore: bump version to v0.1.0-beta.6

Signed-off-by: Lin Yang <[email protected]>

* feat: enhance NamespacedIngress API

Signed-off-by: Lin Yang <[email protected]>

Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
reaver-flomesh authored Jan 26, 2023
1 parent 83d8f71 commit 45e454f
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 28 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To install the chart with the release name `ec` run:

```bash
helm repo add ec https://ec.flomesh.io
helm install ec ec/erie-canal --namespace erie-canal --create-namespace --version=0.1.0-beta.5
helm install ec ec/erie-canal --namespace erie-canal --create-namespace --version=0.1.0-beta.6
```

The command deploys ErieCanal on the Kubernetes cluster using the default configuration in namespace `erie-canal` and creates the namespace if it doesn't exist. The [configuration](#configuration) section lists the parameters that can be configured during installation.
Expand All @@ -55,7 +55,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm
helm install ec ec/erie-canal \
--namespace erie-canal \
--create-namespace \
--version=0.1.0-beta.5 \
--version=0.1.0-beta.6 \
--set ec.image.pullPolicy=Always
```

Expand All @@ -65,6 +65,6 @@ Alternatively, a YAML file that specifies the values for the parameters can be p
helm install ec ec/erie-canal \
--namespace erie-canal \
--create-namespace \
--version=0.1.0-beta.5 \
--version=0.1.0-beta.6 \
-f values-override.yaml
```
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_VERSION=0.1.0-beta.5
HELM_CHART_VERSION=0.1.0-beta.5
APP_VERSION=0.1.0-beta.6
HELM_CHART_VERSION=0.1.0-beta.6
K8S_VERSION=1.25.5
ENVTEST_K8S_VERSION=1.25
8 changes: 8 additions & 0 deletions apis/namespacedingress/v1alpha1/namespacedingress_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ type NamespacedIngressSpec struct {
// +optional
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`

// ServiceLabels, those annotations are applied to Ingress Service
// +optional
ServiceLabels map[string]string `json:"serviceLabels,omitempty"`

// PodAnnotations, those annotations are applied to Ingress POD
// +optional
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`

// PodAnnotations, those labels are applied to Ingress POD
// +optional
PodLabels map[string]string `json:"podLabels,omitempty"`

// +kubebuilder:default={enabled: true, port: {name: http, protocol: TCP, port: 80, targetPort: 8000}}

// The http configuration of this ingress controller.
Expand Down
14 changes: 14 additions & 0 deletions apis/namespacedingress/v1alpha1/zz_generated.deepcopy.go

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

6 changes: 3 additions & 3 deletions charts/erie-canal/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: tpls
repository: file://../tpls
version: 0.1.0-beta.5
version: 0.1.0-beta.6
- name: cert-manager
repository: https://charts.jetstack.io
version: v1.7.3
digest: sha256:93c6f6d9dc73e3c5529d69518f7b9c7e9a089087238e5b2a4c888506e611c3ed
generated: "2023-01-14T12:34:28.235983+08:00"
digest: sha256:a53aa295cc96451554a85c8c50f5705baa618de288527f7887ae518fad4735f6
generated: "2023-01-26T15:14:17.805532+08:00"
6 changes: 3 additions & 3 deletions charts/erie-canal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0-beta.5
version: 0.1.0-beta.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0-beta.5"
appVersion: "0.1.0-beta.6"

keywords:
- kubernetes
Expand All @@ -48,7 +48,7 @@ sources:

dependencies:
- name: tpls
version: 0.1.0-beta.5
version: 0.1.0-beta.6
repository: file://../tpls
- name: cert-manager
version: 1.7.3
Expand Down
11 changes: 11 additions & 0 deletions charts/erie-canal/apis/flomesh.io_namespacedingresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,11 @@ spec:
description: PodAnnotations, those annotations are applied to Ingress
POD
type: object
podLabels:
additionalProperties:
type: string
description: PodAnnotations, those labels are applied to Ingress POD
type: object
podSecurityContext:
description: 'PodSecurityContext holds pod-level security attributes
and common container settings. Optional: Defaults to empty. See
Expand Down Expand Up @@ -1444,6 +1449,12 @@ spec:
description: ServiceAnnotations, those annotations are applied to
Ingress Service
type: object
serviceLabels:
additionalProperties:
type: string
description: ServiceLabels, those annotations are applied to Ingress
Service
type: object
serviceType:
description: ServiceType determines how the Ingress is exposed. For
an Ingress the most used types are NodePort, and LoadBalancer
Expand Down
6 changes: 3 additions & 3 deletions charts/namespaced-ingress/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: tpls
repository: file://../tpls
version: 0.1.0-beta.5
digest: sha256:bde69f6d74986a34ca742d912215e9a6e143862379cc24e7a547484b2b3a0655
generated: "2023-01-14T12:34:35.91228+08:00"
version: 0.1.0-beta.6
digest: sha256:d0177b3090b73c04abd82bfca7e02374866c774f61a1184acce51b9286b0cdd9
generated: "2023-01-26T15:14:22.767827+08:00"
6 changes: 3 additions & 3 deletions charts/namespaced-ingress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0-beta.5
version: 0.1.0-beta.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0-beta.5"
appVersion: "0.1.0-beta.6"

dependencies:
- name: tpls
version: 0.1.0-beta.5
version: 0.1.0-beta.6
repository: file://../tpls
15 changes: 15 additions & 0 deletions charts/namespaced-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,18 @@ ServiceAccountName - namespaced-ingress
{{- define "ec.namespaced-ingress.serviceAccountName" -}}
{{ default "erie-canal-namespaced-ingress" .Values.nsig.spec.serviceAccountName }}
{{- end }}


{{- define "ec.namespaced-ingress.heath.port" -}}
{{- if and .Values.ec.ingress.enabled .Values.ec.ingress.namespaced }}
{{- if .Values.nsig.spec.http.enabled }}
{{- default .Values.ec.ingress.http.containerPort .Values.nsig.spec.http.port.targetPort }}
{{- else if and .Values.nsig.spec.tls.enabled }}
{{- default .Values.ec.ingress.tls.containerPort .Values.nsig.spec.tls.port.targetPort }}
{{- else }}
8081
{{- end }}
{{- else }}
8081
{{- end }}
{{- end }}
11 changes: 8 additions & 3 deletions charts/namespaced-ingress/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and .Values.ec.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ec.ingress.namespaced }}
{{- if and .Values.ec.ingress.namespaced (or .Values.nsig.spec.http.enabled .Values.nsig.spec.tls.enabled)}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -26,6 +26,9 @@ spec:
{{- include "ec.ingress-pipy.selectorLabels" . | nindent 8 }}
ingress.flomesh.io/namespaced: {{ .Values.ec.ingress.namespaced | quote }}
ingress.flomesh.io/ns: {{ .Values.nsig.metadata.namespace }}
{{- with .Values.nsig.spec.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nsig.spec.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -63,6 +66,8 @@ spec:
args:
- --v={{ default .Values.ec.logLevel .Values.nsig.spec.logLevel }}
env:
- name: GIN_MODE
value: release
{{- include "ec.common-env" . | nindent 10 }}
{{- with .Values.nsig.spec.env }}
{{- toYaml . | nindent 10 }}
Expand All @@ -84,12 +89,12 @@ spec:
initialDelaySeconds: 5
timeoutSeconds: 5
tcpSocket:
port: {{ .Values.ec.ingress.http.containerPort }}
port: {{ include "ec.namespaced-ingress.heath.port" . }}
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
tcpSocket:
port: {{ .Values.ec.ingress.http.containerPort }}
port: {{ include "ec.namespaced-ingress.heath.port" . }}
terminationGracePeriodSeconds: 60
{{- with .Values.nsig.spec.podSecurityContext }}
securityContext:
Expand Down
5 changes: 4 additions & 1 deletion charts/namespaced-ingress/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{{- if and .Values.ec.ingress.enabled (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ec.ingress.namespaced }}
{{- if and .Values.ec.ingress.namespaced (or .Values.nsig.spec.http.enabled .Values.nsig.spec.tls.enabled)}}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-%s" .Values.ec.ingress.name .Values.nsig.metadata.namespace }}
namespace: {{ .Values.nsig.metadata.namespace }}
labels:
{{- include "ec.ingress-pipy.labels" . | nindent 4 }}
{{- with .Values.nsig.spec.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.nsig.spec.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/tpls/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0-beta.5
version: 0.1.0-beta.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0-beta.5"
appVersion: "0.1.0-beta.6"
5 changes: 3 additions & 2 deletions charts/tpls/templates/_services.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ Service Host - ingress-pipy
Heath port - ingress-pipy
*/}}
{{- define "ec.ingress-pipy.heath.port" -}}
{{- if .Values.ec.ingress.enabled}}
{{- if .Values.ec.ingress.enabled }}
{{- if and .Values.ec.ingress.http.enabled (not (empty .Values.ec.ingress.http.containerPort)) }}
{{- .Values.ec.ingress.http.containerPort}}
{{- .Values.ec.ingress.http.containerPort }}
{{- else if and .Values.ec.ingress.tls.enabled (not (empty .Values.ec.ingress.tls.containerPort)) }}
{{- .Values.ec.ingress.tls.containerPort }}
{{- else }}
8081
{{- end }}
Expand Down
6 changes: 3 additions & 3 deletions samples/setup/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/qui

#### Install ErieCanal to Control Plane
```shell
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.5-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.6-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
```

### Cluster 1
Expand Down Expand Up @@ -73,7 +73,7 @@ Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/qui

#### Install ErieCanal to Cluster1
```shell
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.5-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.6-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
```

### Cluster 2
Expand Down Expand Up @@ -102,7 +102,7 @@ Not sure what to do next? 😅 Check out https://kind.sigs.k8s.io/docs/user/qui

#### Install ErieCanal to Cluster2
```shell
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.5-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
helm install --namespace erie-canal --create-namespace --set ec.version=0.1.0-beta.6-dev --set ec.logLevel=5 --set ec.serviceLB.enabled=true erie-canal charts/erie-canal/
```

## Create/Update Cluster CRD yamls
Expand Down

0 comments on commit 45e454f

Please sign in to comment.