Skip to content

Commit

Permalink
Merge branch 'master' into ROX-19302-rosa-hcp-option
Browse files Browse the repository at this point in the history
  • Loading branch information
davdhacs committed Oct 20, 2023
2 parents 0799887 + 99144f3 commit a813364
Show file tree
Hide file tree
Showing 22 changed files with 801 additions and 512 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/PR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ defaults:
run:
working-directory: go/src/github.com/stackrox/infra

concurrency: pr-${{ github.ref }}

env:
CLUSTER_NAME: infra-pr-${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.ROBOT_ROX_GITHUB_TOKEN }}
Expand Down Expand Up @@ -97,7 +99,7 @@ jobs:
- name: Deploy infra to dev cluster
run: |
make install-local
ENVIRONMENT=development TEST_MODE=true make install-argo clean-argo-config helm-deploy
sleep 10 # wait for old pods to disappear so the svc port-forward doesn't connect to them
kubectl -n infra port-forward svc/infra-server-service 8443:8443 &
sleep 10
Expand Down Expand Up @@ -148,7 +150,7 @@ jobs:
run: |
make argo-workflow-lint
- name: Run e2e tests
- name: Run BATS e2e tests
env:
INFRA_TOKEN: ${{ secrets.INFRA_TOKEN_DEV }}
run: |
Expand All @@ -158,7 +160,7 @@ jobs:
$INFRACTL whoami || true
$INFRACTL version || true
make e2e-tests || touch FAIL
make bats-e2e-tests || touch FAIL
kubectl -n infra logs -l app=infra-server --tail=-1
kill %1
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Deploy infra
run-name: >-
${{
format('Deploy infra version {0} to {1}',
Expand Down Expand Up @@ -53,14 +54,14 @@ jobs:
gcloud container clusters get-credentials infra-${{ inputs.environment }} \
--project stackrox-infra \
--region us-west2
make install-${{ inputs.environment }}
ENVIRONMENT=${{ inputs.environment }} make install-argo clean-argo-config helm-deploy
- name: Notify infra channel about new version
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: slackapi/[email protected]
with:
channel-id: C01H4DC33K3 #acs-infra
channel-id: CVANK5K5W #acs-infra
payload: >-
{
"blocks": [
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Please avoid adding duplicate information across this changelog and JIRA/doc inp

## [NEXT RELEASE]

## [0.8.3]

- Deploying infra-server with Helm and GCP Secret Manager

## [0.8.2]

- Hackathon '23:
Expand Down
56 changes: 24 additions & 32 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,16 @@ infra-address-production 35.227.207.252 EXTERNAL

## Configuration

Service configuration is [stored in a GCS bucket](https://console.cloud.google.com/storage/browser/infra-configuration?organizationId=847401270788&project=stackrox-infra).
Service configuration and secrets are stored in [GCP Secret Manager](https://console.cloud.google.com/security/secret-manager?project=stackrox-infra).

You will need to download this configuration if you plan to make a change to infra. Configuration changes are baked in to the `infra-server` image at build time.
To view these, run:

To download the configuration locally to `chart/infra-server/configuration`, run:
`ENVIRONMENT=<development,production> SECRET_VERSION=<latest, 1,2,3,...> make secrets-download`.

`make configuration-download`
This will download the secrets to `chart/infra-server/configuration/`.

After you change configuration run:

`make create-consolidated-values`

Which will e.g.:
```
INFO: Wed Jan 11 06:47:53 PM UTC 2023: Creating a combined values file for chart/infra-server/configuration/development files
INFO: Wed Jan 11 06:47:53 PM UTC 2023: Creating a combined values file for chart/infra-server/configuration/production files
```

To upload the local configuration which includes the consolidated values back to the bucket, run:

`make configuration-upload`
- `<ENVIRONMENT>-values.yaml`: To show or edit a value, do it directly in this file, and use `ENVIRONMENT=<development,production> make secrets-upload` to upload the changes.
- `<ENVIRONMENT>-values-from-files.yaml`: To show or edit a value, use `ENVIRONMENT=<development,production> SECRET_VERSION=<latest,1,2,3> make secrets-<show, edit>` and follow the instructions. NOTE: This will download a fresh copy of the requested secret version and upload a new version after your changes. That ensures that your local secrets do not go stale.

## Regenerating the localhost certificates for the gRPC gateway

Expand Down Expand Up @@ -121,35 +110,38 @@ correct tooling installed with:

Use the `deploy` Github action to update development or production environments with a new release.

### Staging/(dev.infra.rox.systems)
### Argo Deployment

To render a copy of the charts (for inspection), run:
To install Argo workflow server, run:

`make render-development`
`ENVIRONMENT=<development,production> make install-argo`

To then apply that chart to the development cluster, run:
NOTE: This is a separate step and not a dependant chart for example to avoid too frequent Argo deployments.

`make install-development-with-rendered`
Also note that if you plan to deploy `infra-server` to this cluster, you will need to remove the default Argo workflow controller ConfigMap with the `clean-argo-config` Make target.
This is required until [ROX-20269](https://issues.redhat.com/browse/ROX-20269) is resolved.

To do everything in one command, run:
### Manual deployment

`make install-development`
To render a copy of the charts (for inspection), run:

Note: This will always bounce the infra server pods.
`ENVIRONMENT=<development,production> SECRET_VERSION=<latest,1,2,3, ...> make helm-template`

### Production
To show the diff between the current Helm release and the charts, run:

To render a copy of the charts (for inspection), run:
`ENVIRONMENT=<development,production> SECRET_VERSION=<latest,1,2,3, ...> make helm-diff`

To then apply that chart to the cluster, run:

`make render-production`
`ENVIRONMENT=<development,production> SECRET_VERSION=<latest,1,2,3, ...> make helm-deploy`

To then apply that chart to the development cluster, run:
#### Test Mode

`make install-production-with-rendered`
Use the environment variable `TEST_MODE` to disable certain infra service behavior, like:

To do everything in one command, run:
`TEST_MODE=true ENVIRONMENT=development SECRET_VERSION=latest make helm-deploy`

`make deploy-production`
This is used in the infra PR clusters to set the login referer and disable telemetry.

## Verification

Expand Down
Loading

0 comments on commit a813364

Please sign in to comment.