Add dummy pipelines

This commit is contained in:
Nikolai Rodionov 2024-04-01 14:22:07 +02:00
parent d44ccf830c
commit 217a105a5c
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
5 changed files with 52 additions and 75 deletions

View File

@ -1,8 +0,0 @@
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: custom-addresspool
namespace: metallb-system
spec:
addresses:
- 192.168.5.15-192.168.5.15

View File

@ -1,20 +1,8 @@
apiVersion: tekton.dev/v1beta1 apiVersion: tekton.dev/v1beta1
kind: PipelineRun kind: PipelineRun
metadata: metadata:
name: generate-ssh-key name: hetzner-k3s
spec: spec:
pipelineRef: pipelineRef:
name: generate-ssh-key name: hetzner-k3s
params:
- name: username
value: "Tekton"
workspaces:
- name: outputs
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce # access mode may affect how you can use this volume in parallel tasks
resources:
requests:
storage: 1Gi
serviceAccountName: default serviceAccountName: default

View File

@ -1,17 +1,15 @@
apiVersion: tekton.dev/v1beta1 apiVersion: tekton.dev/v1beta1
kind: Pipeline kind: Pipeline
metadata: metadata:
name: generate-ssh-key name: hetzner-k3s
spec: spec:
workspaces:
- name: outputs
params:
- name: username
type: string
tasks: tasks:
- name: generate-key - name: generate-ssh-keys
taskRef: taskRef:
name: generate-key name: generate-ssh-keys
workspaces: - name: prepare-hetzner-infra
- name: outputs taskRef:
workspaces: outputs name: prepare-hetzner-infra
- name: bootstrap-k3s
taskRef:
name: bootstrap-k3s

View File

@ -1,12 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin
subjects:
- kind: ServiceAccount
name: default
namespace: 60927041-78c2-4095-a2f5-6443c20c # this is the namespace your service account is in
roleRef: # referring to your ClusterRole
kind: ClusterRole
name: admin
apiGroup: rbac.authorization.k8s.io

View File

@ -2,46 +2,57 @@
apiVersion: tekton.dev/v1beta1 apiVersion: tekton.dev/v1beta1
kind: Task kind: Task
metadata: metadata:
name: generate-key name: generate-ssh-keys
spec: spec:
workspaces:
- name: outputs
mountPath: /tmp/outputs
steps: steps:
- name: prepare-ssh-key - name: prepare-ssh-key
image: ansible
imagePullPolicy: Never
script: |
#!/bin/sh
export SP_CUSTOMER=allanger
export SP_ENV=default
export SP_STATE=present
export COLLECTIONS_PATHS=./.ansible/collection
export COLLECTIONS_PATHS=./.ansible/collections
export ANSIBLE_ROLES_PATH=$./.ansible/roles
ansible-playbook /src/ssh-key-gen/playbook.yml -i /src/ssh-key-gen/inventory.yaml
- name: print-keys
image: alpine image: alpine
script: imagePullPolicy: Never
script: |-
#!/bin/sh #!/bin/sh
ls -R $(workspaces.outputs.path) echo "Generate SSH keys"
- name: kubectl - name: save-ssh-keys
image: alpine/k8s:1.20.7 image: alpine
script: script: |-
#!/bin/sh #!/bin/sh
kubectl get all echo "Save public and private keys to k8s secret"
--- ---
apiVersion: tekton.dev/v1beta1 apiVersion: tekton.dev/v1beta1
kind: Task kind: Task
metadata: metadata:
name: goodbye name: prepare-hetzner-infra
spec: spec:
params:
- name: username
type: string
steps: steps:
- name: goodbye - name: create-hetzner-infra
image: ubuntu image: alpine
imagePullPolicy: Never
script: |-
#!/bin/sh
echo "Create hetzner server and everything else"
- name: save-inventory
image: alpine
script: |-
#!/bin/sh
echo "Inventory file that is generated by ansible, must be saved to secrets"
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: bootstrap-k3s
spec:
steps:
- name: prepare-servers
image: alpine
script: | script: |
#!/bin/bash #!/bin/sh
echo "Goodbye $(params.username)!" echo "Prepere nodes"
- name: prepare-k3s
image: alpine
script: |-
#!/bin/sh
echo "Bootsrap k3s"
- name: save-kubeconfig
image: alpine
script: |-
#!/bin/sh
echo "check if kubeconfig is valid and save it to k8s secrets"