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

Proposing changes to kubeConfig Variable name #1309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
37 changes: 19 additions & 18 deletions gcp-java-gke-hello-world/src/main/java/gcpgke/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ private static void stack(Context ctx) {
.applyValue(a -> a.clusterCaCertificate().orElseThrow());

var yamlTemplate = """
apiVersion: v1,
clusters:,
- cluster:,
certificate-authority-data: {2},
server: https://{1},
name: {0},
contexts:,
- context:,
cluster: {0},
user: {0},
name: {0},
current-context: {0},
kind: Config,
preferences: '{}',
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: {2}
server: https://{1}
name: {0}
contexts:
- context:
cluster: {0}
user: {0}
name: {0}
current-context: {0}
kind: Config
preferences: '{}'
users:,
- name: {0},
- name: {0}
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
Expand All @@ -125,16 +125,17 @@ private static void stack(Context ctx) {
provideClusterInfo: true
""";

var kubeconfig = cluster.endpoint()
// Renaming the variable kubeConfig to be more in line of other declared variables in camelCase
var kubeConfig = cluster.endpoint()
.apply(endpoint -> masterAuthClusterCaCertificate.applyValue(
caCert -> MessageFormat.format(yamlTemplate, clusterName, endpoint, caCert)));

ctx.export("kubeconfig", kubeconfig);
ctx.export("kubeConfig", kubeConfig);

// Create a Kubernetes provider instance that uses our cluster from above.
final var clusterProvider = new Provider(name,
ProviderArgs.builder()
.kubeconfig(kubeconfig)
.kubeconfig(kubeConfig)
.build(),
CustomResourceOptions.builder()
.dependsOn(nodePool, cluster)
Expand Down