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

improve a few helm chart features #87

Merged
merged 1 commit into from
Dec 15, 2023
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
4 changes: 2 additions & 2 deletions charts/kubechecks/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: kubechecks
description: A Helm chart for kubechecks
version: 0.3.2
appVersion: "1.0.10"
version: 0.4.0
appVersion: "1.1.1"
type: application
maintainers:
- name: zapier
8 changes: 5 additions & 3 deletions charts/kubechecks/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{{ if .Values.configMap.create }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "kubechecks.name" . }}
labels:
{{ include "kubechecks.labels" . | indent 4 }}
data:
{{- range $index, $element := .Values.deployment.env }}
{{ $index | quote }}: {{ $element | quote }}
{{- end }}
{{- range $key, $value := .Values.configMap.env }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{ end }}
19 changes: 10 additions & 9 deletions charts/kubechecks/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ spec:
args: {{ . | toYaml | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.configMap.create }}
- configMapRef:
name: {{ include "kubechecks.name" . }}
{{- end }}
{{- if .Values.secrets.create }}
- secretRef:
name: {{ include "kubechecks.secretsName" . }}
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: KUBECHECKS_OTEL_COLLECTOR_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
{{- end }}
{{- with .Values.deployment.envFrom }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.deployment.env }}
env: {{ . | toYaml | nindent 12 }}
{{- end }}
ports:
- name: {{ .Values.service.name }}
containerPort: 8080
Expand Down
2 changes: 1 addition & 1 deletion charts/kubechecks/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ data:
{{- range $k, $v := .Values.secrets.env }}
{{ $k| quote }}: {{ $v | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 3 additions & 2 deletions charts/kubechecks/tests/basics.min-values.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
deployment:
configMap:
create: true
env:
KUBECHECKS_ARGOCD_API_INSECURE: "false"
KUBECHECKS_TEST_VALUE: "Hello"

ingress:
create: true
annotations:
kubernetes.io/ingress.class: an-ingress-class
kubernetes.io/ingress.class: an-ingress-class
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,21 @@ tests:
value:
- name: test-volume
path: /ghi
- it: can have new envFrom
set:
deployment:
envFrom:
- configMapRef:
name: new-configmap
- secretMap:
name: new-secret
asserts:
- equal:
path: spec.template.spec.containers[0].envFrom
value:
- configMapRef:
name: kubechecks
- configMapRef:
name: new-configmap
- secretMap:
name: new-secret
217 changes: 217 additions & 0 deletions charts/kubechecks/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
{
"$defs": {
"key-value-map": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"type": "object",
"properties": {
"autoscaling": {
"type": "object",
"additionalProperties": false,
"properties": {
"create": {
"type": "boolean"
},
"minReplicas": {
"type": "integer"
},
"maxReplicas": {
"type": "integer"
},
"targetCPUUtilizationPercentage": {
"type": "integer"
},
"targetMemoryUtilizationPercentage": {
"type": "integer"
}
}
},
"commonLabels": {
"$ref": "#/$defs/key-value-map"
},
"deployment": {
"type": "object",
"additionalProperties": false,
"properties": {
"affinity": {
"type": "object"
},
"annotations": {
"$ref": "#/$defs/key-value-map"
},
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"type": "array"
},
"envFrom": {
"type": "array"
},
"image": {
"type": "object",
"additionalProperties": false,
"properties": {
"pullPolicy": {
"type": "string"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
},
"required": [
"name",
"pullPolicy",
"tag"
]
},
"imagePullSecrets": {
"type": "array"
},
"livenessProbe": {
"type": "object"
},
"nodeSelector": {
"type": "object"
},
"podAnnotations": {
"$ref": "#/$defs/key-value-map"
},
"podSecurityContext": {
"type": "object"
},
"readinessProbe": {
"type": "object"
},
"replicaCount": {
"type": "integer"
},
"resources": {
"type": "object"
},
"securityContext": {
"type": "object"
},
"startupProbe": {
"type": "object"
},
"tolerations": {
"type": "array"
},
"volumes": {
"type": "array"
},
"volumeMounts": {
"type": "array"
}
}
},
"ingress": {
"type": "object",
"additionalProperties": false,
"properties": {
"annotations": {
"$ref": "#/$defs/key-value-map"
},
"create": {
"type": "boolean"
},
"className": {
"type": "string"
},
"hosts": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"paths": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"pathType": {
"type": "string"
}
}
},
"minItems": 1
}
}
}
},
"labels": {
"$ref": "#/$defs/key-value-map"
},
"tls": {
"type": "array"
}
}
},
"secrets": {
"type": "object",
"additionalProperties": false,
"properties": {
"create": {
"type": "boolean"
},
"name": {
"type": "string"
},
"env": {
"$ref": "#/$defs/key-value-map"
}
}
},
"service": {
"type": "object",
"additionalProperties": false,
"properties": {
"create": {
"type": "boolean"
},
"type": {
"type": "string"
},
"port": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"serviceAccount": {
"type": "object",
"additionalProperties": false,
"properties": {
"annotations": {
"$ref": "#/$defs/key-value-map"
},
"create": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"name": {
"type": "string"
}
}
}
}
}
38 changes: 21 additions & 17 deletions charts/kubechecks/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Labels to apply to all resources created by this Helm chart
commonLabels: {}

