protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/clouddriver-credentials" + spinnakerHome.replace("/", "_"); AwsProvider awsProvider = deploymentConfiguration.getProviders().getAws(); if (awsProvider.isEnabled() && !StringUtils.isEmpty(awsProvider.getAccessKeyId()) && !StringUtils.isEmpty(awsProvider.getSecretAccessKey())) { String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.CLOUDDRIVER) .setAccessKeyId(awsProvider.getAccessKeyId()) .setSecretAccessKey(awsProvider.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } else { return Optional.empty(); } }
protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/clouddriver-credentials" + spinnakerHome.replace("/", "_"); AwsProvider awsProvider = deploymentConfiguration.getProviders().getAws(); if (awsProvider.isEnabled() && !StringUtils.isEmpty(awsProvider.getAccessKeyId()) && !StringUtils.isEmpty(awsProvider.getSecretAccessKey())) { String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.CLOUDDRIVER) .setAccessKeyId(awsProvider.getAccessKeyId()) .setSecretAccessKey(awsProvider.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } else { return Optional.empty(); } }
protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/front50-credentials" + spinnakerHome.replace("/", "_"); PersistentStore.PersistentStoreType type = deploymentConfiguration.getPersistentStorage().getPersistentStoreType(); S3PersistentStore store = deploymentConfiguration.getPersistentStorage().getS3(); if (type == PersistentStore.PersistentStoreType.S3 && !StringUtils.isEmpty(store.getAccessKeyId()) && !StringUtils.isEmpty(store.getSecretAccessKey())) { String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.FRONT50) .setAccessKeyId(store.getAccessKeyId()) .setSecretAccessKey(store.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } else { return Optional.empty(); } }
protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/front50-credentials" + spinnakerHome.replace("/", "_"); PersistentStore.PersistentStoreType type = deploymentConfiguration.getPersistentStorage().getPersistentStoreType(); S3PersistentStore store = deploymentConfiguration.getPersistentStorage().getS3(); if (type == PersistentStore.PersistentStoreType.S3 && !StringUtils.isEmpty(store.getAccessKeyId()) && !StringUtils.isEmpty(store.getSecretAccessKey())) { String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.FRONT50) .setAccessKeyId(store.getAccessKeyId()) .setSecretAccessKey(store.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } else { return Optional.empty(); } }
protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/kayenta-credentials" + spinnakerHome.replace("/", "_"); Canary canary = deploymentConfiguration.getCanary(); if (canary.isEnabled()) { AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration)getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class); // TODO(lwander/duftler): Seems like this approach leaves us open to potential collision between kayenta aws // accounts, and front50 and clouddriver configuration. if (awsCanaryServiceIntegration.isS3Enabled()) { Optional<AwsCanaryAccount> optionalAwsCanaryAccount = awsCanaryServiceIntegration.getAccounts() .stream() .filter(a -> !StringUtils.isEmpty(a.getAccessKeyId()) && !StringUtils.isEmpty(a.getSecretAccessKey())) .findFirst(); if (optionalAwsCanaryAccount.isPresent()) { AwsCanaryAccount awsCanaryAccount = optionalAwsCanaryAccount.get(); String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); awsCredentialsProfileFactoryBuilder.setProfileName(StringUtils.isNotBlank(awsCanaryAccount.getProfileName()) ? awsCanaryAccount.getProfileName() : "default"); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.KAYENTA) .setAccessKeyId(awsCanaryAccount.getAccessKeyId()) .setSecretAccessKey(awsCanaryAccount.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } } } return Optional.empty(); }
protected Optional<Profile> generateAwsProfile(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints, String spinnakerHome) { String name = "aws/kayenta-credentials" + spinnakerHome.replace("/", "_"); Canary canary = deploymentConfiguration.getCanary(); if (canary.isEnabled()) { AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration)getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class); // TODO(lwander/duftler): Seems like this approach leaves us open to potential collision between kayenta aws // accounts, and front50 and clouddriver configuration. if (awsCanaryServiceIntegration.isS3Enabled()) { Optional<AwsCanaryAccount> optionalAwsCanaryAccount = awsCanaryServiceIntegration.getAccounts() .stream() .filter(a -> !StringUtils.isEmpty(a.getAccessKeyId()) && !StringUtils.isEmpty(a.getSecretAccessKey())) .findFirst(); if (optionalAwsCanaryAccount.isPresent()) { AwsCanaryAccount awsCanaryAccount = optionalAwsCanaryAccount.get(); String outputFile = awsCredentialsProfileFactoryBuilder.getOutputFile(spinnakerHome); awsCredentialsProfileFactoryBuilder.setProfileName(StringUtils.isNotBlank(awsCanaryAccount.getProfileName()) ? awsCanaryAccount.getProfileName() : "default"); return Optional.of(awsCredentialsProfileFactoryBuilder .setArtifact(SpinnakerArtifact.KAYENTA) .setAccessKeyId(awsCanaryAccount.getAccessKeyId()) .setSecretAccessKey(awsCanaryAccount.getSecretAccessKey()) .build() .getProfile(name, outputFile, deploymentConfiguration, endpoints)); } } } return Optional.empty(); }