- Notifications
You must be signed in to change notification settings - Fork 67
Enable passing config into controller #264
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
Conversation
Pull Request Test Coverage Report for Build 5148739696
💛 - Coveralls |
| | ||
| func ConfigInit() { | ||
| // discover VPC using environment first | ||
| VpcID = os.Getenv("CLUSTER_VPC_ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to change this? Today we documented how to use these environments variables and they are used for developers as well (e..g make presubmit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document says: When running AWS Gateway API Controller outside the Kubernetes Cluster, this specify the VPC of the cluster.
This code changes is to take the input while running AWS Gateway API Controller inside the Kubernetes Cluster.
| } else { | ||
| VpcID = os.Getenv("CLUSTER_VPC_ID") | ||
| glog.V(2).Infoln("CLUSTER_VPC_ID from local dev environment: ", VpcID) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I have seen, the most common practice on config is to have priority order flag > env > auto-resolve. I think env variable should be a way of configuring things regardless of dev environment. This way we can simply set env var as a default value of a flag, and run discovery if the current value is empty.
Actually... we have a lot of configuration variables (longname mode for example) and I think they all should be configurable by both flag and env. It makes things bigger so we can leave it to other task though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have two ways of configuring the same value I think the naming should be consistent
e.g. flag aws-vpc-id -> env AWS_VPC_ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I discussed with Liwen, we plan to go with env, no flag for now. I am going to change this using env var.
helm/templates/deployment.yaml Outdated
| {{ if .Values.deployment.priorityClassName -}} | ||
| priorityClassName: {{ .Values.deployment.priorityClassName }} | ||
| {{ end -}} | ||
| {{- if .aws.region }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be somewhere inside like args block?
Pull Request Test Coverage Report for Build 5150455119
💛 - Coveralls |
| kubectl apply -f config/crds/bases/k8s-gateway-v0.6.1.yaml | ||
| kubectl apply -f config/crds/bases/multicluster.x-k8s.io_serviceexports.yaml | ||
| kubectl apply -f config/crds/bases/multicluster.x-k8s.io_serviceimports.yaml | ||
| kubectl apply -f examples/gatewayclass.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do u delete this?
docs/developer.md Outdated
| You should set up the correct `REGION` env variable and create `non-default` | ||
| namespace if it doesn't exist. | ||
| | ||
| NOTE: You'll need to allow in-bound traffics from lattice prefix list in the security | ||
| groups of your cluster. | ||
| | ||
| ```bash | ||
| # create non-default namespace if it hasn't existed yet | ||
| kubectl create namespace non-default | ||
| | ||
| You should set up the correct `REGION` env variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do u delete all these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt intent to delete this, i need to fetch new code change.
docs/developer.md Outdated
| make build-deploy | ||
| ``` | ||
| Then follow [Deploying the AWS Gateway API Controller](https://github.com/aws/aws-application-networking-k8s/blob/main/docs/deploy.md) to configure and deploy the docker image | ||
| Then follow [Deploying the AWS Gateway API Controller](https://github.com/aws/aws-application-networking-k8s/blob/main/docs/deploy.md) to configure and deploy the docker image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all these white-space diff
| Please also add or modify unit test for the change |
Pull Request Test Coverage Report for Build 5159899025
💛 - Coveralls |
docs/deploy.md Outdated
| --version=v0.0.12 \ | ||
| --set=aws.region=$AWS_REGION --set=serviceAccount.create=false --namespace aws-application-networking-system | ||
| --set=serviceAccount.create=false --namespace aws-application-networking-system \ | ||
| # Region, clusterVpcId, awsAccountId are required for fargate use case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you replace "fargate use case" to something " for the case where IMDS are not available for discovering Region, clusterVpcId, awsAccountId, for example fargate usecase"
pkg/config/controller_config.go Outdated
| var VpcID = "vpc-xxxx" | ||
| var AccountID = "yyyyyy" | ||
| var Region = "us-west-2" | ||
| var VpcID = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT,can use use a constant for ""? e.g. UNKNOWN_VPCID=""
pkg/config/controller_config.go Outdated
| | ||
| // VpcId | ||
| VpcID = os.Getenv("CLUSTER_VPC_ID") | ||
| if VpcID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT, use constant instead of ""
| ) | ||
| | ||
| // TODO endpoint, region | ||
| var VpcID = "vpc-xxxx" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u also remove //TODO comment? thanks
What type of PR is this?
bug
Which issue does this PR fix:
#261
What does this PR do / Why do we need it:
This PR enables controller to take input from user
If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
Testing done on this change:
make e2etestunit testhelm install --set awsRegion=us-west-2 --set awsAccountId=123456789 --set clusterVpcId=vpc-12345678 --dry-run --debug helm --generate-nameconformance testAutomation added to e2e:
N/A
Will this PR introduce any new dependencies?:
No
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No
Does this PR introduce any user-facing change?:
No
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.