Skip to content

Commit

Permalink
refactor(halyard): clean up halconfig/settings and mark as deprecated (
Browse files Browse the repository at this point in the history
…#8312)

* docs(halyard): mark halconfig/settings as deprecated

* refactor(halyard): remove unneeded authTtl default

We are already defaulting SETTINGS.authTtl to 600000 everywhere this is read.

* refactor(halyard): remove unneeded checkForUpdates default

We do not need to default this to false, since the logic it gates will only be executed if the flag is explicitly truthy.

* refactor(halyard): remove defaultProviders from halconfig/settings

Halyard users are currently supplied with a list of defaultProviders that include every possible cloud provider. The AccountService reads from defaultProviders when trying to list all providers for a given application only if there the application does not have an explicit list of configured cloud providers, and then will take the intersection of available providers with these defaultProviders, but since we're supplying every possible provider in the list of defaultProviders, this is essentially the same as falling back to available providers, which is what we do when SETTINGS.defaultProviders is undefined.

* refactor(halyard): remove unneeded gitSources default

We already default gitSources to these four sources everywhere SETTINGS.gitSources is read.

* refactor(halyard): remove newApplicationDefaults default

Instead of defaulting newApplicationDefaults.chaosMonkey to false, let's just more safely read from this field, which may be undefined for non-Halyard users anyway.

* refactor(halyard): remove unneeded pagerDuty default

pagerDuty.required already defaults to false everywhere it is read.

* refactor(halyard): push default pollSchedule to code

We have never exposed a Halyard parameter to configure pollSchedule; let's push the default of 30000 into consuming code. This won't affect non-Halyard users who are setting this parameter.

* refactor(halyard): remove unneeded appengine properties

These properties are no longer read in code.

* refactor(halyard): remove unneeded aws defaults

These defaults are unnecessary as they are already present in consuming code.

* refactor(halyard): remove unnecessary GCE property

IGceProviderSettings no longer includes associatePublicIpAddress, so we can remove this property.

* refactor(halyard): remove unneeded kubernetes defaults

These fields are no longer consumed by the provider.

* refactor(halyard): remove titus defaults from halconfig

Titus is not configurable with Halyard; there is no need for these defaults to live here.

* refactor(halyard): remove Halyard-defaulted pubsubProviders

As documented on [this PR](#7908), Amazon pubsub works, so there's not a great reason to default to only 'google.' Let's include 'amazon' in the default list in consuming code and remove the default from the halconfig.

* refactor(halyard): remove triggerTypes from halconfig

Including an exhaustive list of triggerTypes has the same effect as not configuring triggerTypes, since if this is unset we will register every available trigger type.

* refactor(halyard): clean up features config

Removes unneeded fields from the features config: many of these are no longer supported or were never supported by Halyard. Several are unneeded defaults.

* refactor(halyard): remove final unneeded properties from halconfig/settings.js

* SETTINGS.feature.notifications is unused; remove from halconfig/settings.js
* maxPipelineAgeDays is not set in Halyard's DeckProfileFactory; remove from halconfig/settings.js
* onDemandClusterThreshold is not set in Halyard's DeckProfileFactory; remove from halconfig/settings.js
  • Loading branch information
maggieneterval committed Jun 1, 2020
1 parent 6e85340 commit 2cc6900
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 99 deletions.
2 changes: 0 additions & 2 deletions app/scripts/modules/appengine/src/appengine.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { IProviderSettings, SETTINGS } from '@spinnaker/core';
export interface IAppengineProviderSettings extends IProviderSettings {
defaults: {
account?: string;
editLoadBalancerStageEnabled?: boolean;
containerImageUrlDeployments?: boolean;
};
}

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/modules/core/src/api/ApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class InvalidAPIResponse extends Error {

export class API {
private static defaultParams = {
timeout: SETTINGS.pollSchedule * 2 + 5000,
timeout: (SETTINGS.pollSchedule || 30000) * 2 + 5000,
headers: {
'X-RateLimit-App': 'deck',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ChaosMonkeyNewApplicationConfigController {
this.enabled = SETTINGS.feature.chaosMonkey;
if (this.enabled) {
this.applicationConfig.chaosMonkey = {
enabled: SETTINGS.newApplicationDefaults.chaosMonkey,
enabled: SETTINGS.newApplicationDefaults?.chaosMonkey,
meanTimeBetweenKillsInWorkDays: 2,
minTimeBetweenKillsInWorkDays: 1,
grouping: 'cluster',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface IPubsubTriggerProps {
export function PubsubTrigger(pubsubTriggerProps: IPubsubTriggerProps) {
const { formik } = pubsubTriggerProps;
const trigger = formik.values;
const pubsubSystems = SETTINGS.pubsubProviders || ['google']; // TODO(joonlim): Add amazon once it is confirmed that amazon pub/sub works.
const pubsubSystems = SETTINGS.pubsubProviders || ['amazon', 'google'];

const fetchSubscriptions = useLatestPromise(() => PubsubSubscriptionReader.getPubsubSubscriptions(), []);
const pubsubSubscriptions = fetchSubscriptions.result || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ export class ExecutionService {
method: 'PATCH',
url: targetUrl,
data,
timeout: SETTINGS.pollSchedule * 2 + 5000,
timeout: (SETTINGS.pollSchedule || 30000) * 2 + 5000,
};
return this.$http(request).then(resp => resp.data);
}
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/modules/core/src/scheduler/SchedulerFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IScheduler {
}

export class SchedulerFactory {
public static createScheduler(pollSchedule = SETTINGS.pollSchedule): IScheduler {
public static createScheduler(pollSchedule = SETTINGS.pollSchedule || 30000): IScheduler {
let scheduler = new Subject();

let lastRunTimestamp = new Date().getTime();
Expand Down
5 changes: 0 additions & 5 deletions app/scripts/modules/kubernetes/src/kubernetes.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ export interface IKubernetesProviderSettings extends IProviderSettings {
defaults: {
account?: string;
namespace?: string;
proxy?: string;
internalDNSNameTemplate?: string;
instanceLinkTemplate?: string;
rrb?: boolean;
apiPrefix?: string;
};
}

Expand Down
5 changes: 5 additions & 0 deletions halconfig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This directory contains skeleton Deck configuration hydrated by Halyard.

This config is **deprecated** and in general should not be further updated.
To set a default config value, either set the value in `/core/config/settings.ts`
or set a default in the code reading the config property.
81 changes: 0 additions & 81 deletions halconfig/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@ var defaultCanaryJudge = '{%canary.defaultJudge%}';
var defaultMetricsStore = '{%canary.defaultMetricsStore%}';
var defaultMetricsAccountName = '{%canary.defaultMetricsAccount%}';
var defaultStorageAccountName = '{%canary.defaultStorageAccount%}';
var displayTimestampsInUserLocalTime = '{%features.displayTimestampsInUserLocalTime%}' === 'true';
var entityTagsEnabled = false;
var fiatEnabled = '{%features.fiat%}' === 'true';
var gceScaleDownControlsEnabled = '{%features.gceScaleDownControlsEnabled%}' === 'true';
var gceStatefulMigsEnabled = '{%features.gceStatefulMigsEnabled%}' === 'true';
var iapRefresherEnabled = '{%features.iapRefresherEnabled%}' === 'true';
var maxPipelineAgeDays = '{%maxPipelineAgeDays%}';
var mineCanaryEnabled = '{%features.mineCanary%}' === 'true';
var notificationsEnabled = '{%notifications.enabled%}' === 'true';
var onDemandClusterThreshold = '{%onDemandClusterThreshold%}';
var pipelineTemplatesEnabled = '{%features.pipelineTemplates%}' === 'true';
var reduxLoggerEnabled = '{%canary.reduxLogger%}' === 'true';
var showAllConfigsEnabled = '{%canary.showAllCanaryConfigs%}' === 'true';
Expand All @@ -40,28 +32,18 @@ var githubStatus = {
var templatesEnabled = '{%canary.templatesEnabled%}' === 'true';
var timezone = '{%timezone%}';
var version = '{%version%}';
var functionsEnabled = '{%features.functions%}' === 'true';

// Cloud Providers
var appengine = {
defaults: {
account: '{%appengine.default.account%}',
editLoadBalancerStageEnabled: '{%appengine.enabled%}' === 'true',
},
};
var aws = {
defaults: {
account: '{%aws.default.account%}',
iamRole: 'BaseIAMRole',
region: '{%aws.default.region%}',
},
defaultSecurityGroups: [],
loadBalancers: {
// if true, VPC load balancers will be created as internal load balancers if the selected subnet has a purpose
// tag that starts with "internal"
inferInternalFlagFromSubnet: false,
},
useAmiBlockDeviceMappings: false,
};
var azure = {
defaults: {
Expand Down Expand Up @@ -90,15 +72,11 @@ var gce = {
region: '{%google.default.region%}',
zone: '{%google.default.zone%}',
},
associatePublicIpAddress: true,
};
var kubernetes = {
defaults: {
account: '{%kubernetes.default.account%}',
instanceLinkTemplate: '{{host}}/api/v1/proxy/namespaces/{{namespace}}/pods/{{name}}',
internalDNSNameTemplate: '{{name}}.{{namespace}}.svc.cluster.local',
namespace: '{%kubernetes.default.namespace%}',
proxy: '{%kubernetes.default.proxy%}',
},
};
var huaweicloud = {
Expand All @@ -123,7 +101,6 @@ var tencentcloud = {
window.spinnakerSettings = {
authEnabled: authEnabled,
authEndpoint: authEndpoint,
authTtl: 600000,
bakeryDetailUrl: bakeryDetailUrl,
canary: {
atlasWebComponentsUrl: atlasWebComponentsUrl,
Expand All @@ -141,47 +118,16 @@ window.spinnakerSettings = {
fileName: changelogGistName,
gistId: changelogGistId,
},
checkForUpdates: false,
defaultInstancePort: 80,
defaultProviders: [
'appengine',
'aws',
'azure',
'cloudfoundry',
'dcos',
'ecs',
'gce',
'huaweicloud',
'kubernetes',
'oracle',
'titus',
'tencentcloud',
],
defaultTimeZone: timezone, // see http://momentjs.com/timezone/docs/#/data-utilities/
feature: {
canary: mineCanaryEnabled,
chaosMonkey: chaosEnabled,
displayTimestampsInUserLocalTime: displayTimestampsInUserLocalTime,
entityTags: entityTagsEnabled,
fiatEnabled: fiatEnabled,
gceScaleDownControlsEnabled: gceScaleDownControlsEnabled,
gceStatefulMigsEnabled: gceStatefulMigsEnabled,
iapRefresherEnabled: iapRefresherEnabled,
notifications: notificationsEnabled,
pagerDuty: false,
pipelines: true,
pipelineTemplates: pipelineTemplatesEnabled,
roscoMode: true,
slack: false,
snapshots: false,
functions: functionsEnabled,
},
gateUrl: gateHost,
gitSources: ['bitbucket', 'gitlab', 'github', 'stash'],
maxPipelineAgeDays: maxPipelineAgeDays,
newApplicationDefaults: {
chaosMonkey: false,
},
notifications: {
bearychat: {
enabled: true,
Expand All @@ -199,11 +145,6 @@ window.spinnakerSettings = {
slack: slack,
sms: sms,
},
onDemandClusterThreshold: onDemandClusterThreshold,
pagerDuty: {
required: false,
},
pollSchedule: 30000,
providers: {
appengine: appengine,
aws: aws,
Expand All @@ -215,29 +156,7 @@ window.spinnakerSettings = {
huaweicloud: huaweicloud,
kubernetes: kubernetes,
oracle: oracle,
titus: {
defaults: {
account: 'titustestvpc',
iamProfile: '{{application}}InstanceProfile',
region: 'us-east-1',
},
},
tencentcloud: tencentcloud,
},
pubsubProviders: ['amazon', 'google'],
triggerTypes: [
'artifactory',
'nexus',
'concourse',
'cron',
'docker',
'git',
'jenkins',
'pipeline',
'pubsub',
'travis',
'webhook',
'wercker',
],
version: version,
};
7 changes: 1 addition & 6 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ window.spinnakerSettings = {
defaultSecurityGroups: [],
},
gce: {
associatePublicIpAddress: true,
defaults: {
account: 'my-google-account',
instanceTypeStorage: {
Expand Down Expand Up @@ -203,11 +202,7 @@ window.spinnakerSettings = {
kubernetes: {
defaults: {
account: 'my-kubernetes-account',
apiPrefix: 'api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard/#',
instanceLinkTemplate: '{{host}}/api/v1/proxy/namespaces/{{namespace}}/pods/{{name}}',
internalDNSNameTemplate: '{{name}}.{{namespace}}.svc.cluster.local',
namespace: 'default',
proxy: 'localhost:8001',
},
},
oracle: {
Expand Down Expand Up @@ -237,7 +232,7 @@ window.spinnakerSettings = {
slack: {
baseUrl: 'https://slack.com',
},
pubsubProviders: ['google'], // TODO(joonlim): Add amazon once it is confirmed that amazon pub/sub works.
pubsubProviders: ['amazon', 'google'],
plugins: [],
searchVersion: 1,
triggerTypes: [
Expand Down

0 comments on commit 2cc6900

Please sign in to comment.