Skip to content
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

guide: CI/CD with Tekton #59

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

jasonmadigan
Copy link
Member

@jasonmadigan jasonmadigan commented Mar 7, 2024

Re: Kuadrant/docs.kuadrant.io#64

Steps to Run:

  • Probably easiest to install Kuadrant via api-quickstart
  • Switch to the workload1 cluster (which has the kuadrant-operator running)
  • Run the steps

Sample output:

tkn taskrun logs -f run-kuadrantctl-taskrun -n petstore                               git:(64-kuadrantctl-tekton|…2⚑2

[clone] Cloning into '/workspace/source'...
[clone] Already on 'main'
[clone] Your branch is up to date with 'origin/main'.

[download-kuadrantctl]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[download-kuadrantctl]                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 21.4M  100 21.4M    0     0  12.7M      0  0:00:01  0:00:01 --:--:-- 20.9M

[run-kuadrantctl] kind: AuthPolicy
[run-kuadrantctl] apiVersion: kuadrant.io/v1beta2
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   targetRef:
[run-kuadrantctl]     group: gateway.networking.k8s.io
[run-kuadrantctl]     kind: HTTPRoute
[run-kuadrantctl]     name: petstore
[run-kuadrantctl]     namespace: petstore
[run-kuadrantctl]   routeSelectors:
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/admin
[run-kuadrantctl]           method: GET
[run-kuadrantctl]   rules:
[run-kuadrantctl]     authentication:
[run-kuadrantctl]       storeAdmin_api_key:
[run-kuadrantctl]         credentials:
[run-kuadrantctl]           customHeader:
[run-kuadrantctl]             name: api_key
[run-kuadrantctl]         apiKey:
[run-kuadrantctl]           selector:
[run-kuadrantctl]             matchLabels:
[run-kuadrantctl]               kuadrant.io/apikeys-by: api_key
[run-kuadrantctl]         routeSelectors:
[run-kuadrantctl]           - matches:
[run-kuadrantctl]               - path:
[run-kuadrantctl]                   type: Exact
[run-kuadrantctl]                   value: /api/v3/store/admin
[run-kuadrantctl]                 method: GET
[run-kuadrantctl] status: {}
[run-kuadrantctl] kind: RateLimitPolicy
[run-kuadrantctl] apiVersion: kuadrant.io/v1beta2
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   targetRef:
[run-kuadrantctl]     group: gateway.networking.k8s.io
[run-kuadrantctl]     kind: HTTPRoute
[run-kuadrantctl]     name: petstore
[run-kuadrantctl]     namespace: petstore
[run-kuadrantctl]   limits:
[run-kuadrantctl]     getInventory:
[run-kuadrantctl]       routeSelectors:
[run-kuadrantctl]         - matches:
[run-kuadrantctl]             - path:
[run-kuadrantctl]                 type: Exact
[run-kuadrantctl]                 value: /api/v3/store/inventory
[run-kuadrantctl]               method: GET
[run-kuadrantctl]       rates:
[run-kuadrantctl]         - limit: 10
[run-kuadrantctl]           duration: 10
[run-kuadrantctl]           unit: second
[run-kuadrantctl]     loginUser:
[run-kuadrantctl]       routeSelectors:
[run-kuadrantctl]         - matches:
[run-kuadrantctl]             - path:
[run-kuadrantctl]                 type: Exact
[run-kuadrantctl]                 value: /api/v3/user/login
[run-kuadrantctl]               method: GET
[run-kuadrantctl]       rates:
[run-kuadrantctl]         - limit: 2
[run-kuadrantctl]           duration: 10
[run-kuadrantctl]           unit: second
[run-kuadrantctl] status: {}
[run-kuadrantctl] kind: HTTPRoute
[run-kuadrantctl] apiVersion: gateway.networking.k8s.io/v1beta1
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   parentRefs:
[run-kuadrantctl]     - kind: Gateway
[run-kuadrantctl]       namespace: kuadrant-multi-cluster-gateways
[run-kuadrantctl]       name: prod-web
[run-kuadrantctl]   hostnames:
[run-kuadrantctl]     - petstore.${KUADRANT_ZONE_ROOT_DOMAIN}
[run-kuadrantctl]   rules:
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/user/login
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/admin
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/inventory
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl] status:
[run-kuadrantctl]   parents: null

