Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed May 17, 2024
1 parent 9f65be7 commit bc4bf81
Show file tree
Hide file tree
Showing 14 changed files with 353 additions and 24 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/test-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ jobs:
run: |
helm pull oci://registry-1.docker.io/bitnamicharts/wordpress --version ${{ env.WORDPRESS_CHART_VERSION }}
- name: test create-release
id: create-release
- name: test create-release / helm
id: create-release-helm
uses: ./create-release
with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
app-slug: replicated-actions-ci # from the Replicated QA team
chart: wordpress-${{ env.WORDPRESS_CHART_VERSION }}.tgz

- name: test create-release / kots-install
id: create-release-kots-install
uses: replicatedhq/compatibility-actions/create-release@v1
with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
app-slug: replicated-actions-ci # from the Replicated QA team
yaml-dir: ./test/kots-install
19 changes: 1 addition & 18 deletions .github/workflows/test-kots-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ jobs:
- name: build
run: make package-kots-install

- name: pull helm chart
run: |
helm pull oci://registry-1.docker.io/bitnamicharts/wordpress --version ${{ env.WORDPRESS_CHART_VERSION }}
- name: create-release
id: create-release
uses: replicatedhq/compatibility-actions/create-release@v1
with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
app-slug: ${{ env.APP_SLUG }}
chart: wordpress-${{ env.WORDPRESS_CHART_VERSION }}.tgz
yaml-dir: ./test/kots-install

- name: create-customer
id: create-customer
Expand All @@ -60,19 +56,6 @@ jobs:
kubernetes-distribution: kind
timeout-minutes: 5

- name: helm-install
id: helm-install
uses: replicatedhq/compatibility-actions/helm-install@v1
with:
kubeconfig: ${{ steps.create-cluster.outputs.cluster-kubeconfig }}
helm-path: helm
registry-username: ${{ github.ref_name }}@example.com
registry-password: ${{ steps.create-customer.outputs.license-id }}
chart: oci://registry.replicated.com/${{ env.APP_SLUG }}/release__${{ steps.create-release.outputs.release-sequence }}/wordpress
name: wordpress
namespace: default
run-preflights: false

- name: test kots-install
id: kots-install
uses: ./kots-install
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/test-prepare-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
run: |
helm pull oci://registry-1.docker.io/bitnamicharts/wordpress --version ${{ env.WORDPRESS_CHART_VERSION }}
- name: test prepare-cluster
id: prepare-cluster
- name: test prepare-cluster / helm
id: prepare-cluster-helm
uses: ./prepare-cluster
with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
Expand All @@ -49,6 +49,15 @@ jobs:
helm-run-preflights: false
kubernetes-distribution: kind

- name: test prepare-cluster / kots-install
id: prepare-cluster-kots-install
uses: ./prepare-cluster
with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
app-slug: replicated-actions-ci # from the Replicated QA team
yaml-dir: ./test/kots-install
kubernetes-distribution: kind

