Skip to content

Commit

Permalink
Wip 150524 (#149)
Browse files Browse the repository at this point in the history
* wip

* wip

* last changes before 0.6.4

* fixed comments
  • Loading branch information
cjlapao authored May 15, 2024
1 parent 9cc3ead commit 4fee6f4
Show file tree
Hide file tree
Showing 20 changed files with 1,128 additions and 11 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added a new unified install script to be used in mac/linux
- Added ability to add/remove tags from catalog manifests
- Added ability to add/remove roles from catalog manifests
- Added ability to add/remove claims from catalog manifests

### Fixed

- Fixed an issue were the executable would not read the configuration file correctly if it was on path
- Fixed an issue were the executable would not read the configuration file
correctly if it was on path
- Fixed an issue were we could not add two hosts with the same url and different
ports
- Improved our helm chart

## [0.6.3] - 2024-05-14

Expand Down
4 changes: 4 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "helm.namespace" -}}
{{- default .Values.namespace | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
1 change: 1 addition & 0 deletions helm/templates/config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
data:
Expand Down
3 changes: 2 additions & 1 deletion helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -169,7 +170,7 @@ spec:
name: {{ include "helm.fullname" . }}
key: SECURITY_ROOT_PASSWORD
{{- end }}
{{- if .Values.ingress.tls.enabled }}
{{- if .Values.security.enable_tls }}
- name: TLS_ENABLED
value: "true"
- name: TLS_CERTIFICATE
Expand Down
1 change: 1 addition & 0 deletions helm/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
Expand Down
32 changes: 32 additions & 0 deletions helm/templates/istio-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if and .Values.ingress.enabled .Values.ingress.istio}}
{{- if .Values.ingress.create_gateway }}
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
selector:
istio: ingress
servers:
- hosts:
- {{ .Values.ingress.host }}
port:
name: http
number: 80
protocol: http
{{- if and .Values.ingress.tls.enabled .Values.ingress.tls.tls_secret_name }}
- hosts:
- {{ .Values.ingress.host }}
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: {{ .Values.ingress.tls.tls_secret_name }}
mode: SIMPLE
{{- end }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion helm/templates/persistent_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
spec:
capacity:
storage: 1Gi
Expand All @@ -11,7 +12,7 @@ spec:
persistentVolumeReclaimPolicy: Delete
storageClassName: manual
local:
path: /mnt/pd-api
path: /mnt/pd-devops-{{ include "helm.fullname" . }}
nodeAffinity:
required:
nodeSelectorTerms:
Expand All @@ -25,6 +26,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
spec:
accessModes:
- ReadWriteOnce
Expand Down
1 change: 1 addition & 0 deletions helm/templates/pod-disruption-budget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
type: Opaque
Expand Down
1 change: 1 addition & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions helm/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "helm.serviceAccountName" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down
5 changes: 5 additions & 0 deletions helm/templates/virtual-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: {{ include "helm.fullname" . }}
namespace: {{ include "helm.namespace" . }}
labels:
{{- include "helm.labels" . | nindent 4 }}
spec:
hosts:
- {{ .Values.ingress.host }}
gateways:
{{- if .Values.ingress.create_gateway }}
- {{ include "helm.fullname" . }}
{{- else }}
- {{ .Values.ingress.gateway }}
{{- end }}
http:
- match:
- ignoreUriCase: true
Expand Down
8 changes: 6 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ replicaCount: 1

image:
repository: cjlapao/prl-devops-service
pullPolicy: IfNotPresent
pullPolicy: always
tag: "latest"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
namespace: default

serviceAccount:
create: true
Expand Down Expand Up @@ -52,6 +53,7 @@ security:
increment_lockout_duration: true
encryption_private_key: ""
root_password: ""
enable_tls: false

service:
type: ClusterIP
Expand All @@ -65,17 +67,19 @@ config:
disableCatalogCaching: false

ingress:
enabled: true
istio: false
prefix: parallels
enabled: true
annotations: {}
gateway: ""
create_gateway: false
host: ""
apiPort: 80
apiPrefix: /api
tls:
enabled: false
port: 443
tls_secret_name: ""
certificate:
privateKey:

Expand Down
56 changes: 56 additions & 0 deletions src/catalog/models/virtual_machine_manifest_patch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package models

import (
"github.com/Parallels/prl-devops-service/catalog/cleanupservice"
)

type VirtualMachineCatalogManifestPatch struct {
RequiredRoles []string `json:"required_roles"`
RequiredClaims []string `json:"required_claims"`
Tags []string `json:"tags"`
CleanupRequest *cleanupservice.CleanupRequest `json:"-"`
Errors []error `json:"-"`
}

func NewVirtualMachineCatalogPatch() *VirtualMachineCatalogManifestPatch {
return &VirtualMachineCatalogManifestPatch{
RequiredRoles: []string{},
RequiredClaims: []string{},
Tags: []string{},
Errors: []error{},
CleanupRequest: cleanupservice.NewCleanupRequest(),
}
}

func (m *VirtualMachineCatalogManifestPatch) Validate() error {
if m.RequiredClaims == nil {
m.RequiredClaims = []string{}
}
if m.RequiredRoles == nil {
m.RequiredRoles = []string{}
}
if m.Tags == nil {
m.Tags = []string{}
}

return nil
}

func (m *VirtualMachineCatalogManifestPatch) HasErrors() bool {
return len(m.Errors) > 0
}

func (m *VirtualMachineCatalogManifestPatch) AddError(err error) {
m.Errors = append(m.Errors, err)
}

func (m *VirtualMachineCatalogManifestPatch) ClearErrors() {
m.Errors = []error{}
}

func (m *VirtualMachineCatalogManifestPatch) NeedsCleanup() bool {
if m.CleanupRequest == nil {
return false
}
return m.CleanupRequest.NeedsCleanup()
}
Loading

0 comments on commit 4fee6f4

Please sign in to comment.