[apply-resources] authpolicy.kuadrant.io/petstore created
[apply-resources] httproute.gateway.networking.k8s.io/petstore created
[apply-resources] ratelimitpolicy.kuadrant.io/petstore created

@jasonmadigan jasonmadigan force-pushed the 64-kuadrantctl-tekton branch from e380ec0 to 11ac9a8 Compare March 7, 2024 17:20
@jasonmadigan
Copy link
Member Author

@david-martin draft. I need to do an e2e spin through

Copy link
Member

@david-martin david-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got the task to run, which some changes suggested above.
The task is failing at the moment. I haven't looked into why, but here's the status:

kubectl get taskrun -A
NAMESPACE                NAME                      SUCCEEDED   REASON                    STARTTIME   COMPLETIONTIME
kuadrantctl-ci-example   run-kuadrantctl-taskrun   False       TaskRunResolutionFailed   76s         76s
      message: 'error when listing tasks for taskRun run-kuadrantctl-taskrun: tasks.tekton.dev
        "run-kuadrantctl" not found'

events

kubectl -n kuadrantctl-ci-example get ev
LAST SEEN   TYPE      REASON                 OBJECT                                         MESSAGE
109s        Normal    Started                taskrun/run-kuadrantctl-taskrun
109s        Warning   Failed                 taskrun/run-kuadrantctl-taskrun                error when listing tasks for taskRun run-kuadrantctl-taskrun: tasks.tekton.dev "run-kuadrantctl" not found
109s        Warning   InternalError          taskrun/run-kuadrantctl-taskrun                1 error occurred:...
2m11s       Normal    WaitForFirstConsumer   persistentvolumeclaim/tekton-kuadrantctl-pvc   waiting for first consumer to be created before binding

doc/kuadrantctl-ci-cd.md Outdated Show resolved Hide resolved
doc/kuadrantctl-ci-cd.md Outdated Show resolved Hide resolved
doc/kuadrantctl-ci-cd.md Outdated Show resolved Hide resolved
doc/kuadrantctl-ci-cd.md Outdated Show resolved Hide resolved
@jasonmadigan jasonmadigan force-pushed the 64-kuadrantctl-tekton branch 2 times, most recently from b0270a1 to ad286cc Compare March 8, 2024 10:24
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.38%. Comparing base (888948e) to head (ad286cc).
Report is 7 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #59   +/-   ##
=====================================
  Coverage   0.38%   0.38%           
=====================================
  Files         17      17           
  Lines        783     783           
=====================================
  Hits           3       3           
  Misses       780     780           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jasonmadigan jasonmadigan force-pushed the 64-kuadrantctl-tekton branch 3 times, most recently from 1b16019 to 0ce2b39 Compare March 8, 2024 14:22
@jasonmadigan
Copy link
Member Author

@david-martin this is actually runnable now. Added some steps to test.

@jasonmadigan jasonmadigan force-pushed the 64-kuadrantctl-tekton branch from 0ce2b39 to ff0e978 Compare March 11, 2024 11:38
@jasonmadigan jasonmadigan force-pushed the 64-kuadrantctl-tekton branch from ff0e978 to 6219b31 Compare March 11, 2024 11:54
Copy link
Member

@david-martin david-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion for pre-reqs, otherwise all good.

tkn tr list -n petstore
NAME                      STARTED          DURATION   STATUS
run-kuadrantctl-taskrun   32 seconds ago   17s        Succeeded
tkn tr logs run-kuadrantctl-taskrun -f -n petstore

[clone] Cloning into '/workspace/source'...
[clone] Already on 'main'
[clone] Your branch is up to date with 'origin/main'.

[download-kuadrantctl]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[download-kuadrantctl]                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 21.4M  100 21.4M    0     0  12.7M      0  0:00:01  0:00:01 --:--:-- 21.2M