configMap:
create: false
env: {}
# KUBECHECKS_ARGOCD_API_INSECURE: "false"
# KUBECHECKS_ARGOCD_API_PATH_PREFIX: /
# KUBECHECKS_ARGOCD_WEBHOOK_URL: https://argocd.<domain.com>/api/webhook
# KUBECHECKS_FALLBACK_K8S_VERSION: "1.22.0"
# KUBECHECKS_LOG_LEVEL: debug
# KUBECHECKS_NAMESPACE: kubechecks
# KUBECHECKS_WEBHOOK_URL_BASE: https://kubechecks.<domain.com>.
# KUBECHECKS_WEBHOOK_URL_PREFIX: kubechecks
# KUBECHECKS_ARGOCD_API_SERVER_ADDR: argocd.<domain.com>
# ARGOCD_EXEC_TIMEOUT: 600s
# KUBECHECKS_OTEL_COLLECTOR_PORT: "4317"
# KUBECHECKS_OTEL_ENABLED: "true"
# KUBECHECKS_VCS_TYPE: "github"
# KUBECHECKS_TIDY_OUTDATED_COMMENTS_MODE: "hide" # other options delete

deployment:
annotations: {}
# reloader.stakater.com/auto: "true"
Expand Down Expand Up @@ -45,21 +63,9 @@ deployment:
# - ALL
# readOnlyRootFilesystem: false

env:
# KUBECHECKS_ARGOCD_API_INSECURE: "false"
# KUBECHECKS_ARGOCD_API_PATH_PREFIX: /
# KUBECHECKS_ARGOCD_WEBHOOK_URL: https://argocd.<domain.com>/api/webhook
# KUBECHECKS_FALLBACK_K8S_VERSION: "1.22.0"
# KUBECHECKS_LOG_LEVEL: debug
# KUBECHECKS_NAMESPACE: kubechecks
# KUBECHECKS_WEBHOOK_URL_BASE: https://kubechecks.<domain.com>.
# KUBECHECKS_WEBHOOK_URL_PREFIX: kubechecks
# KUBECHECKS_ARGOCD_API_SERVER_ADDR: argocd.<domain.com>
# ARGOCD_EXEC_TIMEOUT: 600s
# KUBECHECKS_OTEL_COLLECTOR_PORT: "4317"
# KUBECHECKS_OTEL_ENABLED: "true"
# KUBECHECKS_VCS_TYPE: "github"
# KUBECHECKS_TIDY_OUTDATED_COMMENTS_MODE: "hide" # other options delete
env: []

envFrom: []

startupProbe:
failureThreshold: 30
Expand Down Expand Up @@ -91,7 +97,6 @@ secrets:
env: {}
# KUBECHECKS_VCS_TOKEN: <token>


serviceAccount:
# Specifies whether a service account should be created or used
create: true
Expand Down Expand Up @@ -124,7 +129,6 @@ ingress:
# hosts:
# - kubechecks.example.com


autoscaling:
create: false
# minReplicas: 1
Expand Down
4 changes: 2 additions & 2 deletions pkg/github_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func (c *Client) CreateRepo(_ context.Context, payload interface{}) (*repo.Repo,
switch p := payload.(type) {
case *github.PullRequestEvent:
switch p.GetAction() {
case "opened", "synchronize", "reopened":
log.Info().Str("action", p.GetAction()).Msg("handling Github open, sync event from PR")
case "opened", "synchronize", "reopened", "edited":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helm chart eh? ;)

log.Info().Str("action", p.GetAction()).Msg("handling Github event from PR")
return buildRepoFromEvent(p), nil
default:
log.Info().Str("action", p.GetAction()).Msg("ignoring Github pull request event due to non commit based action")
Expand Down