-
Notifications
You must be signed in to change notification settings - Fork 0
Add a basic test for mosquitto kustomization #83
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| name: Run Kustomization Tests | ||
|
|
||
| on: # yamllint disable-line rule:truthy | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - .github/workflows/kustomization-tests.yml | ||
| - ansible/playbooks/kustomization_test.yml | ||
| - ansible/roles/minikube_test/** | ||
| - kustomization/tests/** | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - .github/workflows/kustomization-tests.yml | ||
| - ansible/playbooks/kustomization_test.yml | ||
| - ansible/roles/minikube_test/** | ||
| - kustomization/tests/** | ||
|
|
||
| jobs: | ||
| build-container: | ||
| env: | ||
| EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }} | ||
| EARTHLY_ORG: marinatedconcrete | ||
| EARTHLY_SATELLITE: config-repo | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - uses: earthly/actions-setup@v1.0.8 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| # renovate: datasource=docker depName=earthly/earthly | ||
| version: "v0.7.21" | ||
| - uses: actions/checkout@v4.1.1 | ||
|
|
||
| - name: Build Image | ||
| env: | ||
| EARTHLY_CI: true | ||
| run: earthly --allow-privileged +kustomization-tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,8 @@ tags: | |
| # collection label 'namespace.name'. The value is a version range | ||
| # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version | ||
| # range specifiers can be set and are separated by ',' | ||
| dependencies: {} | ||
| dependencies: | ||
| "kubernetes.core": ">=2.0.0" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you not want to pin an exact version & bump w/renovate?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm of two minds here. While it's useful for us here to pin the version, it's not how you would typically releases these. I would like to use it in my repo as well, and I have other roles/collections that might then conflict with a pinned version. |
||
|
|
||
| # The URL of the originating SCM repository | ||
| repository: https://github.com/marinatedconcrete/config | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| - force_handlers: yes | ||
| gather_facts: no | ||
| hosts: localhost | ||
| roles: | ||
| - role: minikube_test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| # defaults file for minikube_test | ||
|
|
||
| # renovate: datasource=github-releases depName=kubernetes/kubernetes | ||
| kubernetes_version: v1.28.3 | ||
|
|
||
| # The number of nodes needed for the test. | ||
| minikube_nodes: 1 | ||
|
|
||
| # The directory to pass to kustomize for the test. | ||
| kustomization_dir: "{{ test_dir }}" | ||
|
|
||
| # The name of the test. | ||
| test_name: "{{ kustomization_dir.split('/')[-1] }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| # handlers file for minikube_test | ||
| - name: Stop minikube | ||
| ansible.builtin.command: | ||
| argv: | ||
| - minikube | ||
| - stop | ||
| - "--profile={{ test_name }}" | ||
| listen: stop minikube | ||
| notify: delete minikube | ||
| - name: Delete minikube | ||
| ansible.builtin.command: | ||
| argv: | ||
| - minikube | ||
| - delete | ||
| - "--profile={{ test_name }}" | ||
| listen: delete minikube |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| galaxy_info: | ||
| author: sdwilsh | ||
| description: Role to run tests of kustomizations against minikube. | ||
| license: BSD-3-Clause | ||
| min_ansible_version: 2.1 | ||
| galaxy_tags: [] | ||
| dependencies: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| # tasks file for minikube_test | ||
| - name: Start minikube | ||
| ansible.builtin.command: | ||
| argv: | ||
| - minikube | ||
| - start | ||
| - --interactive=false | ||
| - "--profile={{ test_name }}" | ||
| - "--kubernetes-version={{ kubernetes_version }}" | ||
| - --force | ||
| notify: stop minikube | ||
| - name: Apply kustomization | ||
| kubernetes.core.k8s: | ||
| apply: yes | ||
| context: "{{ test_name }}" | ||
| definition: "{{ lookup('kubernetes.core.kustomize', dir=test_dir) }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| # vars file for minikube_test | ||
|
|
||
| # The kustomization directory to apply for the test. | ||
| test_dir: | ||
|
sdwilsh marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| components: | ||
| - ../../components/mosquitto | ||
| namespace: mosquitto-test | ||
| resources: | ||
| - namespace.yml | ||
| - secret.yml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| labels: | ||
| pod-security.kubernetes.io/enforce: restricted | ||
| pod-security.kubernetes.io/enforce-version: latest | ||
| name: mosquitto-test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: mosquitto-password-conf-secret | ||
| stringData: | ||
| someuser: super-secure-unhashed-password |
Uh oh!
There was an error while loading. Please reload this page.