-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac5c193
commit 5ea15e0
Showing
4 changed files
with
324 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package servicetypes | ||
|
||
import ( | ||
"fmt" | ||
|
||
appsv1 "k8s.io/api/apps/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
) | ||
|
||
var defaultValkeyPort int32 = 6379 | ||
|
||
var valkey = ServiceType{ | ||
Name: "valkey", | ||
Ports: ServicePorts{ | ||
Ports: []corev1.ServicePort{ | ||
{ | ||
Port: defaultValkeyPort, | ||
TargetPort: intstr.IntOrString{ | ||
Type: intstr.Int, | ||
IntVal: defaultValkeyPort, | ||
}, | ||
Protocol: corev1.ProtocolTCP, | ||
Name: fmt.Sprintf("%d-tcp", defaultValkeyPort), | ||
}, | ||
}, | ||
}, | ||
PrimaryContainer: ServiceContainer{ | ||
Name: "valkey", | ||
Container: corev1.Container{ | ||
ImagePullPolicy: corev1.PullAlways, | ||
SecurityContext: &corev1.SecurityContext{}, | ||
Ports: []corev1.ContainerPort{ | ||
{ | ||
Name: fmt.Sprintf("%d-tcp", defaultValkeyPort), | ||
ContainerPort: defaultValkeyPort, | ||
Protocol: corev1.ProtocolTCP, | ||
}, | ||
}, | ||
ReadinessProbe: &corev1.Probe{ | ||
ProbeHandler: corev1.ProbeHandler{ | ||
TCPSocket: &corev1.TCPSocketAction{ | ||
Port: intstr.IntOrString{ | ||
Type: intstr.Int, | ||
IntVal: defaultValkeyPort, | ||
}, | ||
}, | ||
}, | ||
InitialDelaySeconds: 1, | ||
TimeoutSeconds: 1, | ||
}, | ||
LivenessProbe: &corev1.Probe{ | ||
ProbeHandler: corev1.ProbeHandler{ | ||
TCPSocket: &corev1.TCPSocketAction{ | ||
Port: intstr.IntOrString{ | ||
Type: intstr.Int, | ||
IntVal: defaultValkeyPort, | ||
}, | ||
}, | ||
}, | ||
InitialDelaySeconds: 120, | ||
TimeoutSeconds: 1, | ||
}, | ||
Resources: corev1.ResourceRequirements{ | ||
Requests: corev1.ResourceList{ | ||
corev1.ResourceCPU: resource.MustParse("10m"), | ||
corev1.ResourceMemory: resource.MustParse("10Mi"), | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
var valkeyPersistent = ServiceType{ | ||
Name: "valkey-persistent", | ||
Ports: valkey.Ports, | ||
ProvidesPersistentVolume: true, | ||
PrimaryContainer: ServiceContainer{ | ||
Name: valkey.PrimaryContainer.Name, | ||
Container: valkey.PrimaryContainer.Container, | ||
}, | ||
Volumes: ServiceVolume{ | ||
PersistentVolumeSize: "5Gi", | ||
PersistentVolumeType: corev1.ReadWriteOnce, | ||
PersistentVolumePath: "/data", | ||
BackupConfiguration: BackupConfiguration{ | ||
Command: `/bin/sh -c "timeout 5400 tar -cf - -C {{ if .ServiceValues.PersistentVolumePath }}{{.ServiceValues.PersistentVolumePath}}{{else}}{{.ServiceTypeValues.Volumes.PersistentVolumePath}}{{end}} ."`, | ||
FileExtension: ".{{ .ServiceValues.OverrideName }}.tar", | ||
}, | ||
}, | ||
Strategy: appsv1.DeploymentStrategy{ | ||
Type: appsv1.RecreateDeploymentStrategyType, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 187 additions & 0 deletions
187
internal/templating/services/test-resources/deployment/result-valkey-1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
lagoon.sh/branch: environment-name | ||
lagoon.sh/version: v2.x.x | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/instance: valkey | ||
app.kubernetes.io/managed-by: build-deploy-tool | ||
app.kubernetes.io/name: valkey | ||
lagoon.sh/buildType: branch | ||
lagoon.sh/environment: environment-name | ||
lagoon.sh/environmentType: production | ||
lagoon.sh/project: example-project | ||
lagoon.sh/service: valkey | ||
lagoon.sh/service-type: valkey | ||
lagoon.sh/template: valkey-0.1.0 | ||
name: valkey | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/instance: valkey | ||
app.kubernetes.io/name: valkey | ||
strategy: {} | ||
template: | ||
metadata: | ||
annotations: | ||
lagoon.sh/branch: environment-name | ||
lagoon.sh/configMapSha: 32bf1359ac92178c8909f0ef938257b477708aa0d78a5a15ad7c2d7919adf273 | ||
lagoon.sh/version: v2.x.x | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/instance: valkey | ||
app.kubernetes.io/managed-by: build-deploy-tool | ||
app.kubernetes.io/name: valkey | ||
lagoon.sh/buildType: branch | ||
lagoon.sh/environment: environment-name | ||
lagoon.sh/environmentType: production | ||
lagoon.sh/project: example-project | ||
lagoon.sh/service: valkey | ||
lagoon.sh/service-type: valkey | ||
lagoon.sh/template: valkey-0.1.0 | ||
spec: | ||
containers: | ||
- env: | ||
- name: LAGOON_GIT_SHA | ||
value: "0" | ||
- name: CRONJOBS | ||
- name: SERVICE_NAME | ||
value: valkey | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
image: harbor.example.com/example-project/environment-name/valkey@latest | ||
imagePullPolicy: Always | ||
livenessProbe: | ||
initialDelaySeconds: 120 | ||
tcpSocket: | ||
port: 6379 | ||
timeoutSeconds: 1 | ||
name: valkey | ||
ports: | ||
- containerPort: 6379 | ||
name: 6379-tcp | ||
protocol: TCP | ||
readinessProbe: | ||
initialDelaySeconds: 1 | ||
tcpSocket: | ||
port: 6379 | ||
timeoutSeconds: 1 | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 10Mi | ||
securityContext: {} | ||
enableServiceLinks: false | ||
imagePullSecrets: | ||
- name: lagoon-internal-registry-secret | ||
priorityClassName: lagoon-priority-production | ||
securityContext: | ||
fsGroup: 10001 | ||
fsGroupChangePolicy: OnRootMismatch | ||
runAsGroup: 0 | ||
runAsUser: 10000 | ||
status: {} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
lagoon.sh/branch: environment-name | ||
lagoon.sh/version: v2.x.x | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/instance: valkey-persist | ||
app.kubernetes.io/managed-by: build-deploy-tool | ||
app.kubernetes.io/name: valkey-persistent | ||
lagoon.sh/buildType: branch | ||
lagoon.sh/environment: environment-name | ||
lagoon.sh/environmentType: production | ||
lagoon.sh/project: example-project | ||
lagoon.sh/service: valkey-persist | ||
lagoon.sh/service-type: valkey-persistent | ||
lagoon.sh/template: valkey-persistent-0.1.0 | ||
name: valkey-persist | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/instance: valkey-persist | ||
app.kubernetes.io/name: valkey-persistent | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
annotations: | ||
k8up.syn.tools/backupcommand: /bin/sh -c "timeout 5400 tar -cf - -C /data | ||
." | ||
k8up.syn.tools/file-extension: .valkey-persist.tar | ||
lagoon.sh/branch: environment-name | ||
lagoon.sh/configMapSha: 32bf1359ac92178c8909f0ef938257b477708aa0d78a5a15ad7c2d7919adf273 | ||
lagoon.sh/version: v2.x.x | ||
creationTimestamp: null | ||
labels: | ||
app.kubernetes.io/instance: valkey-persist | ||
app.kubernetes.io/managed-by: build-deploy-tool | ||
app.kubernetes.io/name: valkey-persistent | ||
lagoon.sh/buildType: branch | ||
lagoon.sh/environment: environment-name | ||
lagoon.sh/environmentType: production | ||
lagoon.sh/project: example-project | ||
lagoon.sh/service: valkey-persist | ||
lagoon.sh/service-type: valkey-persistent | ||
lagoon.sh/template: valkey-persistent-0.1.0 | ||
spec: | ||
containers: | ||
- env: | ||
- name: LAGOON_GIT_SHA | ||
value: "0" | ||
- name: CRONJOBS | ||
- name: SERVICE_NAME | ||
value: valkey-persist | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
image: harbor.example.com/example-project/environment-name/valkey-persist@latest | ||
imagePullPolicy: Always | ||
livenessProbe: | ||
initialDelaySeconds: 120 | ||
tcpSocket: | ||
port: 6379 | ||
timeoutSeconds: 1 | ||
name: valkey | ||
ports: | ||
- containerPort: 6379 | ||
name: 6379-tcp | ||
protocol: TCP | ||
readinessProbe: | ||
initialDelaySeconds: 1 | ||
tcpSocket: | ||
port: 6379 | ||
timeoutSeconds: 1 | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 10Mi | ||
securityContext: {} | ||
volumeMounts: | ||
- mountPath: /data | ||
name: valkey-persist | ||
enableServiceLinks: false | ||
imagePullSecrets: | ||
- name: lagoon-internal-registry-secret | ||
priorityClassName: lagoon-priority-production | ||
securityContext: | ||
fsGroup: 10001 | ||
fsGroupChangePolicy: OnRootMismatch | ||
runAsGroup: 0 | ||
runAsUser: 10000 | ||
volumes: | ||
- name: valkey-persist | ||
persistentVolumeClaim: | ||
claimName: valkey-persist | ||
status: {} |