Skip to content

Commit

Permalink
Merge pull request #34 from dayuy/feat-1
Browse files Browse the repository at this point in the history
feat: frontend (bc-apis & bc-console )as a component
  • Loading branch information
bjwswang authored Jul 6, 2023
2 parents 13122b0 + 9a2f908 commit 39473b9
Show file tree
Hide file tree
Showing 15 changed files with 840 additions and 2 deletions.
23 changes: 23 additions & 0 deletions charts/bc-apis/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
18 changes: 18 additions & 0 deletions charts/bc-apis/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: bc-apis
description: bc-apis is a service that provides composited APIs for the console.
type: application
version: v0.0.1
icon: https://avatars.githubusercontent.com/u/85277200
keywords:
- apis
- bestchains
sources:
- https://github.com/bestchains/bc-apis
maintainers:
- name: bjwswang
url: https://github.com/bjwswang
- name: Carrotzpc
url: https://github.com/Carrotzpc
- name: dayuy
url: https://github.com/dayuy
50 changes: 50 additions & 0 deletions charts/bc-apis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# BC APIS Helm Chart

This Helm chart installs the `bc-apis` into your Kubernetes (v1.16+) or Openshift cluster (v4.3+).

## In Helm

### Install bc-apis

> NOTE: Use `bc-apis` as release name
```shell
helm install bc-apis kubebb/bc-apis
```

### Upgrade bc-apis

```shell
helm upgrade bc-apis kubebb/bc-apis
```

### Uninstall bc-apis

```shell
helm delete bc-apis
```

## Configuration

