Skip to content

Commit

Permalink
feat: only enable plugin if .gaw exists (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: rick <[email protected]>
  • Loading branch information
LinuxSuRen and LinuxSuRen authored Jan 11, 2023
1 parent 8e1d325 commit aebe891
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 2 deletions.
113 changes: 113 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
## Setup environment

```shell
curl https://linuxsuren.github.io/tools/install.sh|bash

hd i k3d
k3d cluster create
```

### Argo workflows
```shell

kubectl create ns argo
docker run -it --rm -v $HOME/.kube/:/root/.kube --network host ghcr.io/linuxsuren/argo-workflows-guide:master
kubectl patch svc -n argo argo-server -p '{"spec":{"type":"NodePort"}}'

port=$(kubectl get svc -n argo argo-server -ojsonpath={.spec.ports[0].nodePort})
k3d node edit --port-add ${port}:${port} k3d-k3s-default-serverlb

kubectl patch deployment \
argo-server \
--namespace argo \
--type='json' \
-p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": [
"server",
"--auth-mode=server"
]}]'
```

### Argo CD
```shell
kubectl create ns argocd
docker run -it --rm -v /root/.kube/:/root/.kube --network host ghcr.io/linuxsuren/argo-cd-guide:master

kubectl patch svc -n argocd argocd-server -p '{"spec":{"type":"NodePort"}}'

port=$(kubectl get svc -n argocd argocd-server -ojsonpath={.spec.ports[0].nodePort})
k3d node edit --port-add ${port}:${port} k3d-k3s-default-serverlb

kubectl -n argocd get secret argocd-initial-admin-secret -ojsonpath={.data.password} | base64 -d
```

## Install

```shell
kubectl patch deployment \
argocd-repo-server \
--namespace argocd \
--type='json' \
-p='[{"op": "add", "path": "/spec/template/spec/containers/0", "value": {
"args": ["--loglevel", "debug"],
"command": ["/var/run/argocd/argocd-cmp-server"],
"image": "ghcr.io/linuxsuren/github-action-workflow:master",
"name": "tool",
"securityContext": {
"runAsNonRoot": true,
"runAsUser": 999
},
"volumeMounts": [{
"mountPath": "/var/run/argocd",
"name": "var-files"
}, {
"mountPath": "/home/argocd/cmp-server/plugins",
"name": "plugins"
}]
}}]'
```

## Samples
A kustomization sample:
```shell
cat <<EOF | kubectl apply -n argocd -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: learn-pipeline-go
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
project: default
source:
repoURL: https://gitee.com/devops-ws/learn-pipeline-go
path: kustomize
targetRevision: HEAD
syncPolicy:
automated:
selfHeal: true
EOF
```

A plugin sample:
```shell
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: yaml-readme
namespace: argocd
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
project: default
source:
path: .github/workflows/
repoURL: https://gitee.com/linuxsuren/yaml-readme
targetRevision: HEAD
syncPolicy:
automated:
selfHeal: true
EOF
```
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ spec:
then, create an Application on the Argo CD UI or CLI:
```yaml
```shell
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: yaml-readme
Expand All @@ -76,6 +78,7 @@ spec:
syncPolicy:
automated:
selfHeal: true
EOF
```

## Compatible
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
generate:
command: [gaw, convert, '*.yaml']
discover:
fileName: "*.yaml"
fileName: ".gaw"
lockRepo: true

0 comments on commit aebe891

Please sign in to comment.