General Project Updates

Update the .gitignore file

update the .gitignore file with the following:

verify.log
skaffold.log
Make sure that jacoco is there there but set to only ensure that the jar doesnt get in the repo and not in a way that will prevent the kubernetes/components/jacoco contents from being added. For example, */jacoco/ shouldn’t be present.

Cleanup legacy components

  • Remove the Kubernetes files that were present.

  • Remove all sections from metadata.yaml except the documentation field

  • Remove the helm folder from the service

  • Remove the helm-tile from the pom

  • Remove the templates/kubernetes directory

  • Remove the K8sServiceValues and the K8sServiceValues.properties files

Dependency Helm Charts post-Kustomize-Conversion

If there are existing Helm-based projects which rely on a service which has been converted to the Skaffold+Kustomize implementation, the Helm chart for this service will no longer be produced and published.

The workaround is to continue to depend on the latest Helm chart version of the service, but override the service image version value as a metadata.yaml dependency/subchart override.

Example metadata.yaml
helm:
  dependencies:
  - name: some-service
    version: 1.0.0 (1)
  # ...
  default-values:
    # ...
    some-service: (2)
      version: 2.0.0 (3)
1 Last Helm chart version published
2 Dependency/subchart override values
3 Override the image version of the service by setting version to 2.0.0

If there are transitive service dependencies that also need to be updated, this will need to be manually specified in metadata.yaml dependencies.

Local Testing Instructions

The local-testing.md file should be changed to look like below.

Change the service name to the appropriate one
# `<service>` Local Development and Testing Guide

### From Source

#### Prerequisites:

The `<service>` makes use of Kubernetes, Kustomize, and Skaffold via generated build tiles from the
[NGSS Maven build tiles](https://coderepo.mobilehealth.va.gov/projects/CKM/repos/ngss-maven-tiles/browse). To better understand the NGSS build tiles, refer to [NGSS build tiles README](https://coderepo.mobilehealth.va.gov/projects/CKM/repos/ngss-maven-tiles/browse/README.md).

To make sure that your local development environment is set up properly, refer to
https://kubernetes.mapsandbox.net/admin-idp-web/v3/?redirect_uri=/docs/ngss-docs-site/devops/index.html.

Additionally, your maven settings should reflect the repository servers in the recommended template [here](https://wiki.mobilehealth.va.gov/display/CKM/Maven+Settings+Template),
and you need to log in to `dtr.mapsandbox.net` to pull docker images:
```
docker login https://dtr.mapsandbox.net
```

## Building and Testing

### Build and run IT

`skaffold dev`

followed by:

`mvn verify -Pskaffold-integration`

Integration tests will run during this process. Additionally, you could execute tests from the IDE as `skaffold dev` will
keep the project running.

### Build and run IT, Shutdown after completion

`mvn clean install -Pwith-skaffold` : runs IT and cleans up.

Note that any previous Skaffold runs should be deleted before running to avoid issues. This can be accomplished using the
`skaffold delete` command.

### Build and run, No IT

`mvn clean pre-integration-test -Pwith-skaffold`

## Configuration

Service configuration for local testing and deployment is defined in the project's `skaffold.yaml` file located at the root of the project.

Values that are needed for testing can be updated in an `application.env` file under the `components/dev` folder.
The `sandbox` and `sqa-build-test` overlays have their own `application.env` file, and will override any
matching values found from the `base` and `components/dev` `application.env`.

The "production-like" overlays - `sqa` and `prod`, are only based on the `base` configuration, so any variables that are set in
their `application.env` files will override that of the variables' `base` `application.env` values.

When running locally, `<service>` and its service dependencies will start in individual pods within the
local kubernetes environment and log messages are tailed in a `skaffold.log` file that is created at the root of the project.

No additional steps need to be taken to re-build and redeploy the service without having to restart the dependencies.
Simply edit the file in question and as long as it falls under the `sync` path configured in the `skaffold.yaml`, Skaffold
will automatically rebuild just the necessary files.

To shut down the services, press `CTRL-C` and Skaffold will delete all the resources it created. If for some reason the
prompt where Skaffold was running isn't available, the `skaffold delete` command can be used as well.

To run requests from the command line or through a tool like Postman, a JWT must be generated. One way to get the generated
JWT would be using a tool like [jwtgen](https://coderepo.mobilehealth.va.gov/projects/IUMS/repos/jwtgen/browse) and including the result as a 'X-VAMF-JWT' header in each request.

### Debugging

Debugging can be enabled by running `skaffold debug` or the `debug-all` profile (`skaffold dev -p debug-all`). Ports
specified in the `portForwards` section of the `skaffold.yaml` will automatically be forwarded. Additional services requiring
forwarding can either be added to this section of the `skaffold.yaml` or manually forwarded using `kubectl`.

### Logs
The Skaffold dev loop creates a `skaffold.log` file when activating the Maven `with-skaffold` profile. Additionally, logs
can be streamed from a running pod through Kubernetes using the command:
```
kubectl logs -f <pod-name> -n <namespace>
```
The kubernetes service namespace can be retrieved using:
```
kubectl get ns
```
The pod name can be retrieved using:
```
kubectl get pods -n <namespace>
```

Changelog

Update the changelog to reflect the work done.

SRVDD

Update the Deployment Environment section of the SRVDD to ensure that the latest links are correct concerning which version of jib-maven-plugin-tile and java-service-base.

For Example:

* Dockerfile: The service uses the NGSS `jib-maven-plugin-tile`
  [v2.4.x](https://coderepo.mobilehealth.va.gov/projects/CKM/repos/ngss-maven-tiles/browse/jib-maven-plugin-tile/tile.xml?at=refs%2Fheads%2FRelease%2F2.4#), which uses the [java-service-base v5.2.x](https://coderepo.mobilehealth.va.gov/projects/CKM/repos/java-service-base/browse?at=refs%2Fheads%2FRelease%2F5.2) base image for building the service image.