| Parameter | Description | Default |
|------------------------------|-----------------------------------|-----------------------------------------------|
| `ingressDomain` | Ingress Domain | |
| `ingressClassName` | Ingress Class | `portal-ingress` |
| `storageClassName` | Storage Class | `standard` |
| `iamServer` | Service address of IAM | `https://oidc-server.u4a-system` |
| `env.k8sOIDCProxyURL` | OIDC Proxy Url | |
| `env.OIDCServerURL` | OIDC Server Url | |
| `env.OIDCServerClientID` | OIDC Server Client ID | |
| `env.OIDCServerClientSecret` | OIDC Server Client Secret | |
| `env.imageNamespace` | Image namespace in Docker hub | `hyperledgerk8s` |
| `env.imageFabricCATag` | Image Tag of the FabricCA | `iam-20230131` |
| `env.imageFabricOrdererTag` | Image Tag of the FabricOrderer | `2.4.7` |
| `env.imageFabricPeerTag` | Image Tag of the FabricPeer | `2.4.7-external` |
| `env.logLevels` | Log Levels | `log,error,warn` |
| `env.minioAccessKey` | Minio Access Key | |
| `env.minioSecretKey` | Minio Secret Key | |
| `env.minioEndpoint` | Minio Endpoint | `fabric-minio.baas-system.svc.cluster.local` |
| `image` | Image of bc-apis | `hyperledgerk8s/bc-apis:20230703.143401.87` |
| `imagePullPolicy` | Image Pull Policy | `IfNotPresent` |
| `hostAliases[0].hostnames` | HostAliases of the deploy bc-apis | |
| `hostAliases[0].ip` | Ingress nginx ip | |
16 changes: 16 additions & 0 deletions charts/bc-apis/templates/component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: component.t7d.io/v1beta1
kind: Component
metadata:
name: bc
spec:
application:
helmChart:
name: bc-helm-chart
valuesConfig: values.yaml from helm
version: v0.1
name: bc
menu:
name: bc-root-menu
portal:
entry: /bc-public/index.html
path: /bc
111 changes: 111 additions & 0 deletions charts/bc-apis/templates/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bc-apis
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: bc-apis
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: bc-apis
spec:
containers:
- env:
- name: DEFAULT_INGRESS_CLASS
value: {{ .Values.ingressClassName }}
- name: DEFAULT_STORAGE_CLASS
value: {{ .Values.storageClassName }}
- name: K8S_OIDC_PROXY_URL
value: {{ .Values.env.k8sOIDCProxyURL }}
- name: OIDC_SERVER_URL
value: {{ .Values.env.OIDCServerURL }}
- name: OIDC_SERVER_CLIENT_ID
value: {{ .Values.env.OIDCServerClientID }}
- name: OIDC_SERVER_CLIENT_SECRET
value: {{ .Values.env.OIDCServerClientSecret }}
- name: K8S_API_TIMEOUT
value: "10"
- name: IMAGE_NAMESPACE
value: {{ .Values.env.imageNamespace }}
- name: IMAGE_FABRIC_CA_TAG
value: {{ .Values.env.imageFabricCATag }}
- name: IAM_PROVIDER_URL
value: {{ .Values.iamServer }}
- name: IMAGE_FABRIC_ORDERER_TAG
value: {{ .Values.env.imageFabricOrdererTag }}
- name: IMAGE_FABRIC_PEER_TAG
value: {{ .Values.env.imageFabricPeerTag }}
- name: LOG_LEVELS
value: {{ .Values.env.logLevels }}
- name: OPERATOR_INGRESS_DOMAIN
value: {{ .Values.ingressDomain }}
- name: MINIO_ACCESS_KEY
value: {{ .Values.env.minioAccessKey }}
- name: MINIO_SECRET_KEY
value: {{ .Values.env.minioSecretKey }}
- name: MINIO_ENDPOINT
value: {{ .Values.env.minioEndpoint }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
livenessProbe:
failureThreshold: 4
httpGet:
path: /health
port: 8024
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 10
name: bc-apis
ports:
- containerPort: 8024
protocol: TCP
readinessProbe:
failureThreshold: 4
httpGet:
path: /health
port: 8024
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 10
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 200m
memory: 512Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/localtime
name: time-localtime
readOnly: true
dnsPolicy: ClusterFirst
hostAliases:
{{ toYaml .Values.hostAliases | nindent 8 }}
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- hostPath:
path: /etc/localtime
type: ""
name: time-localtime
55 changes: 55 additions & 0 deletions charts/bc-apis/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
description: bc-apis-ingress
displayName: bc-apis-ingress
httpSend: /
ingress-lb: {{ .Values.ingressClassName }}
kubernetes.io/ingress.class: {{ .Values.ingressClassName }}
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_cache static-cache;
proxy_cache_valid 404 10m;
proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504;
proxy_cache_bypass $http_x_purge;
add_header X-Cache-Status $upstream_cache_status; # check X-Cache-Status to see if it's HIT
rewrite ^/bc-apis(/|$)(.*)$ /$2 break;
nginx.ingress.kubernetes.io/enable-access-log: "false"
nginx.ingress.kubernetes.io/enable-rewrite-log: "false"
nginx.ingress.kubernetes.io/load-balance: round_robin
nginx.ingress.kubernetes.io/proxy-body-size: ""
nginx.ingress.kubernetes.io/proxy-buffering: "on"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
nginx.ingress.kubernetes.io/server-alias: ""
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/upstream-vhost: $host
labels:
ingress-lb: {{ .Values.ingressClassName}}
name: {{ .Release.Name }}-ingress
namespace: {{ .Release.Namespace }}
spec:
rules:
- host: portal.{{ .Values.ingressDomain }}
http:
paths:
- backend:
service:
name: {{ .Release.Name }}
port:
number: 8024
path: /bc-public
pathType: ImplementationSpecific
- backend:
service:
name: {{ .Release.Name }}
port:
number: 8024
path: /bc-apis
pathType: ImplementationSpecific
- backend:
service:
name: {{ .Release.Name }}
port:
number: 8025
path: /bc-ws
pathType: ImplementationSpecific
Loading

0 comments on commit 39473b9

Please sign in to comment.