diff --git a/.gitignore b/.gitignore index 741fc81..a7d0eec 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ *.ini /out/ *.exe -/k8s/ .env \ No newline at end of file diff --git a/README.md b/README.md index ff8ca66..4d3cb89 100644 --- a/README.md +++ b/README.md @@ -14,17 +14,18 @@ ## Responsibility -- Gateway for external users. -- Authenticates and authorizes users using security service +- Gateway for external users/services. +- Authenticates and authorizes users. + +| Versions | Descriptors | +|----------|-------------| +| [v0.0.1-beta](https://github.com/klovercloud-ci-cd/api-service/releases/tag/v0.0.1-beta) | [k8s](k8s/v0.0.1-beta) | -| Version | Kubernetes api | Kubernetes client-go | kubernetes apimachinery | -|---------|----------------|----------------------|-------------------------| -| v1 | 1.12.9 | 1.12.9 | 1.12.9 | ## Want to contribute - See [CONTRIBUTING.md](markdownfiles/CONTRIBUTING.md) - See [DEVELOPMENT.md](markdownfiles/DEVELOPMENT.md) to get start -- See [architecture](https://github.com/klovercloud-ci-cd/architecture) +- See [architecture](https://github.com/klovercloud-ci-cd/architecture/blob/master/README.md) - Look at our [our issues](https://github.com/klovercloud-ci-cd/api-service/issues) \ No newline at end of file diff --git a/api/v1/pipeline.go b/api/v1/pipeline.go index 7fda36d..a667ab5 100644 --- a/api/v1/pipeline.go +++ b/api/v1/pipeline.go @@ -113,7 +113,7 @@ var ( // @Failure 404 {object} common.ResponseDTO // @Router /api/v1/pipelines [GET] func (p pipelineApi) Get(context echo.Context) error { - var companyId string + companyId := context.QueryParam("companyId") if config.EnableAuthentication { userResourcePermission, err := GetUserResourcePermissionFromBearerToken(context, p.jwtService) if err != nil { diff --git a/k8s/v0.0.1-beta/api-service-configmap.yaml b/k8s/v0.0.1-beta/api-service-configmap.yaml new file mode 100644 index 0000000..f8566a8 --- /dev/null +++ b/k8s/v0.0.1-beta/api-service-configmap.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: klovercloud-api-service-envar-config + namespace: klovercloud +data: + RUN_MODE: "PRODUCTION" + SERVER_PORT: "8080" + KLOVERCLOUD_CI_INTEGRATION_MANAGER_URL: "http://klovercloud-integration-manager.klovercloud.svc.cluster.local/api/v1" + KLOVERCLOUD_CI_EVENT_STORE: "http://klovercloud-ci-event-bank.klovercloud.svc.cluster.local/api/v1" + KLOVERCLOUD_CI_EVENT_STORE_WS: "ws://klovercloud-ci-event-bank.klovercloud.svc.cluster.local/api/v1" + LIGHTHOUSE_COMMAND_SERVER_URL: "http://klovercloud-ci-light-house-command.klovercloud.svc.cluster.local/api/v1" + LIGHTHOUSE_QUERY_SERVER_URL: "http://klovercloud-ci-light-house-query.klovercloud.svc.cluster.local/api/v1" + PUBLIC_KEY: "" + ENABLE_AUTHENTICATION: "true" + JAEGER_AGENT_HOST: "localhost" + JAEGER_SAMPLER_TYPE: "const" + JAEGER_SAMPLER_PARAM: "1" + JAEGER_REPORTER_LOG_SPANS: "true" + JAEGER_SERVICE_NAME: "api-service" + ENABLE_OPENTRACING: "false" + PRIVATE_KEY_INTERNAL_CALL: "" + PUBLIC_KEY_INTERNAL_CALL: "" \ No newline at end of file diff --git a/k8s/v0.0.1-beta/api-service-deployment.yaml b/k8s/v0.0.1-beta/api-service-deployment.yaml new file mode 100644 index 0000000..0973c06 --- /dev/null +++ b/k8s/v0.0.1-beta/api-service-deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: klovercloud-api-service + namespace: klovercloud +spec: + replicas: 1 + selector: + matchLabels: + app: klovercloud-api-service + template: + metadata: + labels: + app: klovercloud-api-service + spec: + terminationGracePeriodSeconds: 60 + containers: + - name: app + imagePullPolicy: Always + image: quay.io/klovercloud/ci-api-service:v0.0.1-beta + resources: + limits: + cpu: 100m + memory: 256Mi + requests: + cpu: 66m + memory: 256Mi + envFrom: + - configMapRef: + name: klovercloud-api-service-envar-config + ports: + - containerPort: 8080 + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 10 + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 3 \ No newline at end of file diff --git a/k8s/v0.0.1-beta/api-service-service.yaml b/k8s/v0.0.1-beta/api-service-service.yaml new file mode 100644 index 0000000..9f546cd --- /dev/null +++ b/k8s/v0.0.1-beta/api-service-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: klovercloud-api-service + namespace: klovercloud + labels: + app: klovercloud-api-service +spec: + ports: + - name: http-rest + port: 80 + targetPort: 8080 + protocol: TCP + selector: + app: klovercloud-api-service \ No newline at end of file