- name: remove cluster
id: remove-cluster
if: always()
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"esbuild-jest": "^0.5.0",
"randomstring": "^1.2.3",
"replicated-lib": "^0.0.1-beta.16",
"tmp-promise": "^3.0.3"
},
"devDependencies": {
"@types/jest": "^29.5.1",
"@vercel/ncc": "^0.36.1",
"esbuild-jest": "^0.5.0",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1"
Expand Down
28 changes: 28 additions & 0 deletions test/kots-install/example-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-content
data:
index.html: |
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Demo Application</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
This is an example KOTS application.
<p>This is text from a user config value: '{{repl ConfigOption "example_default_value"}}' </p>
</br>
This is a hidden value: '{{repl ConfigOption "hidden_text"}}'
</body>
</html>
styles.css: |
body {
text-align: center;
background-color: rgb(224,224,224);
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
}
35 changes: 35 additions & 0 deletions test/kots-install/example-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
annotations:
backup.velero.io/backup-volumes: nginx-content
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: nginx-content
mountPath: /usr/share/nginx/html/
resources:
limits:
memory: '256Mi'
cpu: '500m'
requests:
memory: '32Mi'
cpu: '100m'
volumes:
- name: nginx-content
configMap:
name: nginx-content
30 changes: 30 additions & 0 deletions test/kots-install/example-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
annotations:
kots.io/when: '{{repl not IsKurl }}'
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
annotations:
kots.io/when: '{{repl IsKurl }}'
spec:
type: NodePort
ports:
- port: 80
nodePort: 8888
selector:
app: nginx
10 changes: 10 additions & 0 deletions test/kots-install/k8s-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
name: "nginx"
spec:
descriptor:
links:
- description: Open App
# needs to match applicationUrl in kots-app.yaml
url: "http://nginx"
15 changes: 15 additions & 0 deletions test/kots-install/kots-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: kots.io/v1beta1
kind: Application
metadata:
name: nginx
spec:
title: App Name
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/kubernetes/icon/color/kubernetes-icon-color.png
statusInformers:
- deployment/nginx
ports:
- serviceName: "nginx"
servicePort: 80
localPort: 8888
applicationUrl: "http://nginx"
44 changes: 44 additions & 0 deletions test/kots-install/kots-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
apiVersion: kots.io/v1beta1
kind: Config
metadata:
name: config-sample
spec:
groups:
- name: example_settings
title: My Example Config
description: Configuration to serve as an example for creating your own. See [https://kots.io/reference/v1beta1/config/](https://kots.io/reference/v1beta1/config/) for configuration docs. In this case, we provide example fields for configuring an Nginx welcome page.
items:
- name: show_text_inputs
title: Customize Text Inputs
help_text: "Show custom user text inputs"
type: bool
default: "0"
recommended: true
- name: example_default_value
title: Text Example (with default value)
type: text
value: ""
default: please change this value
when: repl{{ ConfigOptionEquals "show_text_inputs" "1" }}
- name: api_token
title: API token
type: password
props:
rows: 5
when: repl{{ ConfigOptionEquals "show_text_inputs" "1" }}
validation:
regex:
pattern: ^(?:[\w@#$%^&+=!*()_\-{}[\]:;"'<>,.?\/|]){8,16}$
message: The password must be between 8 and 16 characters long and can contain a combination of uppercase letters, lowercase letters, digits, and special characters.
- name: readonly_text_left
title: Readonly Text
type: text
value: "{{repl RandomString 10}}"
readonly: true
when: repl{{ ConfigOptionEquals "show_text_inputs" "1" }}
- name: hidden_text
title: Secret Key
type: password
hidden: true
value: "{{repl RandomString 40}}"
90 changes: 90 additions & 0 deletions test/kots-install/kots-lint-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: kots.io/v1beta1
kind: LintConfig
metadata:
name: default-lint-config
spec:
rules:
- name: missing-kind-field
level: "error"
- name: missing-api-version-field
level: "error"
- name: preflight-spec
level: "warn"
- name: config-spec
level: "warn"
- name: troubleshoot-spec
level: "warn"
- name: application-spec
level: "warn"
- name: application-icon
level: "warn"
- name: application-statusInformers
level: "warn"
- name: invalid-target-kots-version
level: "error"
- name: invalid-min-kots-version
level: "error"
- name: invalid-kubernetes-installer
level: "error"
- name: deprecated-kubernetes-installer-version
level: "warn"
- name: duplicate-kots-kind
level: "error"
- name: invalid-helm-release-name
level: "error"
- name: duplicate-helm-release-name
level: "error"
- name: replicas-1
level: "info"
- name: privileged
level: "info"
- name: allow-privilege-escalation
level: "info"
- name: container-image-latest-tag
level: "info"
- name: container-image-local-image-name
level: "error"
- name: container-resources
level: "info"
- name: container-resource-limits
level: "info"
- name: container-resource-requests
level: "info"
- name: resource-limits-cpu
level: "info"
- name: resource-limits-memory
level: "info"
- name: resource-requests-cpu
level: "info"
- name: resource-requests-memory
level: "info"
- name: volumes-host-paths
level: "info"
- name: volume-docker-sock
level: "info"
- name: hardcoded-namespace
level: "info"
- name: may-contain-secrets
level: "info"
- name: config-option-invalid-type
level: "error"
- name: repeat-option-missing-template
level: "error"
- name: repeat-option-missing-valuesByGroup
level: "error"
- name: repeat-option-malformed-yamlpath
level: "error"
- name: config-option-password-type
level: "warn"
- name: config-option-not-found
level: "warn"
- name: config-option-is-circular
level: "error"
- name: config-option-not-repeatable
level: "error"
- name: config-option-when-is-invalid
level: "error"
- name: config-option-invalid-regex-validator
level: "error"
- name: config-option-regex-validator-invalid-type
level: "error"
Loading

0 comments on commit bc4bf81

Please sign in to comment.