[run-kuadrantctl] kind: AuthPolicy
[run-kuadrantctl] apiVersion: kuadrant.io/v1beta2
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   targetRef:
[run-kuadrantctl]     group: gateway.networking.k8s.io
[run-kuadrantctl]     kind: HTTPRoute
[run-kuadrantctl]     name: petstore
[run-kuadrantctl]     namespace: petstore
[run-kuadrantctl]   routeSelectors:
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/admin
[run-kuadrantctl]           method: GET
[run-kuadrantctl]   rules:
[run-kuadrantctl]     authentication:
[run-kuadrantctl]       storeAdmin_api_key:
[run-kuadrantctl]         credentials:
[run-kuadrantctl]           customHeader:
[run-kuadrantctl]             name: api_key
[run-kuadrantctl]         apiKey:
[run-kuadrantctl]           selector:
[run-kuadrantctl]             matchLabels:
[run-kuadrantctl]               kuadrant.io/apikeys-by: api_key
[run-kuadrantctl]         routeSelectors:
[run-kuadrantctl]           - matches:
[run-kuadrantctl]               - path:
[run-kuadrantctl]                   type: Exact
[run-kuadrantctl]                   value: /api/v3/store/admin
[run-kuadrantctl]                 method: GET
[run-kuadrantctl] status: {}
[run-kuadrantctl] kind: RateLimitPolicy
[run-kuadrantctl] apiVersion: kuadrant.io/v1beta2
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   targetRef:
[run-kuadrantctl]     group: gateway.networking.k8s.io
[run-kuadrantctl]     kind: HTTPRoute
[run-kuadrantctl]     name: petstore
[run-kuadrantctl]     namespace: petstore
[run-kuadrantctl]   limits:
[run-kuadrantctl]     getInventory:
[run-kuadrantctl]       routeSelectors:
[run-kuadrantctl]         - matches:
[run-kuadrantctl]             - path:
[run-kuadrantctl]                 type: Exact
[run-kuadrantctl]                 value: /api/v3/store/inventory
[run-kuadrantctl]               method: GET
[run-kuadrantctl]       rates:
[run-kuadrantctl]         - limit: 10
[run-kuadrantctl]           duration: 10
[run-kuadrantctl]           unit: second
[run-kuadrantctl]     loginUser:
[run-kuadrantctl]       routeSelectors:
[run-kuadrantctl]         - matches:
[run-kuadrantctl]             - path:
[run-kuadrantctl]                 type: Exact
[run-kuadrantctl]                 value: /api/v3/user/login
[run-kuadrantctl]               method: GET
[run-kuadrantctl]       rates:
[run-kuadrantctl]         - limit: 2
[run-kuadrantctl]           duration: 10
[run-kuadrantctl]           unit: second
[run-kuadrantctl] status: {}
[run-kuadrantctl] kind: HTTPRoute
[run-kuadrantctl] apiVersion: gateway.networking.k8s.io/v1beta1
[run-kuadrantctl] metadata:
[run-kuadrantctl]   name: petstore
[run-kuadrantctl]   namespace: petstore
[run-kuadrantctl]   creationTimestamp: null
[run-kuadrantctl]   labels:
[run-kuadrantctl]     deployment: petstore
[run-kuadrantctl]     owner: jbloggs
[run-kuadrantctl] spec:
[run-kuadrantctl]   parentRefs:
[run-kuadrantctl]     - kind: Gateway
[run-kuadrantctl]       namespace: kuadrant-multi-cluster-gateways
[run-kuadrantctl]       name: prod-web
[run-kuadrantctl]   hostnames:
[run-kuadrantctl]     - petstore.${KUADRANT_ZONE_ROOT_DOMAIN}
[run-kuadrantctl]   rules:
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/admin
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/store/inventory
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl]     - matches:
[run-kuadrantctl]         - path:
[run-kuadrantctl]             type: Exact
[run-kuadrantctl]             value: /api/v3/user/login
[run-kuadrantctl]           method: GET
[run-kuadrantctl]       backendRefs:
[run-kuadrantctl]         - name: petstore
[run-kuadrantctl]           namespace: petstore
[run-kuadrantctl]           port: 8080
[run-kuadrantctl] status:
[run-kuadrantctl]   parents: null

[apply-resources] authpolicy.kuadrant.io/petstore unchanged
[apply-resources] httproute.gateway.networking.k8s.io/petstore created
[apply-resources] ratelimitpolicy.kuadrant.io/petstore created

@jasonmadigan jasonmadigan merged commit b9fcddd into Kuadrant:main Mar 12, 2024
5 checks passed
@jasonmadigan jasonmadigan deleted the 64-kuadrantctl-tekton branch March 12, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants