Generate cluster resources

What does this MR do and why?

Generate cluster resources.

Add a new class under the prerequisite, that will be executed just before the CI pipeline starts. #complete! method calls KAS three (or four) times to complete the process. (1) Get the template, (2) Render the template, and (3) Apply the template.

It does NOT support:

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Run GDK. Stop KAS. (gdk start && gdk stop gitlab-k8s-agent)
  2. Run KAS with the latest master branch in your local. (See Running Kas and agentk locally)
  3. Set up a example project, and connect it to the gitlab agent. Add agent config file and allow ci_access to the agent.(Authorize the agent to access your projects) For example:
ci_access:
  projects:
    - id: path/to/project
  1. Add CI job .gitlab-ci.yml
deploy:
  image:
    name: bitnami/kubectl:latest
    entrypoint: ['']
  environment:
    name: env1 # Change to your environment name
    deployment_tier: staging
  script:
    - kubectl config get-contexts
    - kubectl get ns
  1. Modify resource_management_enabled? method to return true to verify this prerequisite works correctly. Leave it as-is so that you can make sure it won't work and nothing changes from current behavior.
  2. Push commit and run CI pipeline.
  3. If resource_management_enabled? method is updated to return true, it will execute the newly added prerequisite class. That will communicate with KAS and apply environment template. The default template will create the namespace (e.g. env1-24-5) and role binding. If resource_management_enabled? method returns false, it does nothing.
Edited by Taka Nishida

Merge request reports

Loading