1 | import { ProjectOperationCredentials, RemoteRepoRef } from "@atomist/automation-client";
|
2 | import { SoftwareDeliveryMachine } from "@atomist/sdm";
|
3 | /**
|
4 | * Configuration options to be passed to the extension pack creation.
|
5 | */
|
6 | export interface SdmPackK8sOptions {
|
7 | /**
|
8 | * Whether to add the bot/web-app commands provided by this SDM
|
9 | * extension pack. If no value is provided, the commands are not
|
10 | * added.
|
11 | */
|
12 | addCommands?: boolean;
|
13 | /**
|
14 | * Whether to register and converge a k8s cluster. Typically this
|
15 | * is used from k8s-sdm to manage k8s cluster it is running in.
|
16 | */
|
17 | registerCluster?: boolean;
|
18 | /**
|
19 | * Synchronize resources in k8s cluster with a Git repo.
|
20 | */
|
21 | sync?: KubernetesSyncOptions;
|
22 | }
|
23 | /**
|
24 | * Configuration options for sync mode operation.
|
25 | */
|
26 | export interface KubernetesSyncOptions {
|
27 | /**
|
28 | * To synchronize resources in k8s cluster with a Git repo,
|
29 | * provide a repo ref as the value of this property. The value
|
30 | * can be either a SyncRepoRef or RemoteRepoRef. On startup, the
|
31 | * contents of this repo ref will be synchronized with the
|
32 | * cluster, subsequent changes to this repo will be syncronized to
|
33 | * the cluster, and subsequent resource deployments will update
|
34 | * the contents of this repo.
|
35 | *
|
36 | * If a SyncRepoRef is provided, on startup cortex is queried to
|
37 | * find the details of the repo needed to create a RemoteRepoRef.
|
38 | * This RemoteRepoRef is created and then used as the value of
|
39 | * this property for the lifetime of the SDM.
|
40 | *
|
41 | * If a RemoteRepoRef is provided, it is used as is.
|
42 | */
|
43 | repo: SyncRepoRef | RemoteRepoRef;
|
44 | /**
|
45 | * Credentials to use when cloning the sync.repo. These are
|
46 | * typically not provided in the SDM configuration, rather they
|
47 | * are are obtained during startup by the SDM via a cortex query.
|
48 | * If they are provided, the provided credentials are used rather
|
49 | * than any returned from cortex.
|
50 | */
|
51 | credentials?: ProjectOperationCredentials;
|
52 | /**
|
53 | * If provided, the SDM will apply all specs in the sync repo
|
54 | * approximately every `intervalMinutes` minutes. If not provided
|
55 | * or set to zero (0) or a negative number, specs will only be
|
56 | * applied at startup or when they are changed by a commit.
|
57 | */
|
58 | intervalMinutes?: number;
|
59 | /**
|
60 | * Key to use to encrypt Kubernetes Secret resource values before
|
61 | * storing them in the sync repo and decrypt them when reading
|
62 | * them from the sync repo. If it is not provided, secrets are
|
63 | * not encrypted in the sync repo, so hopefully they aren't too
|
64 | * secret.
|
65 | *
|
66 | * You can use the Atomist CLI or bin/secret.js script bundled
|
67 | * with this package to manually encrypt and decrypt values using
|
68 | * the same strategy.
|
69 | */
|
70 | secretKey?: string;
|
71 | /**
|
72 | * Default format to use when creating Kubernetes specs in the
|
73 | * sync repo. If updating an existing file, the format of the
|
74 | * existing file will be used. If not provided, "yaml" is the
|
75 | * default.
|
76 | */
|
77 | specFormat?: "json" | "yaml";
|
78 | }
|
79 | /**
|
80 | * Information needed to create a proper RemoteRepoRef for the
|
81 | * [[SdmPackK8sOptions.sync.repo]] by querying cortex.
|
82 | */
|
83 | export interface SyncRepoRef {
|
84 | /** Owner, i.e., user or organization, of sync repo. */
|
85 | owner: string;
|
86 | /** Name of sync repository. */
|
87 | repo: string;
|
88 | /**
|
89 | * If branch is provided, it is used. If it is not provided,
|
90 | * things get complicated. If the repo exists in the graph and it
|
91 | * has the defaultBranch property set, then the defaultBranch is
|
92 | * used. If the repo does not exist in the graph or its
|
93 | * defaultBranch property is not set, "master" is used. Since the
|
94 | * repo defaultBranch property could not be set initially but get
|
95 | * set at a later time, how sync repo behaves can change even if
|
96 | * the configuration does not. Long story short, even though
|
97 | * branch is optional, set it if you want sync repo to behave
|
98 | * deterministically.
|
99 | */
|
100 | branch?: string;
|
101 | /**
|
102 | * The internal cortex ID of the source code management (SCM)
|
103 | * provider for the sync repo. Typically this is not necessary
|
104 | * and not provided. It is only necessary to provide the provider
|
105 | * ID if your Atomist workspace has multiple SCM providers and the
|
106 | * name and owner of the sync repo you want to use matches
|
107 | * different repositories in different SCM providers. For
|
108 | * example, if you want to use "my/specs" as your sync repo and
|
109 | * your Atomist workspace is linked to both GitHub.com and a GHE
|
110 | * instance, both of which have a repo named "my/specs".
|
111 | */
|
112 | providerId?: string;
|
113 | }
|
114 | /** Validate the the partial SyncOptions contains a repo property. */
|
115 | export declare function validSyncOptions(o: Partial<KubernetesSyncOptions>): o is KubernetesSyncOptions;
|
116 | /**
|
117 | * Safely merge the the provided Kubernetes options with those already
|
118 | * existing in the SDM. The values in the SDM take precedence over
|
119 | * those in the passed in options. The passed in SDM is modified in
|
120 | * place and returned.
|
121 | *
|
122 | * @param sdm Software Delivery Machine that may or may not have any Kubernetes pack options
|
123 | * @param options Kubernetes pack options
|
124 | * @return Modified SDM object
|
125 | */
|
126 | export declare function mergeK8sOptions(sdm: SoftwareDeliveryMachine, options?: SdmPackK8sOptions): SoftwareDeliveryMachine;
|
127 | //# sourceMappingURL=config.d.ts.map |
\ | No newline at end of file |