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

Add the make secrets/touch command to ensure all secret files exist. #1

Merged
merged 6 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
run: make db/migrate
- name: Setup tests secrets
run: |
make ocm/setup aws/setup keycloak/setup dinosaurcert/setup observatorium/setup
make ocm/setup aws/setup keycloak/setup dinosaurcert/setup observatorium/setup secrets/touch
- name: Lint & Test
run: |
export GOPATH=$(go env GOPATH)
Expand Down
33 changes: 32 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ ifeq (, $(shell which ${LOCAL_BIN_PATH}/spectral 2> /dev/null))
mkdir -p ${LOCAL_BIN_PATH} ;\
mkdir -p ${LOCAL_BIN_PATH}/spectral-installation ;\
cd ${LOCAL_BIN_PATH} ;\
${NPM} install --prefix ${LOCAL_BIN_PATH}/spectral-installation @stoplight/spectral ;\
${NPM} install --prefix ${LOCAL_BIN_PATH}/spectral-installation @stoplight/spectral-cli ;\
${NPM} i --prefix ${LOCAL_BIN_PATH}/spectral-installation @rhoas/spectral-ruleset ;\
ln -s spectral-installation/node_modules/.bin/spectral spectral ;\
}
Expand Down Expand Up @@ -211,6 +211,7 @@ help:
@echo "make image/build build docker image"
@echo "make image/push push docker image"
@echo "make setup/git/hooks setup git hooks"
@echo "make secrets/touch touch all required secret files"
@echo "make keycloak/setup setup mas sso clientId, clientSecret & crt"
@echo "make dinosaurcert/setup setup the dinosaur TLS certificate used for Managed Dinosaur Service"
@echo "make observatorium/setup setup observatorium secrets used by CI"
Expand Down Expand Up @@ -450,6 +451,36 @@ test/run: image/build/test
docker run -u $(shell id -u) --net=host -p 9876:9876 -i "$(test_image)"
.PHONY: test/run

# Touch all necessary secret files for fleet manager to start up
secrets/touch:
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

touch secrets/aws.accesskey \
secrets/aws.accountid \
secrets/aws.route53accesskey \
secrets/aws.route53secretaccesskey \
secrets/aws.secretaccesskey \
secrets/db.host \
secrets/db.name \
secrets/db.password \
secrets/db.port \
secrets/db.user \
secrets/dinosaur-tls.crt \
secrets/dinosaur-tls.key \
secrets/image-pull.dockerconfigjson \
secrets/keycloak-service.clientId \
secrets/keycloak-service.clientSecret \
secrets/observability-config-access.token \
secrets/ocm-service.clientId \
secrets/ocm-service.clientSecret \
secrets/ocm-service.token \
secrets/osd-idp-keycloak-service.clientId \
secrets/osd-idp-keycloak-service.clientSecret \
secrets/rhsso-logs.clientId \
secrets/rhsso-logs.clientSecret \
secrets/rhsso-metrics.clientId \
secrets/rhsso-metrics.clientSecret \
secrets/sentry.key
.PHONY: secrets/touch

# Setup for AWS credentials
aws/setup:
@echo -n "$(AWS_ACCOUNT_ID)" > secrets/aws.accountid
Expand Down
2 changes: 1 addition & 1 deletion cmd/fleet-manager/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"testing"

. "github.com/onsi/gomega"
"github.com/stackrox/acs-fleet-manager/internal/dinosaur"
"github.com/stackrox/acs-fleet-manager/pkg/environments"
"github.com/stackrox/acs-fleet-manager/pkg/server"
"github.com/stackrox/acs-fleet-manager/pkg/workers"
. "github.com/onsi/gomega"
)

func TestInjections(t *testing.T) {
Expand Down
26 changes: 17 additions & 9 deletions config/dataplane-cluster-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@
# provider_type: "ocm" #Valid values are `ocm` and `standalone`. `ocm` will be used if not specified.
# cluster_dns: apps.example.com #Valid cluster DNS. This will be used to build dinosaur host url and to communicate with standalone clusters. Required when "provider_type" is "standalone"
# supported_instance_type: "eval" # could be "eval", "standard" or both i.e "standard,eval" or "eval,standard". Defaults to "standard,eval" if not set
clusters:
- name: docker-desktop
cluster_id: 1234567890abcdef1234567890abcdef
cloud_provider: standalone
region: standalone
schedulable: true
status: ready
provider_type: standalone
cluster_dns: kubernetes.docker.internal
clusters: []
# - name: docker-desktop # Uncomment if using docker-desktop
# cluster_id: 1234567890abcdef1234567890abcdef
# cloud_provider: standalone
# region: standalone
# schedulable: true
# status: ready
# provider_type: standalone
# cluster_dns: kubernetes.docker.internal
# - name: minikube # Uncomment if using minikube
# cluster_id: 1234567890abcdef1234567890abcdef
# cloud_provider: standalone
# region: standalone
# schedulable: true
# status: ready
# provider_type: standalone
# cluster_dns: kubernetes.docker.internal
8 changes: 4 additions & 4 deletions pkg/environments/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ func GetEnvironmentStrFromEnv() string {
//
// Then flag defaults will set by getting defaults for the Env.Name by looking up a EnvLoader
// tagged with that name in the Env.ConfigContainer.
func (e *Env) AddFlags(flags *pflag.FlagSet) error {
func (env *Env) AddFlags(flags *pflag.FlagSet) error {

flags.AddGoFlagSet(flag.CommandLine)

var namedEnv EnvLoader
err := e.ConfigContainer.Resolve(&namedEnv, di.Tags{"env": e.Name})
err := env.ConfigContainer.Resolve(&namedEnv, di.Tags{"env": env.Name})
if err != nil {
return errors.Errorf("unsupported environment %q", e.Name)
return errors.Errorf("unsupported environment %q", env.Name)
}

modules := []ConfigModule{}
if err := e.ConfigContainer.Resolve(&modules); err != nil && !goerrors.Is(err, di.ErrTypeNotExists) {
if err := env.ConfigContainer.Resolve(&modules); err != nil && !goerrors.Is(err, di.ErrTypeNotExists) {
return err
}
for i := range modules {
Expand Down