Skip to content

Commit

Permalink
fix(helm): fix for k8s <1.11 and upgrade release version
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed May 3, 2019
1 parent 3c82a67 commit 7ef8b75
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 118 deletions.
24 changes: 0 additions & 24 deletions Dockerfile-dev

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/helm/cds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cds
version: 0.1.0
appVersion: 0.39.0
appVersion: 0.39.2
description: Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform.
keywords:
- continuous-integration
Expand Down
4 changes: 4 additions & 0 deletions contrib/helm/cds/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ spec:
{{- else }}
value: {{ default "" .Values.externalDatabase.password | quote }}
{{- end }}
- name: CDS_API_HTTP_PORT
value: "8081"
- name: CDS_API_GRPC_PORT
value: "8082"
- name: CDS_API_URL_API
value: http://{{ template "cds.fullname" . }}-ui/cdsapi
- name: CDS_API_URL_UI
Expand Down
14 changes: 6 additions & 8 deletions contrib/helm/cds/templates/hatchery-k8s-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
labels:
app: {{ template "cds.fullname" . }}-hatchery-k8s
spec:
serviceAccountName: {{ template "cds.serviceAccount.name" . }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
Expand All @@ -25,17 +26,14 @@ spec:
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
env:
- name: CDS_K8S_FILECONTENT
valueFrom:
secretKeyRef:
name: {{ template "cds.fullname" . }}
key: cds-k8s_config_file
- name: CDS_HATCHERY_KUBERNETES_NAMESPACE
value: "{{ .Release.Namespace }}"
- name: CDS_HATCHERY_KUBERNETES_KUBERNETESCONFIGFILE
value: kubeconfig.yml
- name: CDS_HATCHERY_KUBERNETES_COMMONCONFIGURATION_NAME
value: hatchery-k8s
- name: CDS_HATCHERY_KUBERNETES_KUBERNETESCONFIGFILE
value: ""
- name: CDS_HATCHERY_KUBERNETES_KUBERNETESMASTERURL
value: ""
- name: CDS_HATCHERY_KUBERNETES_COMMONCONFIGURATION_API_HTTP_URL
value: 'http://{{ template "cds.fullname" . }}-api'
- name: CDS_HATCHERY_KUBERNETES_COMMONCONFIGURATION_API_TOKEN
Expand All @@ -48,7 +46,7 @@ spec:
- name: CDS_URL
value: 'http://{{ template "cds.fullname" . }}-hatchery-k8s'
command: ["/bin/sh"]
args: ["-c", "echo $CDS_K8S_FILECONTENT | base64 --decode > kubeconfig.yml && /app/cds-engine-linux-amd64 start hatchery:kubernetes"]
args: ["-c", "/app/cds-engine-linux-amd64 start hatchery:kubernetes"]
ports:
- name: http
containerPort: 8086
6 changes: 3 additions & 3 deletions contrib/helm/cds/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Role
metadata:
name: {{ template "cds.fullname" . }}
labels:
app: {{ template "cds.fullname" . }}-api
app: {{ template "cds.fullname" . }}-hatchery
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -14,14 +14,14 @@ rules:
verbs: ["get", "list", "create", "update", "delete"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["list", "create"]
verbs: ["get", "list", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ template "cds.fullname" . }}
labels:
app: {{ template "cds.fullname" . }}-api
app: {{ template "cds.fullname" . }}-hatchery
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand Down
2 changes: 1 addition & 1 deletion contrib/helm/cds/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
name: {{ template "cds.serviceAccount.name" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "cds.fullname" . }}-api
app: {{ template "cds.fullname" . }}-hatchery
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
Expand Down
4 changes: 2 additions & 2 deletions contrib/helm/cds/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
image:
registry: docker.io
repository: ovhcom/cds-engine
tag: 0.39.0
tag: 0.39.2
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
Expand Down Expand Up @@ -172,7 +172,7 @@ ui:
image:
registry: docker.io
repository: ovhcom/cds-ui
tag: 0.39.0
tag: 0.39.2
logLevel: info
baseUrl: /
api.livenessProbe:
Expand Down
4 changes: 4 additions & 0 deletions engine/elasticsearch/elasticsearch_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"strconv"
"strings"

"gopkg.in/olivere/elastic.v5"

Expand Down Expand Up @@ -34,6 +35,9 @@ func (s *Service) getEventsHandler() service.Handler {

result, errR := esClient.Search().Index(s.Cfg.ElasticSearch.IndexEvents).Type("sdk.EventRunWorkflow").Query(boolQuery).Sort("timestamp", false).From(filters.CurrentItem).Size(15).Do(context.Background())
if errR != nil {
if strings.Contains(errR.Error(), "index_not_found_exception") {
return service.WriteJSON(w, nil, http.StatusOK)
}
return sdk.WrapError(errR, "Cannot get result on index: %s", s.Cfg.ElasticSearch.IndexEvents)
}
return service.WriteJSON(w, result.Hits.Hits, http.StatusOK)
Expand Down
54 changes: 26 additions & 28 deletions engine/hatchery/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,36 @@ func (h *HatcheryKubernetes) ApplyConfiguration(cfg interface{}) error {
var clientSet *kubernetes.Clientset
k8sTimeout := time.Second * 10

if h.Config.KubernetesMasterURL != "" {
if h.Config.KubernetesConfigFile != "" {
cfg, err := clientcmd.BuildConfigFromFlags(h.Config.KubernetesMasterURL, h.Config.KubernetesConfigFile)
if err != nil {
return sdk.WrapError(err, "Cannot build config from flags")
}
cfg.Timeout = k8sTimeout
if h.Config.KubernetesConfigFile != "" {
cfg, err := clientcmd.BuildConfigFromFlags(h.Config.KubernetesMasterURL, h.Config.KubernetesConfigFile)
if err != nil {
return sdk.WrapError(err, "Cannot build config from flags")
}
cfg.Timeout = k8sTimeout

clientSet, errCl = kubernetes.NewForConfig(cfg)
if errCl != nil {
return sdk.WrapError(errCl, "Cannot create client with newForConfig")
}
} else {
configK8s, err := clientcmd.BuildConfigFromKubeconfigGetter(h.Config.KubernetesMasterURL, h.getStartingConfig)
if err != nil {
return sdk.WrapError(err, "Cannot build config from config getter")
}
configK8s.Timeout = k8sTimeout
clientSet, errCl = kubernetes.NewForConfig(cfg)
if errCl != nil {
return sdk.WrapError(errCl, "Cannot create client with newForConfig")
}
} else if h.Config.KubernetesMasterURL != "" {
configK8s, err := clientcmd.BuildConfigFromKubeconfigGetter(h.Config.KubernetesMasterURL, h.getStartingConfig)
if err != nil {
return sdk.WrapError(err, "Cannot build config from config getter")
}
configK8s.Timeout = k8sTimeout

if h.Config.KubernetesCertAuthData != "" {
configK8s.TLSClientConfig = rest.TLSClientConfig{
CAData: []byte(h.Config.KubernetesCertAuthData),
CertData: []byte(h.Config.KubernetesClientCertData),
KeyData: []byte(h.Config.KubernetesClientKeyData),
}
if h.Config.KubernetesCertAuthData != "" {
configK8s.TLSClientConfig = rest.TLSClientConfig{
CAData: []byte(h.Config.KubernetesCertAuthData),
CertData: []byte(h.Config.KubernetesClientCertData),
KeyData: []byte(h.Config.KubernetesClientKeyData),
}
}

// creates the clientset
clientSet, errCl = kubernetes.NewForConfig(configK8s)
if errCl != nil {
return sdk.WrapError(errCl, "Cannot create new config")
}
// creates the clientset
clientSet, errCl = kubernetes.NewForConfig(configK8s)
if errCl != nil {
return sdk.WrapError(errCl, "Cannot create new config")
}
} else {
config, err := rest.InClusterConfig()
Expand Down
2 changes: 1 addition & 1 deletion engine/hatchery/kubernetes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type HatcheryConfiguration struct {
// KubernetesMasterURL Address of kubernetes master
KubernetesMasterURL string `mapstructure:"kubernetesMasterURL" toml:"kubernetesMasterURL" default:"" commented:"false" comment:"Address of kubernetes master" json:"kubernetesMasterURL"`
// KubernetesConfigFile Kubernetes config file in yaml
KubernetesConfigFile string `mapstructure:"kubernetesConfigFile" toml:"kubernetesConfigFile" default:"kubeconfig.yaml" commented:"false" comment:"Kubernetes config file in yaml" json:"kubernetesConfigFile"`
KubernetesConfigFile string `mapstructure:"kubernetesConfigFile" toml:"kubernetesConfigFile" default:"" commented:"false" comment:"Kubernetes config file in yaml" json:"kubernetesConfigFile"`
// KubernetesUsername Username to connect to kubernetes cluster (optional if config file is set)
KubernetesUsername string `mapstructure:"username" toml:"username" default:"" commented:"true" comment:"Username to connect to kubernetes cluster (optional if config file is set)" json:"username"`
// KubernetesPassword Password to connect to kubernetes cluster (optional if config file is set)
Expand Down
100 changes: 50 additions & 50 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,41 @@
},
"private": true,
"dependencies": {
"@angular/animations": "7.2.14",
"@angular/common": "7.2.14",
"@angular/compiler": "7.2.14",
"@angular/core": "7.2.14",
"@angular/forms": "7.2.14",
"@angular/http": "7.2.14",
"@angular/platform-browser": "7.2.14",
"@angular/platform-browser-dynamic": "7.2.14",
"@angular/router": "7.2.14",
"@angular/animations": "7.2.2",
"@angular/common": "7.2.2",
"@angular/compiler": "7.2.2",
"@angular/core": "7.2.2",
"@angular/forms": "7.2.2",
"@angular/http": "7.2.2",
"@angular/platform-browser": "7.2.2",
"@angular/platform-browser-dynamic": "7.2.2",
"@angular/router": "7.2.2",
"@ngui/auto-complete": "2.0.0",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"@ngxs/devtools-plugin": "3.4.3",
"@ngxs/logger-plugin": "3.4.3",
"@ngxs/store": "3.4.3",
"@swimlane/ngx-charts": "10.1.0",
"@types/dagre-d3": "0.4.39",
"@ngxs/devtools-plugin": "3.3.4",
"@ngxs/logger-plugin": "3.3.4",
"@ngxs/store": "3.3.4",
"@swimlane/ngx-charts": "10.0.0",
"@types/dagre-d3": "0.4.38",
"angular2-moment": "1.9.0",
"angular2-prettyjson": "3.0.1",
"angular2-toaster": "7.0.0",
"animate.css": "3.7.0",
"ansi_up": "4.0.3",
"codemirror": "5.46.0",
"core-js": "3.0.1",
"d3": "5.9.2",
"ansi_up": "3.0.0",
"codemirror": "5.43.0",
"core-js": "2.6.3",
"d3": "5.7.0",
"d3-zoom": "1.7.3",
"dagre-d3": "0.6.3",
"diff": "4.0.1",
"dragula": "3.7.2",
"duration-js": "4.0.0",
"enhanced-resolve": "4.1.0",
"fast-json-patch": "2.1.0",
"fast-json-patch": "2.0.7",
"font-awesome": "4.7.0",
"immutable": "4.0.0-rc.12",
"js-beautify": "1.9.1",
"js-beautify": "1.8.9",
"lodash": "4.17.11",
"moment": "2.24.0",
"ng-event-source": "1.0.14",
Expand All @@ -79,49 +79,49 @@
"ng2-dragula": "2.1.1",
"ng2-semantic-ui": "git+https://git@github.com/bnjjj/ng2-semantic-ui.git#dist",
"ngx-auto-scroll": "1.1.0",
"ngx-clipboard": "12.0.0",
"ngx-infinite-scroll": "7.1.0",
"ngx-markdown": "7.1.5",
"prismjs": "1.16.0",
"ngx-clipboard": "11.1.9",
"ngx-infinite-scroll": "7.0.1",
"ngx-markdown": "7.1.2",
"prismjs": "1.15.0",
"raven-js": "3.27.0",
"rxjs": "6.5.1",
"rxjs-compat": "6.5.1",
"sanitize-html": "1.20.1",
"semantic-ui": "2.4.2",
"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",
"sanitize-html": "1.20.0",
"semantic-ui": "2.2.13",
"spinkit": "1.2.5",
"string-format-obj": "1.1.1",
"ts-helpers": "1.1.2",
"zone.js": "0.9.0"
"zone.js": "0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.13.8",
"@angular/cli": "7.3.8",
"@angular/compiler-cli": "7.2.14",
"@compodoc/compodoc": "1.1.9",
"@sentry/cli": "1.41.2",
"@types/d3": "5.7.2",
"@types/dagre": "0.7.41",
"@types/jasmine": "3.3.12",
"@angular-devkit/build-angular": "0.12.3",
"@angular/cli": "7.2.3",
"@angular/compiler-cli": "7.2.2",
"@compodoc/compodoc": "1.1.7",
"@sentry/cli": "1.37.4",
"@types/d3": "5.7.0",
"@types/dagre": "0.7.40",
"@types/jasmine": "3.3.8",
"@types/jasminewd2": "2.0.6",
"@types/lodash": "4.14.123",
"@types/node": "11.13.8",
"codelyzer": "5.0.1",
"copy-webpack-plugin": "5.0.3",
"husky": "2.1.0",
"jasmine-core": "3.4.0",
"@types/lodash": "4.14.120",
"@types/node": "10.12.18",
"codelyzer": "4.5.0",
"copy-webpack-plugin": "4.6.0",
"husky": "1.3.1",
"jasmine-core": "3.3.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.1.0",
"karma": "4.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.5",
"karma-coverage-istanbul-reporter": "2.0.4",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"karma-jasmine-html-reporter": "1.4.0",
"karma-junit-reporter": "1.2.0",
"lint-staged": "git+https://github.com/bnjjj/lint-staged.git#master",
"node-sass": "4.11.0",
"ts-node": "8.1.0",
"tslint": "5.16.0",
"typescript": "3.4.5",
"webdriver-manager": "12.1.2",
"ts-node": "8.0.2",
"tslint": "5.12.1",
"typescript": "3.2.4",
"webdriver-manager": "12.1.1",
"wrench-sui": "0.0.3"
}
}

0 comments on commit 7ef8b75

Please sign in to comment.