diff --git a/charts/fleet-crd/templates/crds.yaml b/charts/fleet-crd/templates/crds.yaml index 7bb19d5deb..38af07511d 100644 --- a/charts/fleet-crd/templates/crds.yaml +++ b/charts/fleet-crd/templates/crds.yaml @@ -22,68 +22,81 @@ spec: properties: spec: properties: - force: - type: boolean + diff: + nullable: true + properties: + comparePatches: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + operations: + items: + properties: + op: + nullable: true + type: string + path: + nullable: true + type: string + value: + nullable: true + type: string + type: object + nullable: true + type: array + type: object + nullable: true + type: array + type: object forceSyncBefore: nullable: true type: string - kustomizeDir: + helm: nullable: true - type: string + properties: + chart: + nullable: true + type: string + force: + type: boolean + releaseName: + nullable: true + type: string + repo: + nullable: true + type: string + takeOwnership: + type: boolean + timeoutSeconds: + type: integer + values: + nullable: true + type: object + version: + nullable: true + type: string + type: object + kustomize: + nullable: true + properties: + dir: + nullable: true + type: string + type: object namespace: nullable: true type: string - overlays: - items: - properties: - force: - type: boolean - forceSyncBefore: - nullable: true - type: string - kustomizeDir: - nullable: true - type: string - name: - nullable: true - type: string - namespace: - nullable: true - type: string - overlays: - items: - nullable: true - type: string - nullable: true - type: array - resources: - items: - properties: - content: - nullable: true - type: string - encoding: - nullable: true - type: string - name: - nullable: true - type: string - type: object - nullable: true - type: array - serviceAccount: - nullable: true - type: string - takeOwnership: - type: boolean - timeoutSeconds: - type: integer - values: - nullable: true - type: object - type: object - nullable: true - type: array paused: type: boolean resources: @@ -188,8 +201,6 @@ spec: serviceAccount: nullable: true type: string - takeOwnership: - type: boolean targetRestrictions: items: properties: @@ -320,43 +331,109 @@ spec: nullable: true type: object type: object - force: - type: boolean + diff: + nullable: true + properties: + comparePatches: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + operations: + items: + properties: + op: + nullable: true + type: string + path: + nullable: true + type: string + value: + nullable: true + type: string + type: object + nullable: true + type: array + type: object + nullable: true + type: array + type: object forceSyncBefore: nullable: true type: string - kustomizeDir: + helm: nullable: true - type: string + properties: + chart: + nullable: true + type: string + force: + type: boolean + releaseName: + nullable: true + type: string + repo: + nullable: true + type: string + takeOwnership: + type: boolean + timeoutSeconds: + type: integer + values: + nullable: true + type: object + version: + nullable: true + type: string + type: object + kustomize: + nullable: true + properties: + dir: + nullable: true + type: string + type: object name: nullable: true type: string namespace: nullable: true type: string - overlays: - items: - nullable: true - type: string - nullable: true - type: array serviceAccount: nullable: true type: string - takeOwnership: - type: boolean - timeoutSeconds: - type: integer - values: + yaml: nullable: true + properties: + overlays: + items: + nullable: true + type: string + nullable: true + type: array type: object type: object nullable: true type: array - timeoutSeconds: - type: integer - values: + yaml: nullable: true + properties: + overlays: + items: + nullable: true + type: string + nullable: true + type: array type: object type: object status: @@ -457,6 +534,99 @@ spec: name: nullable: true type: string + nonReadyStatus: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + summary: + properties: + attributes: + nullable: true + type: object + error: + type: boolean + message: + items: + nullable: true + type: string + nullable: true + type: array + relationships: + items: + properties: + apiVersion: + nullable: true + type: string + controlledBy: + type: boolean + inbound: + type: boolean + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + selector: + nullable: true + properties: + matchExpressions: + items: + properties: + key: + nullable: true + type: string + operator: + nullable: true + type: string + values: + items: + nullable: true + type: string + nullable: true + type: array + type: object + nullable: true + type: array + matchLabels: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + type: object + type: + nullable: true + type: string + type: object + nullable: true + type: array + state: + nullable: true + type: string + transitioning: + type: boolean + type: object + uid: + nullable: true + type: string + type: object + nullable: true + type: array type: object nullable: true type: array @@ -521,6 +691,99 @@ spec: name: nullable: true type: string + nonReadyStatus: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + summary: + properties: + attributes: + nullable: true + type: object + error: + type: boolean + message: + items: + nullable: true + type: string + nullable: true + type: array + relationships: + items: + properties: + apiVersion: + nullable: true + type: string + controlledBy: + type: boolean + inbound: + type: boolean + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + selector: + nullable: true + properties: + matchExpressions: + items: + properties: + key: + nullable: true + type: string + operator: + nullable: true + type: string + values: + items: + nullable: true + type: string + nullable: true + type: array + type: object + nullable: true + type: array + matchLabels: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + type: object + type: + nullable: true + type: string + type: object + nullable: true + type: array + state: + nullable: true + type: string + transitioning: + type: boolean + type: object + uid: + nullable: true + type: string + type: object + nullable: true + type: array type: object nullable: true type: array @@ -580,26 +843,93 @@ spec: type: string options: properties: - force: - type: boolean + diff: + nullable: true + properties: + comparePatches: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + operations: + items: + properties: + op: + nullable: true + type: string + path: + nullable: true + type: string + value: + nullable: true + type: string + type: object + nullable: true + type: array + type: object + nullable: true + type: array + type: object forceSyncBefore: nullable: true type: string - kustomizeDir: + helm: nullable: true - type: string + properties: + chart: + nullable: true + type: string + force: + type: boolean + releaseName: + nullable: true + type: string + repo: + nullable: true + type: string + takeOwnership: + type: boolean + timeoutSeconds: + type: integer + values: + nullable: true + type: object + version: + nullable: true + type: string + type: object + kustomize: + nullable: true + properties: + dir: + nullable: true + type: string + type: object namespace: nullable: true type: string serviceAccount: nullable: true type: string - takeOwnership: - type: boolean - timeoutSeconds: - type: integer - values: + yaml: nullable: true + properties: + overlays: + items: + nullable: true + type: string + nullable: true + type: array type: object type: object stagedDeploymentID: @@ -607,26 +937,93 @@ spec: type: string stagedOptions: properties: - force: - type: boolean + diff: + nullable: true + properties: + comparePatches: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + operations: + items: + properties: + op: + nullable: true + type: string + path: + nullable: true + type: string + value: + nullable: true + type: string + type: object + nullable: true + type: array + type: object + nullable: true + type: array + type: object forceSyncBefore: nullable: true type: string - kustomizeDir: + helm: nullable: true - type: string + properties: + chart: + nullable: true + type: string + force: + type: boolean + releaseName: + nullable: true + type: string + repo: + nullable: true + type: string + takeOwnership: + type: boolean + timeoutSeconds: + type: integer + values: + nullable: true + type: object + version: + nullable: true + type: string + type: object + kustomize: + nullable: true + properties: + dir: + nullable: true + type: string + type: object namespace: nullable: true type: string serviceAccount: nullable: true type: string - takeOwnership: - type: boolean - timeoutSeconds: - type: integer - values: + yaml: nullable: true + properties: + overlays: + items: + nullable: true + type: string + nullable: true + type: array type: object type: object type: object @@ -1038,6 +1435,99 @@ spec: name: nullable: true type: string + nonReadyStatus: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + summary: + properties: + attributes: + nullable: true + type: object + error: + type: boolean + message: + items: + nullable: true + type: string + nullable: true + type: array + relationships: + items: + properties: + apiVersion: + nullable: true + type: string + controlledBy: + type: boolean + inbound: + type: boolean + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + selector: + nullable: true + properties: + matchExpressions: + items: + properties: + key: + nullable: true + type: string + operator: + nullable: true + type: string + values: + items: + nullable: true + type: string + nullable: true + type: array + type: object + nullable: true + type: array + matchLabels: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + type: object + type: + nullable: true + type: string + type: object + nullable: true + type: array + state: + nullable: true + type: string + transitioning: + type: boolean + type: object + uid: + nullable: true + type: string + type: object + nullable: true + type: array type: object nullable: true type: array @@ -1223,6 +1713,99 @@ spec: name: nullable: true type: string + nonReadyStatus: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + summary: + properties: + attributes: + nullable: true + type: object + error: + type: boolean + message: + items: + nullable: true + type: string + nullable: true + type: array + relationships: + items: + properties: + apiVersion: + nullable: true + type: string + controlledBy: + type: boolean + inbound: + type: boolean + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + selector: + nullable: true + properties: + matchExpressions: + items: + properties: + key: + nullable: true + type: string + operator: + nullable: true + type: string + values: + items: + nullable: true + type: string + nullable: true + type: array + type: object + nullable: true + type: array + matchLabels: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + type: object + type: + nullable: true + type: string + type: object + nullable: true + type: array + state: + nullable: true + type: string + transitioning: + type: boolean + type: object + uid: + nullable: true + type: string + type: object + nullable: true + type: array type: object nullable: true type: array @@ -1322,18 +1905,21 @@ spec: branch: nullable: true type: string - bundleDirs: - items: - nullable: true - type: string - nullable: true - type: array clientSecretName: nullable: true type: string forceSyncBefore: nullable: true type: string + forceUpdate: + nullable: true + type: string + paths: + items: + nullable: true + type: string + nullable: true + type: array pollingInterval: nullable: true type: string @@ -1500,6 +2086,99 @@ spec: name: nullable: true type: string + nonReadyStatus: + items: + properties: + apiVersion: + nullable: true + type: string + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + summary: + properties: + attributes: + nullable: true + type: object + error: + type: boolean + message: + items: + nullable: true + type: string + nullable: true + type: array + relationships: + items: + properties: + apiVersion: + nullable: true + type: string + controlledBy: + type: boolean + inbound: + type: boolean + kind: + nullable: true + type: string + name: + nullable: true + type: string + namespace: + nullable: true + type: string + selector: + nullable: true + properties: + matchExpressions: + items: + properties: + key: + nullable: true + type: string + operator: + nullable: true + type: string + values: + items: + nullable: true + type: string + nullable: true + type: array + type: object + nullable: true + type: array + matchLabels: + additionalProperties: + nullable: true + type: string + nullable: true + type: object + type: object + type: + nullable: true + type: string + type: object + nullable: true + type: array + state: + nullable: true + type: string + transitioning: + type: boolean + type: object + uid: + nullable: true + type: string + type: object + nullable: true + type: array type: object nullable: true type: array diff --git a/charts/fleet/templates/configmap.yaml b/charts/fleet/templates/configmap.yaml index 207b63ea9a..e4b578e320 100644 --- a/charts/fleet/templates/configmap.yaml +++ b/charts/fleet/templates/configmap.yaml @@ -11,7 +11,7 @@ data: "apiServerCA": "{{b64enc .Values.apiServerCA}}", "ignoreClusterRegistrationLabels": {{.Values.ignoreClusterRegistrationLabels}}, "bootstrap": { - "dirs": "{{.Values.bootstrap.dirs}}", + "paths": "{{.Values.bootstrap.paths}}", "repo": "{{.Values.bootstrap.repo}}", "secret": "{{.Values.bootstrap.secret}}", "branch": "{{.Values.bootstrap.branch}}", diff --git a/charts/fleet/values.yaml b/charts/fleet/values.yaml index 96192fb282..5fabcb5469 100644 --- a/charts/fleet/values.yaml +++ b/charts/fleet/values.yaml @@ -36,4 +36,4 @@ bootstrap: repo: "" secret: "" branch: master - dirs: "" + paths: "" diff --git a/go.mod b/go.mod index 353271dfdf..f7f8d7a154 100644 --- a/go.mod +++ b/go.mod @@ -14,12 +14,13 @@ require ( github.com/hashicorp/go-getter v1.4.1 github.com/pkg/errors v0.9.1 github.com/rancher/fleet/pkg/apis v0.0.0 - github.com/rancher/gitjob v0.1.0 + github.com/rancher/gitjob v0.1.1 github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0 - github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc + github.com/rancher/wrangler v0.6.2-0.20200916052259-24781350894c github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 + go.mozilla.org/sops/v3 v3.6.1 golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a helm.sh/helm/v3 v3.0.0 k8s.io/api v0.18.8 diff --git a/go.sum b/go.sum index 283df9c1c9..96b9c056a5 100644 --- a/go.sum +++ b/go.sum @@ -2,29 +2,44 @@ bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxo cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= github.com/360EntSecGroup-Skylar/excelize v1.4.1/go.mod h1:vnax29X2usfl7HHkBrX5EvSCJcmH3dT9luvxzu8iGAE= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v31.2.0+incompatible h1:kZFnTLmdQYNGfakatSivKHUfUnDZhqNdchHD4oIhp5k= +github.com/Azure/azure-sdk-for-go v31.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest v14.0.0+incompatible h1:r/ug62X9o8vikt53/nkAPmFmzfSrCCAplPH7wa+mK0U= github.com/Azure/go-autorest v14.0.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU= github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/azure/auth v0.1.0 h1:YgO/vSnJEc76NLw2ecIXvXa8bDWiqf1pOJzARAoZsYU= +github.com/Azure/go-autorest/autorest/azure/auth v0.1.0/go.mod h1:Gf7/i2FUpyb/sGBLIFxTBzrNzBo7aPXXE3ZVeDRwdpM= +github.com/Azure/go-autorest/autorest/azure/cli v0.1.0 h1:YTtBrcb6mhA+PoSW8WxFDoIIyjp13XqJeX80ssQtri4= +github.com/Azure/go-autorest/autorest/azure/cli v0.1.0/go.mod h1:Dk8CUAt/b/PzkfeRsWzVG9Yj3ps8mS8ECztu43rdU8U= github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM= github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/to v0.3.0 h1:zebkZaadz7+wIQYgC7GXaz3Wb28yKYfVkkBKwc38VF8= +github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= +github.com/Azure/go-autorest/autorest/validation v0.2.0 h1:15vMO4y76dehZSq7pAaOLQxC6dZYsSrj2GQpflyM/L4= +github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI= github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= @@ -48,11 +63,14 @@ github.com/Masterminds/sprig/v3 v3.1.0/go.mod h1:ONGMf7UfYGAbMXCZmQLy8x3lCDIPrEZ github.com/Masterminds/squirrel v1.4.0 h1:he5i/EXixZxrBUWcxzDYMiju9WZ3ld/l7QBNuo/eN3w= github.com/Masterminds/squirrel v1.4.0/go.mod h1:yaPeOnPG5ZRwL9oKdTsO/prlkPbXWZlRVMQ/gGlzIuA= github.com/Masterminds/vcs v1.13.1/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= @@ -94,6 +112,8 @@ github.com/aws/aws-sdk-go v1.15.78 h1:LaXy6lWR0YK7LKyuU0QWy2ws/LWTPfYV/UgfiBu4tv github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.27.0 h1:0xphMHGMLBrPMfxR2AmVjZKcMEESEgWF8Kru94BNByk= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.33.18 h1:Ccy1SV2SsgJU3rfrD+SOhQ0jvuzfrFuja/oKI86ruPw= +github.com/aws/aws-sdk-go v1.33.18/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -108,6 +128,8 @@ github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkN github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bombsimon/wsl v1.2.5/go.mod h1:43lEF/i0kpXbLCeDXL9LMT8c92HyBywXb0AsgMHYngM= @@ -120,7 +142,9 @@ github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0Bsq github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -189,6 +213,8 @@ github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= +github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/cli v0.0.0-20200130152716-5d0cf8839492 h1:FwssHbCDJD025h+BchanCwE1Q8fyMgqDr2mOQAWOLGw= github.com/docker/cli v0.0.0-20200130152716-5d0cf8839492/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= @@ -239,6 +265,7 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= @@ -257,6 +284,7 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -318,7 +346,10 @@ github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85n github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= @@ -373,6 +404,8 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= @@ -413,6 +446,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -427,6 +461,7 @@ github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJ github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU= github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33 h1:893HsJqtxp9z1SF76gg6hY70hRY1wVlTSnC/h1yUDCo= @@ -443,6 +478,10 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408 h1:Y9iQJfEqnN3/Nce9cOegemcy/9Ai5k3huT6E80F3zaw= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408/go.mod h1:PE1ycukgRPJ7bJ9a1fdfQ9j8i/cEcRAoLZzbxYpNB/s= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -455,12 +494,14 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -468,14 +509,24 @@ github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVo github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-getter v1.4.1 h1:3A2Mh8smGFcf5M+gmcv898mZdrxpseik45IpcyISLsA= github.com/hashicorp/go-getter v1.4.1/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= +github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= +github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= +github.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE= +github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.1 h1:DMo4fmknnz0E0evoNYnV48RjWndOsmd6OW+09R3cEP8= +github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -493,6 +544,14 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU= +github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= +github.com/hashicorp/vault/sdk v0.1.13 h1:mOEPeOhT7jl0J4AMl1E705+BcmeRs1VmKNb9F0sMLy8= +github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= +github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= +github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= @@ -519,6 +578,8 @@ github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= +github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= @@ -533,6 +594,7 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -608,6 +670,7 @@ github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= +github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= @@ -631,6 +694,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mozilla-services/yaml v0.0.0-20191106225358-5c216288813c h1:yE1NxRAZA3wF0laDWECtOe2J0tFjSHUI6MXXbMif+QY= +github.com/mozilla-services/yaml v0.0.0-20191106225358-5c216288813c/go.mod h1:Is/Ucts/yU/mWyGR8yELRoO46mejouKsJfQLAIfTR18= github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -691,8 +756,11 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxS github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/ory/dockertest v3.3.4+incompatible h1:VrpM6Gqg7CrPm3bL4Wm1skO+zFWLbh7/Xb5kGEbJRh8= +github.com/ory/dockertest v3.3.4+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/paulmach/orb v0.1.3/go.mod h1:VFlX/8C+IQ1p6FTRRKzKoOPJnvEtA5G0Veuqwbu//Vk= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= @@ -703,6 +771,7 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -758,17 +827,16 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/qri-io/starlib v0.4.2-0.20200213133954-ff2e8cd5ef8d h1:K6eOUihrFLdZjZnA4XlRp864fmWXv9YTIk7VPLhRacA= github.com/qri-io/starlib v0.4.2-0.20200213133954-ff2e8cd5ef8d/go.mod h1:7DPO4domFU579Ga6E61sB9VFNaniPVwJP5C4bBCu3wA= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/rancher/gitjob v0.1.0 h1:wHM4gqMccmQf5AvTXji4/wwYwNxfl82TVdkaKUhykHk= -github.com/rancher/gitjob v0.1.0/go.mod h1:t3nHCqGx8TdxnPrQOpucJDxNnthGIxCatwO5J1V8hAg= +github.com/rancher/gitjob v0.1.1 h1:suQd62hcvm/siP96sVOviMWNvHJ1MYPTPxSw9FjGVOE= +github.com/rancher/gitjob v0.1.1/go.mod h1:gjWs5yG4rwJOSsOTxI2fiHTw4VNeJ44N4EdbAW1lYYI= github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0 h1:ng7i8n0kzTGnXyvVK+nkb+sLm06BBNdsbd2aqJAP3lM= github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0/go.mod h1:OhBBBO1pBwYp0hacWdnvSGOj+XE9yMLOLnaypIlic18= github.com/rancher/wrangler v0.6.1/go.mod h1:L4HtjPeX8iqLgsxfJgz+JjKMcX2q3qbRXSeTlC/CSd4= -github.com/rancher/wrangler v0.6.2-0.20200828043115-6943c5e1c9c7 h1:HXP9Rg3ijtwVaVCy8kaLLoSXEXm0mzxBenFnqi+Dh9A= -github.com/rancher/wrangler v0.6.2-0.20200828043115-6943c5e1c9c7/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= +github.com/rancher/wrangler v0.6.2-0.20200828062337-113afceceb91/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224 h1:NWYSyS1YiWJOB84xq0FcGDY8xQQwrfKoip2BjMSlu1g= github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= -github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc h1:Td32Jny0tPOQFLxxZHxgfk9mlEYJopwB47EizTQuGjU= -github.com/rancher/wrangler v0.6.2-0.20200912225020-2e02d61f54bc/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= +github.com/rancher/wrangler v0.6.2-0.20200916052259-24781350894c h1:DwmYRHyZR8w1Uqpn39hLujfsa1tn43jFfT6i0bf8eQw= +github.com/rancher/wrangler v0.6.2-0.20200916052259-24781350894c/go.mod h1:I7qe4DZNMOLKVa9ax7DJdBZ0XtKOppLF/dalhPX3vaE= github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43 h1:+Bc9QnL9GuZiYxc3Mvm4n6EEjgI5TFQLDGjpRhQbkVk= github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43/go.mod h1:KxpGNhk/oVL6LCfyxESTD1sb8eXRlUxtkbNm06+7dZU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -786,6 +854,9 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -806,8 +877,11 @@ github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4 github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= @@ -880,6 +954,7 @@ github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= +github.com/vektra/mockery v1.1.2/go.mod h1:VcfZjKaFOPO+MpN4ZvwPjs4c48lkq1o3Ym8yHZJu0jU= github.com/whilp/git-urls v0.0.0-20191001220047-6db9661140c0 h1:qqllXPzXh+So+mmANlX/gCJrgo+1kQyshMoQ+NASzm0= github.com/whilp/git-urls v0.0.0-20191001220047-6db9661140c0/go.mod h1:2rx5KE5FLD0HRfkkpyn8JwbVLBdhgeiOb2D2D9LLKM4= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= @@ -896,6 +971,7 @@ github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSf github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI= github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yujunz/go-getter v1.4.1-lite h1:FhvNc94AXMZkfqUwfMKhnQEC9phkphSGdPTL7tIdhOM= github.com/yujunz/go-getter v1.4.1-lite/go.mod h1:sbmqxXjyLunH1PkF3n7zSlnVeMvmYUuIl9ZVs/7NyCc= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 h1:+lm10QQTNSBd8DVTNGHx7o/IKu9HYDvLMffDhbyLccI= @@ -914,6 +990,10 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a h1:N7VD+PwpJME2ZfQT8+ejxwA4Ow10IkGbU0MGf94ll8k= +go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a/go.mod h1:YDKUvO0b//78PaaEro6CAPH6NqohCmL2Cwju5XI2HoE= +go.mozilla.org/sops/v3 v3.6.1 h1:SQXX2hXcZHBw4ZIPpvFbEns6hA7f2rE6kbN6E0heEkM= +go.mozilla.org/sops/v3 v3.6.1/go.mod h1:3KLncZfyE0cG/28CriTo0JJMARroeKToDIISBgN93xw= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -947,6 +1027,7 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -978,6 +1059,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1009,6 +1092,7 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= @@ -1040,11 +1124,13 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1070,6 +1156,7 @@ golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fq golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1115,8 +1202,11 @@ golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 h1:DnSr2mCsxyCE6ZgIkmcWUQY2R5cH/6wL7eIxEmQOMSE= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e h1:ssd5ulOvVWlh4kDSUF2SqzmMeWfjmwDXM+uGw/aQjRE= +golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= @@ -1143,20 +1233,25 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -1166,6 +1261,7 @@ google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1184,11 +1280,17 @@ gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.44.0 h1:YRJzTUp0kSYWUVFF5XAbDFfyiqwsl0Vb9R8TVP5eRi0= +gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/modules/agent/pkg/controllers/controllers.go b/modules/agent/pkg/controllers/controllers.go index 61d84dd1cd..121b74bec7 100644 --- a/modules/agent/pkg/controllers/controllers.go +++ b/modules/agent/pkg/controllers/controllers.go @@ -4,6 +4,8 @@ import ( "context" "time" + "github.com/rancher/wrangler/pkg/ticker" + "github.com/rancher/fleet/modules/agent/pkg/controllers/bundledeployment" "github.com/rancher/fleet/modules/agent/pkg/controllers/cluster" "github.com/rancher/fleet/modules/agent/pkg/controllers/secret" @@ -76,7 +78,7 @@ func (a *appContext) start(ctx context.Context) error { } func Register(ctx context.Context, leaderElect bool, fleetNamespace, agentNamespace, defaultNamespace, clusterNamespace, clusterName string, fleetConfig *rest.Config, clientConfig clientcmd.ClientConfig) error { - appCtx, err := newContext(fleetNamespace, agentNamespace, clusterNamespace, clusterName, fleetConfig, clientConfig) + appCtx, err := newContext(ctx, fleetNamespace, agentNamespace, clusterNamespace, clusterName, fleetConfig, clientConfig) if err != nil { return err } @@ -126,7 +128,7 @@ func Register(ctx context.Context, leaderElect bool, fleetNamespace, agentNamesp return nil } -func newContext(fleetNamespace, agentNamespace, clusterNamespace, clusterName string, fleetConfig *rest.Config, clientConfig clientcmd.ClientConfig) (*appContext, error) { +func newContext(ctx context.Context, fleetNamespace, agentNamespace, clusterNamespace, clusterName string, fleetConfig *rest.Config, clientConfig clientcmd.ClientConfig) (*appContext, error) { client, err := clientConfig.ClientConfig() if err != nil { return nil, err @@ -184,6 +186,13 @@ func newContext(fleetNamespace, agentNamespace, clusterNamespace, clusterName st } cache := memory.NewMemCacheClient(k8s.Discovery()) + restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cache) + go func() { + for range ticker.Context(ctx, 30*time.Second) { + cache.Invalidate() + restMapper.Reset() + } + }() return &appContext{ Dynamic: dynamic, @@ -201,7 +210,7 @@ func newContext(fleetNamespace, agentNamespace, clusterNamespace, clusterName st clientConfig: clientConfig, restConfig: client, cachedDiscoveryInterface: cache, - restMapper: restmapper.NewDeferredDiscoveryRESTMapper(cache), + restMapper: restMapper, starters: []start.Starter{ core, coreNSed, diff --git a/modules/agent/pkg/deployer/deployer.go b/modules/agent/pkg/deployer/deployer.go index ef1730d107..5e188354ef 100644 --- a/modules/agent/pkg/deployer/deployer.go +++ b/modules/agent/pkg/deployer/deployer.go @@ -12,9 +12,14 @@ type Resources struct { Objects []runtime.Object `json:"objects,omitempty"` } +type DeployedBundle struct { + BundleID string + ReleaseName string +} + type Deployer interface { Deploy(bundleID string, manifest *manifest.Manifest, options fleet.BundleDeploymentOptions) (*Resources, error) - ListDeployments() ([]string, error) + ListDeployments() ([]DeployedBundle, error) Resources(bundleID, resourcesID string) (*Resources, error) - Delete(bundleID string) error + Delete(bundleID, releaseName string) error } diff --git a/modules/agent/pkg/deployer/manager.go b/modules/agent/pkg/deployer/manager.go index 6098718de7..6af01d49ac 100644 --- a/modules/agent/pkg/deployer/manager.go +++ b/modules/agent/pkg/deployer/manager.go @@ -38,20 +38,38 @@ func NewManager(fleetNamespace string, } } +func releaseName(bd *fleet.BundleDeployment) string { + ns := "default" + if bd.Spec.Options.DefaultNamespace != "" { + ns = bd.Spec.Options.DefaultNamespace + } + if bd.Spec.Options.Helm == nil || bd.Spec.Options.Helm.ReleaseName == "" { + return ns + "/" + bd.Name + } + return ns + "/" + bd.Spec.Options.Helm.ReleaseName +} + func (m *Manager) Cleanup() error { - ids, err := m.deployer.ListDeployments() + deployed, err := m.deployer.ListDeployments() if err != nil { return err } - for _, id := range ids { - _, err := m.bundleDeploymentCache.Get(m.fleetNamespace, id) + for _, deployed := range deployed { + bundleDeployment, err := m.bundleDeploymentCache.Get(m.fleetNamespace, deployed.BundleID) if apierror.IsNotFound(err) { - if err := m.deployer.Delete(id); err != nil { + if err := m.deployer.Delete(deployed.BundleID, ""); err != nil { return err } } else if err != nil { return err + } else { + releaseName := releaseName(bundleDeployment) + if releaseName != deployed.ReleaseName { + if err := m.deployer.Delete(deployed.BundleID, deployed.ReleaseName); err != nil { + return err + } + } } } @@ -60,7 +78,7 @@ func (m *Manager) Cleanup() error { func (m *Manager) Delete(bundleDeploymentKey string) error { _, name := kv.RSplit(bundleDeploymentKey, "/") - return m.deployer.Delete(name) + return m.deployer.Delete(name, "") } func (m *Manager) Resources(bd *fleet.BundleDeployment) (*Resources, error) { @@ -69,8 +87,7 @@ func (m *Manager) Resources(bd *fleet.BundleDeployment) (*Resources, error) { return nil, nil } - plan, err := m.getApply(bd, resources.DefaultNamespace). - DryRun(resources.Objects...) + plan, err := m.plan(bd, resources.DefaultNamespace, resources.Objects...) if err != nil { return nil, err } diff --git a/modules/agent/pkg/deployer/monitor.go b/modules/agent/pkg/deployer/monitor.go index 3ea43713e0..9837addfb3 100644 --- a/modules/agent/pkg/deployer/monitor.go +++ b/modules/agent/pkg/deployer/monitor.go @@ -1,6 +1,7 @@ package deployer import ( + "encoding/json" "sort" fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" @@ -8,6 +9,8 @@ import ( "github.com/rancher/wrangler/pkg/name" "github.com/rancher/wrangler/pkg/summary" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" ) type DeploymentStatus struct { @@ -17,14 +20,38 @@ type DeploymentStatus struct { ModifiedStatus []fleet.ModifiedStatus `json:"modifiedStatus,omitempty"` } -func (m *Manager) getApply(bd *fleet.BundleDeployment, ns string) apply.Apply { +func (m *Manager) plan(bd *fleet.BundleDeployment, ns string, objs ...runtime.Object) (apply.Plan, error) { + a, err := m.getApply(bd, ns) + if err != nil { + return apply.Plan{}, err + } + return a.DryRun(objs...) +} + +func (m *Manager) getApply(bd *fleet.BundleDeployment, ns string) (apply.Apply, error) { + apply := m.apply if ns == "" { ns = m.defaultNamespace } - return m.apply. + + if bd.Spec.Options.Diff != nil { + for _, compare := range bd.Spec.Options.Diff.ComparePatches { + for _, op := range compare.Operations { + // compile each operation by itself so that one failing operation doesn't block the others + patch, err := json.Marshal([]interface{}{op}) + if err != nil { + return nil, err + } + gvk := schema.FromAPIVersionAndKind(compare.APIVersion, compare.Kind) + apply = apply.WithDiffPatch(gvk, compare.Namespace, compare.Name, patch) + } + } + } + + return apply. WithIgnorePreviousApplied(). WithSetID(name.SafeConcatName(m.labelPrefix, bd.Name)). - WithDefaultNamespace(ns) + WithDefaultNamespace(ns), nil } func (m *Manager) MonitorBundle(bd *fleet.BundleDeployment) (DeploymentStatus, error) { @@ -32,11 +59,10 @@ func (m *Manager) MonitorBundle(bd *fleet.BundleDeployment) (DeploymentStatus, e resources, err := m.deployer.Resources(bd.Name, bd.Status.Release) if err != nil { - return status, nil + return status, err } - plan, err := m.getApply(bd, resources.DefaultNamespace). - DryRun(resources.Objects...) + plan, err := m.plan(bd, resources.DefaultNamespace, resources.Objects...) if err != nil { return status, err } diff --git a/modules/agent/pkg/register/register.go b/modules/agent/pkg/register/register.go index b90684f1aa..5afcba3ed3 100644 --- a/modules/agent/pkg/register/register.go +++ b/modules/agent/pkg/register/register.go @@ -93,6 +93,8 @@ func tryRegister(ctx context.Context, namespace, clusterID string, config *rest. return nil, err } + // delete the bootstrap cred + _ = k8s.Core().V1().Secret().Delete(namespace, BootstrapCredName, nil) return &AgentInfo{ ClusterNamespace: string(secret.Data[ClusterNamespace]), ClusterName: string(secret.Data[ClusterName]), diff --git a/modules/cli/apply/apply.go b/modules/cli/apply/apply.go index ff6f3b981d..f5326113dc 100644 --- a/modules/cli/apply/apply.go +++ b/modules/cli/apply/apply.go @@ -71,13 +71,28 @@ func Apply(ctx context.Context, client *client.Getter, name string, baseDirs []s return err } } - if err := Dir(ctx, client, name, baseDir, opts); err == ErrNoResources { - logrus.Warnf("%s: %v", baseDir, err) - continue - } else if err != nil { + err := filepath.Walk(baseDir, func(path string, info os.FileInfo, err error) error { + // always consider the root valid + if baseDir != path { + if !info.IsDir() { + return nil + } + if _, err := os.Stat(filepath.Join(path, "fleet.yaml")); err != nil { + return nil + } + } + if err := Dir(ctx, client, name, path, opts); err == ErrNoResources { + logrus.Warnf("%s: %v", path, err) + return nil + } else if err != nil { + return err + } + foundBundle = true + return nil + }) + if err != nil { return err } - foundBundle = true } } diff --git a/modules/cli/cmds/apply.go b/modules/cli/cmds/apply.go index c374b5a9d2..3d889df79c 100644 --- a/modules/cli/cmds/apply.go +++ b/modules/cli/cmds/apply.go @@ -22,7 +22,6 @@ type Apply struct { BundleInputArgs OutputArgsNoDefault Label map[string]string `usage:"Labels to apply to created bundles" short:"l"` - File string `usage:"Read full bundle contents from file" short:"f"` TargetsFile string `usage:"Addition source of targets and restrictions to be append"` Compress bool `usage:"Force all resources to be compress" short:"c"` ServiceAccount string `usage:"Service account to assign to bundle created" short:"a"` diff --git a/modules/cli/cmds/root.go b/modules/cli/cmds/root.go index cd77e754db..44c9bc6b5e 100644 --- a/modules/cli/cmds/root.go +++ b/modules/cli/cmds/root.go @@ -48,7 +48,8 @@ func (r *Fleet) PersistentPre(cmd *cobra.Command, args []string) error { } type BundleInputArgs struct { - BundleFile string `usage:"Location of the bundle.yaml" short:"b"` + File string `usage:"Location of the fleet.yaml" short:"f"` + BundleFile string `usage:"Location of the raw Bundle resource yaml" short:"b"` } type OutputArgs struct { diff --git a/modules/cli/cmds/test.go b/modules/cli/cmds/test.go index 59d0af7b57..36af9ca344 100644 --- a/modules/cli/cmds/test.go +++ b/modules/cli/cmds/test.go @@ -42,6 +42,7 @@ func (m *Test) Run(cmd *cobra.Command, args []string) error { opts := &match.Options{ Output: os.Stdout, BaseDir: baseDir, + BundleSpec: m.File, BundleFile: m.BundleFile, ClusterGroup: m.Group, ClusterLabels: m.Label, diff --git a/modules/cli/match/match.go b/modules/cli/match/match.go index e712fb3652..078adab9ec 100644 --- a/modules/cli/match/match.go +++ b/modules/cli/match/match.go @@ -6,17 +6,20 @@ import ( "errors" "fmt" "io" + "io/ioutil" "os" + fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/fleet/pkg/bundle" "github.com/rancher/fleet/pkg/helmdeployer" + "github.com/rancher/fleet/pkg/options" "github.com/rancher/wrangler/pkg/yaml" - - "github.com/rancher/fleet/pkg/bundle" ) type Options struct { Output io.Writer BaseDir string + BundleSpec string BundleFile string ClusterGroup string ClusterLabels map[string]string @@ -29,22 +32,44 @@ func Match(ctx context.Context, opts *Options) error { opts = &Options{} } - bundle, err := bundle.Open(ctx, "test", opts.BaseDir, opts.BundleFile, nil) - if err != nil { - return err + var ( + b *bundle.Bundle + err error + ) + + if opts.BundleFile == "" { + b, err = bundle.Open(ctx, "test", opts.BaseDir, opts.BundleSpec, nil) + if err != nil { + return err + } + } else { + data, err := ioutil.ReadFile(opts.BundleFile) + if err != nil { + return err + } + + bundleConfig := &fleet.Bundle{} + if err := yaml.Unmarshal(data, bundleConfig); err != nil { + return err + } + + b, err = bundle.New(bundleConfig) + if err != nil { + return err + } } if opts.Target == "" { - m := bundle.Match(map[string]map[string]string{ + m := b.Match(map[string]map[string]string{ opts.ClusterGroup: opts.ClusterGroupLabels, }, opts.ClusterLabels) - return printMatch(m, opts.Output) + return printMatch(b, m, opts.Output) } - return printMatch(bundle.MatchForTarget(opts.Target), opts.Output) + return printMatch(b, b.MatchForTarget(opts.Target), opts.Output) } -func printMatch(m *bundle.Match, output io.Writer) error { +func printMatch(bundle *bundle.Bundle, m *bundle.Match, output io.Writer) error { if m == nil { return errors.New("no match found") } @@ -53,12 +78,17 @@ func printMatch(m *bundle.Match, output io.Writer) error { return nil } + opts, err := options.Calculate(&bundle.Definition.Spec, m.Target) + if err != nil { + return err + } + manifest, err := m.Manifest() if err != nil { return err } - objs, err := helmdeployer.Template(m.Bundle.Definition.Name, manifest, m.Target.BundleDeploymentOptions) + objs, err := helmdeployer.Template(m.Bundle.Definition.Name, manifest, opts) if err != nil { return err } diff --git a/pkg/agent/manifest.go b/pkg/agent/manifest.go index e405d53f46..4a19be41b2 100644 --- a/pkg/agent/manifest.go +++ b/pkg/agent/manifest.go @@ -33,12 +33,28 @@ func Manifest(namespace, image, pullPolicy, generation string) []runtime.Object Name: "GENERATION", Value: generation, }) - - objs := []runtime.Object{ - dep, - sa, + dep.Spec.Template.Spec.Affinity = &corev1.Affinity{ + NodeAffinity: &corev1.NodeAffinity{ + PreferredDuringSchedulingIgnoredDuringExecution: []corev1.PreferredSchedulingTerm{ + { + Weight: 1, + Preference: corev1.NodeSelectorTerm{ + MatchExpressions: []corev1.NodeSelectorRequirement{ + { + Key: "fleet.cattle.io/agent", + Operator: corev1.NodeSelectorOpIn, + Values: []string{"true"}, + }, + }, + }, + }, + }, + }, } + + var objs []runtime.Object objs = append(objs, clusterRole...) + objs = append(objs, sa, dep) return objs } diff --git a/pkg/apis/fleet.cattle.io/v1alpha1/bundle.go b/pkg/apis/fleet.cattle.io/v1alpha1/bundle.go index 8edd6d7288..825f3a53a7 100644 --- a/pkg/apis/fleet.cattle.io/v1alpha1/bundle.go +++ b/pkg/apis/fleet.cattle.io/v1alpha1/bundle.go @@ -61,7 +61,6 @@ type BundleSpec struct { Paused bool `json:"paused,omitempty"` RolloutStrategy *RolloutStrategy `json:"rolloutStrategy,omitempty"` Resources []BundleResource `json:"resources,omitempty"` - Overlays []BundleOverlay `json:"overlays,omitempty"` Targets []BundleTarget `json:"targets,omitempty"` TargetRestrictions []BundleTargetRestriction `json:"targetRestrictions,omitempty"` } @@ -87,14 +86,6 @@ type Partition struct { ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"` } -type BundleOverlay struct { - BundleDeploymentOptions - - Name string `json:"name,omitempty"` - Overlays []string `json:"overlays,omitempty"` - Resources []BundleResource `json:"resources,omitempty"` -} - type BundleTargetRestriction struct { Name string `json:"name,omitempty"` ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` @@ -108,7 +99,6 @@ type BundleTarget struct { ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` ClusterGroup string `json:"clusterGroup,omitempty"` ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"` - Overlays []string `json:"overlays,omitempty"` } type BundleSummary struct { @@ -128,6 +118,7 @@ type NonReadyResource struct { State BundleState `json:"bundleState,omitempty"` Message string `json:"message,omitempty"` ModifiedStatus []ModifiedStatus `json:"modifiedStatus,omitempty"` + NonReadyStatus []NonReadyStatus `json:"nonReadyStatus,omitempty"` } var ( @@ -175,14 +166,50 @@ type BundleDeployment struct { } type BundleDeploymentOptions struct { - DefaultNamespace string `json:"namespace,omitempty"` - KustomizeDir string `json:"kustomizeDir,omitempty"` - TimeoutSeconds int `json:"timeoutSeconds,omitempty"` - Values *GenericMap `json:"values,omitempty"` - ServiceAccount string `json:"serviceAccount,omitempty"` - Force bool `json:"force,omitempty"` - TakeOwnership bool `json:"takeOwnership,omitempty"` - ForceSyncBefore *metav1.Time `json:"forceSyncBefore,omitempty"` + DefaultNamespace string `json:"namespace,omitempty"` + Kustomize *KustomizeOptions `json:"kustomize,omitempty"` + Helm *HelmOptions `json:"helm,omitempty"` + ServiceAccount string `json:"serviceAccount,omitempty"` + ForceSyncBefore *metav1.Time `json:"forceSyncBefore,omitempty"` + YAML *YAMLOptions `json:"yaml,omitempty"` + Diff *DiffOptions `json:"diff,omitempty"` +} + +type DiffOptions struct { + ComparePatches []ComparePatch `json:"comparePatches,omitempty"` +} + +type ComparePatch struct { + Kind string `json:"kind,omitempty"` + APIVersion string `json:"apiVersion,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Operations []Operation `json:"operations,omitempty"` +} + +type Operation struct { + Op string `json:"op,omitempty"` + Path string `json:"path,omitempty"` + Value string `json:"value,omitempty"` +} + +type YAMLOptions struct { + Overlays []string `json:"overlays,omitempty"` +} + +type KustomizeOptions struct { + Dir string `json:"dir,omitempty"` +} + +type HelmOptions struct { + Chart string `json:"chart,omitempty"` + Repo string `json:"repo,omitempty"` + ReleaseName string `json:"releaseName,omitempty"` + Version string `json:"version,omitempty"` + TimeoutSeconds int `json:"timeoutSeconds,omitempty"` + Values *GenericMap `json:"values,omitempty"` + Force bool `json:"force,omitempty"` + TakeOwnership bool `json:"takeOwnership,omitempty"` } type BundleDeploymentSpec struct { diff --git a/pkg/apis/fleet.cattle.io/v1alpha1/git.go b/pkg/apis/fleet.cattle.io/v1alpha1/git.go index 20544aca36..c78bf2f34f 100644 --- a/pkg/apis/fleet.cattle.io/v1alpha1/git.go +++ b/pkg/apis/fleet.cattle.io/v1alpha1/git.go @@ -30,10 +30,10 @@ type GitRepoSpec struct { // It is expected the secret be of type "kubernetes.io/basic-auth" or "kubernetes.io/ssh-auth". ClientSecretName string `json:"clientSecretName,omitempty"` - // BundleDirs is the directories relative to the git repo root that contain bundles to be applied. - // Path globbing is support, for example ["bundles/*"] will match all folders as a subdirectory of bundles/ + // Paths is the directories relative to the git repo root that contain resources to be applied. + // Path globbing is support, for example ["charts/*"] will match all folders as a subdirectory of charts/ // If empty, "/" is the default - BundleDirs []string `json:"bundleDirs,omitempty"` + Paths []string `json:"paths,omitempty"` // ServiceAccount used in the downstream cluster for deployment ServiceAccount string `json:"serviceAccount,omitempty"` @@ -46,6 +46,9 @@ type GitRepoSpec struct { // All non-ready deployments before this time will be resynced ForceSyncBefore *metav1.Time `json:"forceSyncBefore,omitempty"` + + // ForceUpdate is a timestamp if set to Now() will cause the git repo to be checked again + ForceUpdate *metav1.Time `json:"forceUpdate,omitempty"` } type GitTarget struct { diff --git a/pkg/apis/fleet.cattle.io/v1alpha1/zz_generated_deepcopy.go b/pkg/apis/fleet.cattle.io/v1alpha1/zz_generated_deepcopy.go index 4255e50296..81be4e73e9 100644 --- a/pkg/apis/fleet.cattle.io/v1alpha1/zz_generated_deepcopy.go +++ b/pkg/apis/fleet.cattle.io/v1alpha1/zz_generated_deepcopy.go @@ -162,14 +162,30 @@ func (in *BundleDeploymentList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundleDeploymentOptions) DeepCopyInto(out *BundleDeploymentOptions) { *out = *in - if in.Values != nil { - in, out := &in.Values, &out.Values - *out = (*in).DeepCopy() + if in.Kustomize != nil { + in, out := &in.Kustomize, &out.Kustomize + *out = new(KustomizeOptions) + **out = **in + } + if in.Helm != nil { + in, out := &in.Helm, &out.Helm + *out = new(HelmOptions) + (*in).DeepCopyInto(*out) } if in.ForceSyncBefore != nil { in, out := &in.ForceSyncBefore, &out.ForceSyncBefore *out = (*in).DeepCopy() } + if in.YAML != nil { + in, out := &in.YAML, &out.YAML + *out = new(YAMLOptions) + (*in).DeepCopyInto(*out) + } + if in.Diff != nil { + in, out := &in.Diff, &out.Diff + *out = new(DiffOptions) + (*in).DeepCopyInto(*out) + } return } @@ -357,33 +373,6 @@ func (in *BundleNamespaceMappingList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BundleOverlay) DeepCopyInto(out *BundleOverlay) { - *out = *in - in.BundleDeploymentOptions.DeepCopyInto(&out.BundleDeploymentOptions) - if in.Overlays != nil { - in, out := &in.Overlays, &out.Overlays - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = make([]BundleResource, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BundleOverlay. -func (in *BundleOverlay) DeepCopy() *BundleOverlay { - if in == nil { - return nil - } - out := new(BundleOverlay) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BundleResource) DeepCopyInto(out *BundleResource) { *out = *in @@ -414,13 +403,6 @@ func (in *BundleSpec) DeepCopyInto(out *BundleSpec) { *out = make([]BundleResource, len(*in)) copy(*out, *in) } - if in.Overlays != nil { - in, out := &in.Overlays, &out.Overlays - *out = make([]BundleOverlay, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } if in.Targets != nil { in, out := &in.Targets, &out.Targets *out = make([]BundleTarget, len(*in)) @@ -515,11 +497,6 @@ func (in *BundleTarget) DeepCopyInto(out *BundleTarget) { *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } - if in.Overlays != nil { - in, out := &in.Overlays, &out.Overlays - *out = make([]string, len(*in)) - copy(*out, *in) - } return } @@ -1004,6 +981,27 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ComparePatch) DeepCopyInto(out *ComparePatch) { + *out = *in + if in.Operations != nil { + in, out := &in.Operations, &out.Operations + *out = make([]Operation, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComparePatch. +func (in *ComparePatch) DeepCopy() *ComparePatch { + if in == nil { + return nil + } + out := new(ComparePatch) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Content) DeepCopyInto(out *Content) { *out = *in @@ -1068,6 +1066,29 @@ func (in *ContentList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiffOptions) DeepCopyInto(out *DiffOptions) { + *out = *in + if in.ComparePatches != nil { + in, out := &in.ComparePatches, &out.ComparePatches + *out = make([]ComparePatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiffOptions. +func (in *DiffOptions) DeepCopy() *DiffOptions { + if in == nil { + return nil + } + out := new(DiffOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericMap. func (in *GenericMap) DeepCopy() *GenericMap { if in == nil { @@ -1232,8 +1253,8 @@ func (in *GitRepoRestrictionList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitRepoSpec) DeepCopyInto(out *GitRepoSpec) { *out = *in - if in.BundleDirs != nil { - in, out := &in.BundleDirs, &out.BundleDirs + if in.Paths != nil { + in, out := &in.Paths, &out.Paths *out = make([]string, len(*in)) copy(*out, *in) } @@ -1253,6 +1274,10 @@ func (in *GitRepoSpec) DeepCopyInto(out *GitRepoSpec) { in, out := &in.ForceSyncBefore, &out.ForceSyncBefore *out = (*in).DeepCopy() } + if in.ForceUpdate != nil { + in, out := &in.ForceUpdate, &out.ForceUpdate + *out = (*in).DeepCopy() + } return } @@ -1315,6 +1340,42 @@ func (in *GitTarget) DeepCopy() *GitTarget { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HelmOptions) DeepCopyInto(out *HelmOptions) { + *out = *in + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmOptions. +func (in *HelmOptions) DeepCopy() *HelmOptions { + if in == nil { + return nil + } + out := new(HelmOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KustomizeOptions) DeepCopyInto(out *KustomizeOptions) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KustomizeOptions. +func (in *KustomizeOptions) DeepCopy() *KustomizeOptions { + if in == nil { + return nil + } + out := new(KustomizeOptions) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ModifiedStatus) DeepCopyInto(out *ModifiedStatus) { *out = *in @@ -1339,6 +1400,13 @@ func (in *NonReadyResource) DeepCopyInto(out *NonReadyResource) { *out = make([]ModifiedStatus, len(*in)) copy(*out, *in) } + if in.NonReadyStatus != nil { + in, out := &in.NonReadyStatus, &out.NonReadyStatus + *out = make([]NonReadyStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -1369,6 +1437,22 @@ func (in *NonReadyStatus) DeepCopy() *NonReadyStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Operation) DeepCopyInto(out *Operation) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Operation. +func (in *Operation) DeepCopy() *Operation { + if in == nil { + return nil + } + out := new(Operation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Partition) DeepCopyInto(out *Partition) { *out = *in @@ -1454,3 +1538,24 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *YAMLOptions) DeepCopyInto(out *YAMLOptions) { + *out = *in + if in.Overlays != nil { + in, out := &in.Overlays, &out.Overlays + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YAMLOptions. +func (in *YAMLOptions) DeepCopy() *YAMLOptions { + if in == nil { + return nil + } + out := new(YAMLOptions) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/bundle/match.go b/pkg/bundle/match.go index 185dd601c8..d070701568 100644 --- a/pkg/bundle/match.go +++ b/pkg/bundle/match.go @@ -1,11 +1,9 @@ package bundle import ( - "github.com/rancher/fleet/pkg/match" - "github.com/rancher/fleet/pkg/render" - fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" manifest "github.com/rancher/fleet/pkg/manifest" + "github.com/rancher/fleet/pkg/match" ) type Match struct { @@ -19,16 +17,11 @@ func (t *Match) Manifest() (*manifest.Manifest, error) { return t.manifest, nil } - manifest, err := manifest.New(&t.Bundle.Definition.Spec, t.Target.Overlays...) + manifest, err := manifest.New(&t.Bundle.Definition.Spec) if err != nil { return nil, err } - // sanity test that patches are same - if err := render.IsValid(t.Bundle.Definition.Name, manifest); err != nil { - return nil, err - } - t.manifest = manifest return manifest, nil } diff --git a/pkg/bundle/read.go b/pkg/bundle/read.go index 32ad16a808..26a7d8b69a 100644 --- a/pkg/bundle/read.go +++ b/pkg/bundle/read.go @@ -9,12 +9,10 @@ import ( "io/ioutil" "os" "path/filepath" - "sort" "time" fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/yaml" ) @@ -41,9 +39,6 @@ func Open(ctx context.Context, name, baseDir, file string, opts *Options) (*Bund if file == "" { file = filepath.Join(baseDir, "fleet.yaml") - if _, err := os.Stat(file); os.IsNotExist(err) { - file = filepath.Join(baseDir, "bundle.yaml") - } if f, err := os.Open(file); os.IsNotExist(err) { in = bytes.NewBufferString("{}") } else if err != nil { @@ -98,6 +93,11 @@ func size(bundle *fleet.Bundle) (int, error) { return len(marshalled), nil } +type localSpec struct { + fleet.BundleSpec + TargetCustomizations []fleet.BundleTarget `json:"targetCustomizations,omitempty"` +} + func read(ctx context.Context, name, baseDir string, bundleSpecReader io.Reader, opts *Options) (*Bundle, error) { if opts == nil { opts = &Options{} @@ -112,10 +112,11 @@ func read(ctx context.Context, name, baseDir string, bundleSpecReader io.Reader, return nil, err } - bundle := &fleet.BundleSpec{} + bundle := &localSpec{} if err := yaml.Unmarshal(bytes, &bundle); err != nil { return nil, err } + bundle.BundleSpec.Targets = append(bundle.BundleSpec.Targets, bundle.TargetCustomizations...) meta, err := readMetadata(bytes) if err != nil { @@ -123,24 +124,18 @@ func read(ctx context.Context, name, baseDir string, bundleSpecReader io.Reader, } meta.Name = name - setTargetNames(bundle) - - overlays, err := readOverlays(ctx, meta, bundle, opts.Compress, baseDir) - if err != nil { - return nil, err - } + setTargetNames(&bundle.BundleSpec) - resources, err := readResources(ctx, meta, opts.Compress, baseDir) + resources, err := readResources(ctx, &bundle.BundleSpec, opts.Compress, baseDir) if err != nil { return nil, err } bundle.Resources = resources - assignOverlay(bundle, overlays) def := &fleet.Bundle{ ObjectMeta: meta.ObjectMeta, - Spec: *bundle, + Spec: bundle.BundleSpec, } for k, v := range opts.Labels { @@ -200,27 +195,6 @@ func appendTargets(def *fleet.Bundle, targetsFile string) (*fleet.Bundle, error) return def, nil } -func assignOverlay(bundle *fleet.BundleSpec, overlays map[string][]fleet.BundleResource) { - defined := map[string]bool{} - for i := range bundle.Overlays { - defined[bundle.Overlays[i].Name] = true - bundle.Overlays[i].Resources = overlays[bundle.Overlays[i].Name] - } - for name, resources := range overlays { - if defined[name] { - continue - } - bundle.Overlays = append(bundle.Overlays, fleet.BundleOverlay{ - Name: name, - Resources: resources, - }) - } - - sort.Slice(bundle.Overlays, func(i, j int) bool { - return bundle.Overlays[i].Name < bundle.Overlays[j].Name - }) -} - func setTargetNames(spec *fleet.BundleSpec) { for i, target := range spec.Targets { if target.Name == "" { @@ -229,26 +203,8 @@ func setTargetNames(spec *fleet.BundleSpec) { } } -func overlays(bundle *fleet.BundleSpec) []string { - overlayNames := sets.String{} - - for _, target := range bundle.Targets { - overlayNames.Insert(target.Overlays...) - } - - for _, overlay := range bundle.Overlays { - overlayNames.Insert(overlay.Overlays...) - } - - return overlayNames.List() -} - type bundleMeta struct { metav1.ObjectMeta `json:",inline,omitempty"` - Manifests string `json:"manifestsDir,omitempty"` - Overlays string `json:"overlaysDir,omitempty"` - Kustomize string `json:"kustomizeDir,omitempty"` - Chart string `json:"chart,omitempty"` } func readMetadata(bytes []byte) (*bundleMeta, error) { diff --git a/pkg/bundle/resources.go b/pkg/bundle/resources.go index b830381963..adc41f209e 100644 --- a/pkg/bundle/resources.go +++ b/pkg/bundle/resources.go @@ -2,7 +2,10 @@ package bundle import ( "context" + "crypto/sha256" + "fmt" "io/ioutil" + "net/http" "net/url" "os" "path/filepath" @@ -11,6 +14,9 @@ import ( "sync" "unicode/utf8" + "helm.sh/helm/v3/pkg/repo" + "sigs.k8s.io/yaml" + "github.com/hashicorp/go-getter" "github.com/pkg/errors" "github.com/rancher/fleet/modules/cli/pkg/progress" @@ -20,92 +26,121 @@ import ( "golang.org/x/sync/semaphore" ) -const ( - ManifestsDir = "manifests" - ChartDir = "chart" - KustomizeDir = "kustomize" - Overlays = "overlays" -) - -func readOverlays(ctx context.Context, meta *bundleMeta, bundle *fleet.BundleSpec, compress bool, base string) (map[string][]fleet.BundleResource, error) { +func readResources(ctx context.Context, spec *fleet.BundleSpec, compress bool, base string) ([]fleet.BundleResource, error) { var directories []directory - overlayDir := meta.Overlays - if overlayDir == "" { - overlayDir = Overlays + directories, err := addDirectory(directories, base, ".", ".") + if err != nil { + return nil, err } - for _, overlay := range overlays(bundle) { - directories = append(directories, directory{ - base: base, - path: filepath.Join(overlayDir, overlay), - key: overlay, - }) - } + var chartDirs []*fleet.HelmOptions - return readDirectories(ctx, compress, directories...) -} + if spec.Helm != nil && spec.Helm.Chart != "" { + chartDirs = append(chartDirs, spec.Helm) + } -func readResources(ctx context.Context, meta *bundleMeta, compress bool, base string) ([]fleet.BundleResource, error) { - var directories []directory + for _, target := range spec.Targets { + if target.Helm != nil && target.Helm.Chart != "" { + chartDirs = append(chartDirs, spec.Helm) + } + } - directories, err := addDirectory(directories, base, meta.Manifests, ManifestsDir) + directories, err = addCharts(directories, base, chartDirs) if err != nil { return nil, err } - directories, err = addDirectory(directories, base, meta.Chart, ChartDir) + resources, err := readDirectories(ctx, compress, directories...) if err != nil { return nil, err } - directories, err = addDirectory(directories, base, meta.Kustomize, KustomizeDir) + var result []fleet.BundleResource + for _, resources := range resources { + result = append(result, resources...) + } + + sort.Slice(result, func(i, j int) bool { + return result[i].Name < result[j].Name + }) + + return result, nil +} + +func ChartPath(helm *fleet.HelmOptions) string { + if helm == nil { + return "none" + } + return fmt.Sprintf(".chart/%x", sha256.Sum256([]byte(helm.Chart + ":" + helm.Repo + ":" + helm.Version)[:])) +} + +func chartURL(location *fleet.HelmOptions) (string, error) { + if location.Repo == "" { + return location.Chart, nil + } + + resp, err := http.Get(location.Repo + "/index.yaml") if err != nil { - return nil, err + return "", err } + defer resp.Body.Close() - resources, err := readDirectories(ctx, compress, directories...) + bytes, err := ioutil.ReadAll(resp.Body) if err != nil { - return nil, err + return "", err } - result := stripChartPrefix(resources[ChartDir]) - result = append(result, resources[ManifestsDir]...) - result = append(result, resources[KustomizeDir]...) - return result, nil -} + repo := &repo.IndexFile{} + if err := yaml.Unmarshal(bytes, repo); err != nil { + return "", err + } -func stripChartPrefix(resources []fleet.BundleResource) []fleet.BundleResource { - chart := "" - for _, resource := range resources { - if strings.HasSuffix(resource.Name, "Chart.yaml") { - if chart == "" || len(resource.Name) < len(chart) { - chart = resource.Name - } - } + repo.SortEntries() + + chart, err := repo.Get(location.Chart, location.Version) + if err != nil { + return "", err } - if chart == "" || chart == filepath.Join(ChartDir, "Chart.yaml") { - return resources + if len(chart.URLs) == 0 { + return "", fmt.Errorf("no URLs found for chart %s %s at %s", chart.Name, chart.Version, location.Repo) } - var ( - newResources []fleet.BundleResource - prefix = strings.TrimSuffix(chart, "Chart.yaml") - ) + chartURL, err := url.Parse(chart.URLs[0]) + if err != nil { + return "", err + } - for _, resource := range resources { - if !strings.HasPrefix(resource.Name, prefix) { - return resources - } - newResources = append(newResources, fleet.BundleResource{ - Name: filepath.Join(ChartDir, strings.TrimPrefix(resource.Name, prefix)), - Content: resource.Content, - Encoding: resource.Encoding, - }) + if chartURL.IsAbs() { + return chart.URLs[0], nil } - return newResources + repoURL, err := url.Parse(location.Repo) + if err != nil { + return "", err + } + + return repoURL.ResolveReference(chartURL).String(), nil +} + +func addCharts(directories []directory, base string, charts []*fleet.HelmOptions) ([]directory, error) { + for _, chart := range charts { + if _, err := os.Stat(filepath.Join(base, chart.Chart)); os.IsNotExist(err) || chart.Repo != "" { + chartURL, err := chartURL(chart) + if err != nil { + return nil, err + } + + directories = append(directories, directory{ + prefix: ChartPath(chart), + base: base, + path: chartURL, + key: ChartPath(chart), + }) + } + } + return directories, nil } func addDirectory(directories []directory, base, customDir, defaultDir string) ([]directory, error) { @@ -202,10 +237,6 @@ func readDirectory(ctx context.Context, progress *progress.Progress, compress bo } } - sort.Slice(resources, func(i, j int) bool { - return resources[i].Name < resources[j].Name - }) - return resources, nil } @@ -223,21 +254,17 @@ func readContent(ctx context.Context, progress *progress.Progress, base, name st return nil, err } - u, uerr := url.Parse(name) c := getter.Client{ - Ctx: ctx, - Src: name, - Dst: temp, - Pwd: base, - Mode: getter.ClientModeDir, - ProgressListener: progress, + Ctx: ctx, + Src: name, + Dst: temp, + Pwd: base, + Mode: getter.ClientModeDir, + // TODO: why doesn't this work anymore + //ProgressListener: progress, } if err := c.Get(); err != nil { - // ignore file paths that don't exist - if uerr == nil && u.Scheme == "" { - return nil, nil - } return nil, err } diff --git a/pkg/bundle/style.go b/pkg/bundle/style.go new file mode 100644 index 0000000000..25c0c1bd5c --- /dev/null +++ b/pkg/bundle/style.go @@ -0,0 +1,89 @@ +package bundle + +import ( + "path/filepath" + "strings" + + fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/fleet/pkg/manifest" +) + +const ( + chartYAML = "Chart.yaml" +) + +func joinAndClean(path, file string) string { + return strings.TrimPrefix(filepath.Join(path, file), "/") +} + +func chartPath(options fleet.BundleDeploymentOptions) (string, string) { + if options.Helm == nil || options.Helm.Chart == "" { + return chartYAML, "" + } + return joinAndClean(options.Helm.Chart, chartYAML), ChartPath(options.Helm) + "/" +} + +func kustomizePath(options fleet.BundleDeploymentOptions) string { + if options.Kustomize == nil || options.Kustomize.Dir == "" { + return "kustomization.yaml" + } + return joinAndClean(options.Kustomize.Dir, "kustomization.yaml") +} + +type Style struct { + ChartPath string + KustomizePath string + HasChartYAML bool + Options fleet.BundleDeploymentOptions +} + +func (s Style) IsHelm() bool { + return s.HasChartYAML +} + +func (s Style) IsKustomize() bool { + return s.KustomizePath != "" +} + +func (s Style) IsRawYAML() bool { + return !s.IsHelm() && !s.IsKustomize() +} + +func matchesExternalChartYAML(externalChartPath string, path string) bool { + if externalChartPath == "" { + return false + } + if !strings.HasPrefix(path, externalChartPath) { + return false + } + parts := strings.Split(strings.TrimPrefix(path, externalChartPath), "/") + return (len(parts) == 1 && parts[0] == chartYAML) || + (len(parts) == 2 && parts[1] == chartYAML) +} + +func DetermineStyle(m *manifest.Manifest, options fleet.BundleDeploymentOptions) Style { + var ( + chartPath, externalChartPath = chartPath(options) + kustomizePath = kustomizePath(options) + result = Style{ + Options: options, + } + ) + + for _, resource := range m.Resources { + switch { + case resource.Name == "": + // ignore + case resource.Name == chartPath: + result.ChartPath = chartPath + result.HasChartYAML = true + case matchesExternalChartYAML(externalChartPath, resource.Name): + result.ChartPath = resource.Name + result.HasChartYAML = true + case resource.Name == kustomizePath: + result.KustomizePath = kustomizePath + } + } + + return result +} diff --git a/pkg/config/config.go b/pkg/config/config.go index b8d5bb508f..108aaf8c52 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -49,7 +49,7 @@ type Bootstrap struct { Namespace string `json:"namespace,omitempty"` Repo string `json:"repo,omitempty"` Secret string `json:"secret,omitempty"` - Dirs string `json:"dirs,omitempty"` + Paths string `json:"paths,omitempty"` Branch string `json:"branch,omitempty"` } diff --git a/pkg/controllers/bootstrap/bootstrap.go b/pkg/controllers/bootstrap/bootstrap.go index 17f4f86bee..6d72f54c0e 100644 --- a/pkg/controllers/bootstrap/bootstrap.go +++ b/pkg/controllers/bootstrap/bootstrap.go @@ -96,6 +96,10 @@ func (h *handler) OnConfig(config *config.Config) error { }) if config.Bootstrap.Repo != "" { + var paths []string + if len(config.Bootstrap.Paths) > 0 { + paths = splitter.Split(config.Bootstrap.Paths, -1) + } objs = append(objs, &fleet.GitRepo{ ObjectMeta: metav1.ObjectMeta{ Name: "bootstrap", @@ -105,7 +109,7 @@ func (h *handler) OnConfig(config *config.Config) error { Repo: config.Bootstrap.Repo, Branch: config.Bootstrap.Branch, ClientSecretName: config.Bootstrap.Secret, - BundleDirs: splitter.Split(config.Bootstrap.Dirs, -1), + Paths: paths, }, }) } diff --git a/pkg/controllers/cluster/controller.go b/pkg/controllers/cluster/controller.go index ffbfd079a3..0d5dc2ae4d 100644 --- a/pkg/controllers/cluster/controller.go +++ b/pkg/controllers/cluster/controller.go @@ -95,7 +95,7 @@ func (h *handler) OnClusterChanged(cluster *fleet.Cluster, status fleet.ClusterS for _, app := range bundleDeployments { state := summary.GetDeploymentState(app) - summary.IncrementState(&status.Summary, app.Name, state, summary.MessageFromDeployment(app), app.Status.ModifiedStatus) + summary.IncrementState(&status.Summary, app.Name, state, summary.MessageFromDeployment(app), app.Status.ModifiedStatus, app.Status.NonReadyStatus) status.Summary.DesiredReady++ } diff --git a/pkg/controllers/git/git.go b/pkg/controllers/git/git.go index 472c4aa27c..858cfb84d3 100644 --- a/pkg/controllers/git/git.go +++ b/pkg/controllers/git/git.go @@ -211,9 +211,9 @@ func (h *handler) OnChange(gitrepo *fleet.GitRepo, status fleet.GitRepoStatus) ( return nil, status, err } - dirs := gitrepo.Spec.BundleDirs - if len(dirs) == 0 { - dirs = []string{"."} + paths := gitrepo.Spec.Paths + if len(paths) == 0 { + paths = []string{"."} } gitJob, err := h.gitjobCache.Get(gitrepo.Namespace, gitrepo.Name) @@ -299,6 +299,7 @@ func (h *handler) OnChange(gitrepo *fleet.GitRepo, status fleet.GitRepoStatus) ( }, Spec: gitjob.GitJobSpec{ SyncInterval: syncSeconds, + ForceUpdate: gitrepo.Spec.ForceUpdate, Git: gitjob.GitInfo{ Credential: gitjob.Credential{ ClientSecretName: gitrepo.Spec.ClientSecretName, @@ -342,7 +343,7 @@ func (h *handler) OnChange(gitrepo *fleet.GitRepo, status fleet.GitRepoStatus) ( "--service-account", gitrepo.Spec.ServiceAccount, "--sync-before", syncBefore, gitrepo.Name, - }, dirs...), + }, paths...), WorkingDir: "/workspace/source", VolumeMounts: []corev1.VolumeMount{ { @@ -382,7 +383,7 @@ func (h *handler) setBundleDeploymentStatus(gitrepo *fleet.GitRepo, status fleet var maxState fleet.BundleState for _, app := range bundleDeployments { state := summary.GetDeploymentState(app) - summary.IncrementState(&status.Summary, app.Name, state, summary.MessageFromDeployment(app), app.Status.ModifiedStatus) + summary.IncrementState(&status.Summary, app.Name, state, summary.MessageFromDeployment(app), app.Status.ModifiedStatus, app.Status.NonReadyStatus) status.Summary.DesiredReady++ if fleet.StateRank[state] > fleet.StateRank[maxState] { maxState = state diff --git a/pkg/controllers/manageagent/manageagent.go b/pkg/controllers/manageagent/manageagent.go index 4e1b36da3c..7f1e874ac8 100644 --- a/pkg/controllers/manageagent/manageagent.go +++ b/pkg/controllers/manageagent/manageagent.go @@ -99,10 +99,13 @@ func (h *handler) getAgentBundle(ns string) ([]runtime.Object, error) { Spec: fleet.BundleSpec{ BundleDeploymentOptions: fleet.BundleDeploymentOptions{ DefaultNamespace: h.systemNamespace, - TakeOwnership: true, + Helm: &fleet.HelmOptions{ + TakeOwnership: true, + }, }, Resources: []fleet.BundleResource{ { + Name: "agent.yaml", Content: string(agentYAML), }, }, diff --git a/pkg/helm/helm.go b/pkg/helm/helm.go index 793a9bd7d4..329f553ce9 100644 --- a/pkg/helm/helm.go +++ b/pkg/helm/helm.go @@ -1,40 +1,85 @@ package helm import ( + "path/filepath" "strings" - "github.com/rancher/wrangler/pkg/kv" - fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/fleet/pkg/bundle" "github.com/rancher/fleet/pkg/manifest" + "github.com/rancher/wrangler/pkg/kv" "helm.sh/helm/v3/pkg/chart" "sigs.k8s.io/yaml" ) -func Process(name string, m *manifest.Manifest) (*manifest.Manifest, error) { - newManifest, foundChartYAML := toChart(m) - if !foundChartYAML { +func Process(name string, m *manifest.Manifest, style bundle.Style) (*manifest.Manifest, error) { + newManifest := toChart(m, style) + if !style.HasChartYAML { return addChartYAML(name, m, newManifest) } return newManifest, nil } -func toChart(m *manifest.Manifest) (*manifest.Manifest, bool) { - found := false - newManifest := &manifest.Manifest{} +func move(m *manifest.Manifest, from, to string) (result []fleet.BundleResource) { + if from == "." { + from = "" + } else if from != "" { + from += "/" + } for _, resource := range m.Resources { - if strings.HasPrefix(resource.Name, "manifests/") { - resource.Name = strings.Replace(resource.Name, "manifests/", "chart/templates/", 1) + if strings.HasPrefix(resource.Name, from) { + resource.Name = to + strings.TrimPrefix(resource.Name, from) + result = append(result, resource) } - if !strings.HasPrefix(resource.Name, "chart/") { + } + return result +} + +func manifests(m *manifest.Manifest) (result []fleet.BundleResource) { + var ignorePrefix []string + for _, resource := range m.Resources { + if strings.HasSuffix(resource.Name, "/fleet.yaml") || + strings.HasSuffix(resource.Name, "/Chart.yaml") { + ignorePrefix = append(ignorePrefix, filepath.Dir(resource.Name)+"/") + } + } + +outer: + for _, resource := range m.Resources { + if resource.Name == "fleet.yaml" { + continue + } + if !strings.HasSuffix(resource.Name, ".yaml") && + !strings.HasSuffix(resource.Name, ".json") && + !strings.HasSuffix(resource.Name, ".yml") { continue } - if resource.Name == "chart/Chart.yaml" { - found = true + for _, prefix := range ignorePrefix { + if strings.HasPrefix(resource.Name, prefix) { + continue outer + } } - newManifest.Resources = append(newManifest.Resources, resource) + resource.Name = "chart/templates/" + resource.Name + result = append(result, resource) + } + + return result +} + +func toChart(m *manifest.Manifest, style bundle.Style) *manifest.Manifest { + var ( + resources []fleet.BundleResource + ) + + if style.ChartPath != "" { + resources = move(m, filepath.Dir(style.ChartPath), "chart/") + } else if style.IsRawYAML() { + resources = manifests(m) + } + + return &manifest.Manifest{ + Resources: resources, } - return newManifest, found } func addChartYAML(name string, m, newManifest *manifest.Manifest) (*manifest.Manifest, error) { diff --git a/pkg/helmdeployer/deployer.go b/pkg/helmdeployer/deployer.go index 32b5cd8aec..0fa1daec3c 100644 --- a/pkg/helmdeployer/deployer.go +++ b/pkg/helmdeployer/deployer.go @@ -90,7 +90,7 @@ func (p *postRender) Run(renderedManifests *bytes.Buffer) (modifiedManifests *by data = nil } - newObjs, processed, err := kustomize.Process(p.manifest, data, p.opts.KustomizeDir) + newObjs, processed, err := kustomize.Process(p.manifest, data, p.opts.Kustomize.Dir) if err != nil { return nil, err } @@ -117,7 +117,14 @@ func (p *postRender) Run(renderedManifests *bytes.Buffer) (modifiedManifests *by } func (h *helm) Deploy(bundleID string, manifest *manifest.Manifest, options fleet.BundleDeploymentOptions) (*deployer.Resources, error) { - tar, err := render.ToChart(bundleID, manifest) + if options.Helm == nil { + options.Helm = &fleet.HelmOptions{} + } + if options.Kustomize == nil { + options.Kustomize = &fleet.KustomizeOptions{} + } + + tar, err := render.ToChart(bundleID, manifest, options) if err != nil { return nil, err } @@ -147,38 +154,47 @@ func (h *helm) Deploy(bundleID string, manifest *manifest.Manifest, options flee return releaseToResources(release) } -func (h *helm) mustUninstall(cfg *action.Configuration, bundleID string) (bool, error) { - r, err := cfg.Releases.Last(bundleID) +func (h *helm) mustUninstall(cfg *action.Configuration, releaseName string) (bool, error) { + r, err := cfg.Releases.Last(releaseName) if err != nil { return false, nil } return r.Info.Status == release.StatusUninstalling, err } -func (h *helm) mustInstall(cfg *action.Configuration, bundleID string) (bool, error) { - _, err := cfg.Releases.Deployed(bundleID) +func (h *helm) mustInstall(cfg *action.Configuration, releaseName string) (bool, error) { + _, err := cfg.Releases.Deployed(releaseName) if err != nil && strings.Contains(err.Error(), "has no deployed releases") { return true, nil } return false, err } -func (h *helm) getOpts(options fleet.BundleDeploymentOptions) (map[string]interface{}, time.Duration, string) { +func (h *helm) getOpts(bundleID string, options fleet.BundleDeploymentOptions) (map[string]interface{}, time.Duration, string, string) { + if options.Helm == nil { + options.Helm = &fleet.HelmOptions{} + } + vals := map[string]interface{}{} - if options.Values != nil { - vals = options.Values.Data + if options.Helm.Values != nil { + vals = options.Helm.Values.Data } - timeout := 10 * time.Minute - if options.TimeoutSeconds > 0 { - timeout = time.Second * time.Duration(options.TimeoutSeconds) + var timeout time.Duration + if options.Helm.TimeoutSeconds > 0 { + timeout = time.Second * time.Duration(options.Helm.TimeoutSeconds) } if options.DefaultNamespace == "" { options.DefaultNamespace = h.defaultNamespace } - return vals, timeout, options.DefaultNamespace + releaseName := bundleID + if options.Helm != nil && options.Helm.ReleaseName != "" { + releaseName = options.Helm.ReleaseName + } + + return vals, timeout, options.DefaultNamespace, releaseName } func (h *helm) getCfg(namespace, serviceAccountName string) (action.Configuration, error) { @@ -214,14 +230,14 @@ func (h *helm) getCfg(namespace, serviceAccountName string) (action.Configuratio } func (h *helm) install(bundleID string, manifest *manifest.Manifest, chart *chart.Chart, options fleet.BundleDeploymentOptions, dryRun bool) (*release.Release, error) { - vals, timeout, namespace := h.getOpts(options) + vals, timeout, namespace, releaseName := h.getOpts(bundleID, options) cfg, err := h.getCfg(namespace, options.ServiceAccount) if err != nil { return nil, err } - uninstall, err := h.mustUninstall(&cfg, bundleID) + uninstall, err := h.mustUninstall(&cfg, releaseName) if err != nil { return nil, err } @@ -235,7 +251,7 @@ func (h *helm) install(bundleID string, manifest *manifest.Manifest, chart *char } } - install, err := h.mustInstall(&cfg, bundleID) + install, err := h.mustInstall(&cfg, releaseName) if err != nil { return nil, err } @@ -250,15 +266,17 @@ func (h *helm) install(bundleID string, manifest *manifest.Manifest, chart *char if install { u := action.NewInstall(&cfg) u.ClientOnly = h.template - u.ForceAdopt = options.TakeOwnership + u.ForceAdopt = options.Helm.TakeOwnership u.Replace = true - u.Wait = true - u.ReleaseName = bundleID + u.ReleaseName = releaseName u.CreateNamespace = true u.Namespace = namespace u.Timeout = timeout u.DryRun = dryRun u.PostRenderer = pr + if u.Timeout > 0 { + u.Wait = true + } if !dryRun { logrus.Infof("Helm: Installing %s", bundleID) } @@ -267,19 +285,22 @@ func (h *helm) install(bundleID string, manifest *manifest.Manifest, chart *char u := action.NewUpgrade(&cfg) u.Adopt = true - u.Force = options.Force + u.Force = options.Helm.Force u.Namespace = namespace u.Timeout = timeout u.Atomic = true u.DryRun = dryRun u.PostRenderer = pr + if u.Timeout > 0 { + u.Wait = true + } if !dryRun { logrus.Infof("Helm: Upgrading %s", bundleID) } - return u.Run(bundleID, chart, vals) + return u.Run(releaseName, chart, vals) } -func (h *helm) ListDeployments() ([]string, error) { +func (h *helm) ListDeployments() ([]deployer.DeployedBundle, error) { list := action.NewList(&h.globalCfg) list.All = true releases, err := list.Run() @@ -288,33 +309,39 @@ func (h *helm) ListDeployments() ([]string, error) { } var ( - seen = map[string]bool{} - result []string + result []deployer.DeployedBundle ) for _, release := range releases { d := release.Chart.Metadata.Annotations["fleet.cattle.io/bundle-id"] - if d != "" && !seen[d] { - result = append(result, d) - seen[d] = true + if d == "" { + continue } + result = append(result, deployer.DeployedBundle{ + BundleID: d, + ReleaseName: release.Namespace + "/" + release.Name, + }) } return result, nil } -func (h *helm) Resources(deploymentID, resourcesID string) (*deployer.Resources, error) { +func (h *helm) Resources(bundleID, resourcesID string) (*deployer.Resources, error) { hist := action.NewHistory(&h.globalCfg) - releases, err := hist.Run(deploymentID) - if err != nil { - return nil, err - } - namespace, name := kv.Split(resourcesID, "/") releaseName, versionStr := kv.Split(name, ":") version, _ := strconv.Atoi(versionStr) + if releaseName == "" { + releaseName = bundleID + } + + releases, err := hist.Run(releaseName) + if err != nil { + return nil, err + } + for _, release := range releases { if release.Name == releaseName && release.Version == version && release.Namespace == namespace { return releaseToResources(release) @@ -324,20 +351,57 @@ func (h *helm) Resources(deploymentID, resourcesID string) (*deployer.Resources, return &deployer.Resources{}, nil } -func (h *helm) Delete(bundleID string) error { +func (h *helm) Delete(bundleID, releaseName string) error { + if releaseName != "" { + return h.deleteByRelease(bundleID, releaseName) + } return h.delete(bundleID, fleet.BundleDeploymentOptions{}, false) } +func (h *helm) deleteByRelease(bundleID, releaseName string) error { + releaseNamespace, releaseName := kv.Split(releaseName, "/") + rels, err := h.globalCfg.Releases.List(func(r *release.Release) bool { + return r.Namespace == releaseNamespace && + r.Name == releaseName && + r.Chart.Metadata.Annotations[BundleIDAnnotation] == bundleID + }) + if err != nil { + return nil + } + if len(rels) == 0 { + return nil + } + + var ( + serviceAccountName string + ) + for _, rel := range rels { + serviceAccountName = rel.Chart.Metadata.Annotations[ServiceAccountNameAnnotation] + if serviceAccountName != "" { + break + } + } + + cfg, err := h.getCfg(releaseNamespace, serviceAccountName) + if err != nil { + return err + } + + u := action.NewUninstall(&cfg) + _, err = u.Run(releaseName) + return err +} + func (h *helm) delete(bundleID string, options fleet.BundleDeploymentOptions, dryRun bool) error { - _, timeout, _ := h.getOpts(options) + _, timeout, _, releaseName := h.getOpts(bundleID, options) - r, err := h.globalCfg.Releases.Last(bundleID) + r, err := h.globalCfg.Releases.Last(releaseName) if err != nil { return nil } if r.Chart.Metadata.Annotations[BundleIDAnnotation] != bundleID { - rels, err := h.globalCfg.Releases.History(bundleID) + rels, err := h.globalCfg.Releases.History(releaseName) if err != nil { return nil } @@ -371,7 +435,7 @@ func (h *helm) delete(bundleID string, options fleet.BundleDeploymentOptions, dr if !dryRun { logrus.Infof("Helm: Uninstalling %s", bundleID) } - _, err = u.Run(bundleID) + _, err = u.Run(releaseName) return err } diff --git a/pkg/kustomize/kustomize.go b/pkg/kustomize/kustomize.go index 9527ced52c..adb79a0ff6 100644 --- a/pkg/kustomize/kustomize.go +++ b/pkg/kustomize/kustomize.go @@ -2,7 +2,6 @@ package kustomize import ( "path/filepath" - "strings" "github.com/rancher/fleet/pkg/content" "github.com/rancher/fleet/pkg/manifest" @@ -19,7 +18,7 @@ import ( const ( KustomizeYAML = "kustomization.yaml" - ManifestsYAML = "manifests.yaml" + ManifestsYAML = "fleet-manifests.yaml" ) func Process(m *manifest.Manifest, content []byte, dir string) ([]runtime.Object, bool, error) { @@ -64,7 +63,7 @@ func modifyKustomize(f filesys.FileSystem, dir string) error { return nil } - data["resources"] = append(resources, ManifestsYAML) + data["resources"] = append([]string{ManifestsYAML}, resources...) fileBytes, err = yaml.Marshal(data) if err != nil { return err @@ -76,15 +75,14 @@ func modifyKustomize(f filesys.FileSystem, dir string) error { func toFilesystem(m *manifest.Manifest, dir string, manifestsContent []byte) (filesys.FileSystem, error) { f := filesys.MakeEmptyDirInMemory() for _, resource := range m.Resources { - if !strings.HasPrefix(resource.Name, "kustomize/") { + if resource.Name == "" { continue } - name := strings.TrimPrefix(resource.Name, "kustomize/") data, err := content.Decode(resource.Content, resource.Encoding) if err != nil { return nil, err } - if _, err := f.AddFile(name, data); err != nil { + if _, err := f.AddFile(resource.Name, data); err != nil { return nil, err } } diff --git a/pkg/manifest/manifest.go b/pkg/manifest/manifest.go index a89257e562..853214a1b9 100644 --- a/pkg/manifest/manifest.go +++ b/pkg/manifest/manifest.go @@ -7,10 +7,7 @@ import ( "encoding/json" "io" - "github.com/rancher/fleet/pkg/overlay" - fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" - "github.com/rancher/wrangler/pkg/seen" ) type Manifest struct { @@ -19,13 +16,9 @@ type Manifest struct { digest string } -func New(spec *fleet.BundleSpec, overlays ...string) (*Manifest, error) { - resources, err := collectResources(spec, overlays...) - if err != nil { - return nil, err - } +func New(spec *fleet.BundleSpec) (*Manifest, error) { m := &Manifest{ - Resources: resources, + Resources: spec.Resources, } return m, nil } @@ -67,32 +60,3 @@ func (m *Manifest) Encode(writer io.Writer) error { func toSHA256ID(digest []byte) string { return ("s-" + hex.EncodeToString(digest))[:63] } - -func addResource(result []fleet.BundleResource, seen seen.Seen, resources ...fleet.BundleResource) []fleet.BundleResource { - for _, resource := range resources { - if resource.Name != "" && seen.String(resource.Name) { - continue - } - result = append(result, resource) - } - return result -} - -func collectResources(spec *fleet.BundleSpec, overlays ...string) ([]fleet.BundleResource, error) { - var ( - seenResources = seen.New() - result []fleet.BundleResource - ) - - allOverlays, overlaySet, err := overlay.Resolve(spec, overlays...) - if err != nil { - return nil, err - } - - for i := len(overlaySet) - 1; i >= 0; i-- { - overlay := allOverlays[overlaySet[i]] - result = addResource(result, seenResources, overlay.Resources...) - } - - return addResource(result, seenResources, spec.Resources...), nil -} diff --git a/pkg/manifest/output.go b/pkg/manifest/output.go index 2f3d0e4302..5c8f19e2e2 100644 --- a/pkg/manifest/output.go +++ b/pkg/manifest/output.go @@ -4,10 +4,13 @@ import ( "archive/tar" "bytes" "compress/gzip" + "fmt" "io" "time" "github.com/rancher/fleet/pkg/content" + "go.mozilla.org/sops/v3" + "go.mozilla.org/sops/v3/decrypt" ) func (m *Manifest) ToTarGZ() (io.Reader, error) { @@ -20,6 +23,12 @@ func (m *Manifest) ToTarGZ() (io.Reader, error) { if err != nil { return nil, err } + + bytes, err = decryptSOPS(bytes) + if err != nil { + return nil, err + } + if err := w.WriteHeader(&tar.Header{ Name: resource.Name, Mode: 0644, @@ -41,3 +50,17 @@ func (m *Manifest) ToTarGZ() (io.Reader, error) { return buf, gz.Close() } + +func decryptSOPS(data []byte) ([]byte, error) { + if !bytes.Contains(data, []byte("sops:")) { + return data, nil + } + + clearText, err := decrypt.Data(data, "yaml") + if err == sops.MetadataNotFound { + return data, nil + } else if err != nil { + return data, fmt.Errorf("failed to decrypt with sops: %w", err) + } + return clearText, nil +} diff --git a/pkg/options/calculate.go b/pkg/options/calculate.go index fef345683c..50940ee0f3 100644 --- a/pkg/options/calculate.go +++ b/pkg/options/calculate.go @@ -7,7 +7,6 @@ import ( fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" "github.com/rancher/fleet/pkg/manifest" - "github.com/rancher/fleet/pkg/overlay" "github.com/rancher/wrangler/pkg/data" ) @@ -27,16 +26,6 @@ func DeploymentID(manifest *manifest.Manifest, opts fleet.BundleDeploymentOption func Calculate(spec *fleet.BundleSpec, target *fleet.BundleTarget) (fleet.BundleDeploymentOptions, error) { result := spec.BundleDeploymentOptions - - allOverlays, overlays, err := overlay.Resolve(spec, target.Overlays...) - if err != nil { - return result, err - } - - for _, overlay := range overlays { - result = merge(result, allOverlays[overlay].BundleDeploymentOptions) - } - return merge(result, target.BundleDeploymentOptions), nil } @@ -56,23 +45,51 @@ func merge(base, next fleet.BundleDeploymentOptions) fleet.BundleDeploymentOptio } else if next.ServiceAccount == "-" { base.ServiceAccount = "" } - if next.TimeoutSeconds > 0 { - base.TimeoutSeconds = next.TimeoutSeconds - } else if next.TimeoutSeconds < 0 { - base.TimeoutSeconds = 0 + if next.Helm != nil { + if base.Helm == nil { + base.Helm = &fleet.HelmOptions{} + } + if next.Helm.TimeoutSeconds > 0 { + base.Helm.TimeoutSeconds = next.Helm.TimeoutSeconds + } else if next.Helm.TimeoutSeconds < 0 { + base.Helm.TimeoutSeconds = 0 + } + if base.Helm.Values == nil { + base.Helm.Values = next.Helm.Values + } else if next.Helm.Values != nil { + base.Helm.Values.Data = data.MergeMaps(base.Helm.Values.Data, next.Helm.Values.Data) + } + if next.Helm.Chart != "" { + base.Helm.Chart = next.Helm.Chart + } + if next.Helm.ReleaseName != "" { + base.Helm.ReleaseName = next.Helm.ReleaseName + } + base.Helm.Force = base.Helm.Force || next.Helm.Force + base.Helm.TakeOwnership = base.Helm.TakeOwnership || next.Helm.TakeOwnership + } + if next.Kustomize != nil { + if base.Kustomize == nil { + base.Kustomize = &fleet.KustomizeOptions{} + } + if next.Kustomize.Dir != "" { + base.Kustomize.Dir = next.Kustomize.Dir + } } - if base.Values == nil { - base.Values = next.Values - } else if next.Values != nil { - base.Values.Data = data.MergeMaps(base.Values.Data, next.Values.Data) + if next.Diff != nil { + if base.Diff == nil { + base.Diff = &fleet.DiffOptions{} + } + base.Diff.ComparePatches = append(base.Diff.ComparePatches, next.Diff.ComparePatches...) } - if next.KustomizeDir != "" { - base.KustomizeDir = next.KustomizeDir + if next.YAML != nil { + if base.YAML == nil { + base.YAML = &fleet.YAMLOptions{} + } + base.YAML.Overlays = append(base.YAML.Overlays, next.YAML.Overlays...) } if next.ForceSyncBefore != nil { base.ForceSyncBefore = next.ForceSyncBefore } - base.Force = base.Force || next.Force - base.TakeOwnership = base.TakeOwnership || next.TakeOwnership return base } diff --git a/pkg/overlay/overlay.go b/pkg/overlay/overlay.go deleted file mode 100644 index 4d00643d5a..0000000000 --- a/pkg/overlay/overlay.go +++ /dev/null @@ -1,38 +0,0 @@ -package overlay - -import ( - "fmt" - - fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" - "github.com/rancher/wrangler/pkg/seen" -) - -func Resolve(spec *fleet.BundleSpec, overlays ...string) (map[string]fleet.BundleOverlay, []string, error) { - allOverlays := map[string]fleet.BundleOverlay{} - for _, overlay := range spec.Overlays { - allOverlays[overlay.Name] = overlay - } - overlaySet := traverse(allOverlays, seen.New(), overlays...) - for i := len(overlaySet) - 1; i >= 0; i-- { - _, ok := allOverlays[overlaySet[i]] - if !ok { - return nil, nil, fmt.Errorf("failed to find referenced overlay %s", overlaySet[i]) - } - } - return allOverlays, overlaySet, nil -} - -func traverse(overlays map[string]fleet.BundleOverlay, seen seen.Seen, targets ...string) []string { - var result []string - - for _, target := range targets { - if seen.String(target) { - continue - } - - result = append(result, target) - result = append(result, traverse(overlays, seen, overlays[target].Overlays...)...) - } - - return result -} diff --git a/pkg/patch/patch.go b/pkg/patch/patch.go index a8fba7fd88..8c0b038bf9 100644 --- a/pkg/patch/patch.go +++ b/pkg/patch/patch.go @@ -7,27 +7,39 @@ import ( "sort" "strings" - "sigs.k8s.io/kustomize/kyaml/yaml" - "github.com/pkg/errors" fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" "github.com/rancher/fleet/pkg/content" "github.com/rancher/fleet/pkg/manifest" "github.com/rancher/wrangler/pkg/patch" + "sigs.k8s.io/kustomize/kyaml/yaml" +) + +var ( + overlayPrefix = "overlays/" ) -func Process(m *manifest.Manifest) (*manifest.Manifest, error) { - newContent, err := decodeContext(m) +func Process(m *manifest.Manifest, overlays []string) (*manifest.Manifest, error) { + newManifest := &manifest.Manifest{} + for i, resource := range m.Resources { + if resource.Name == "" { + resource.Name = fmt.Sprintf("manifests/file%03d.yaml", i) + } + newManifest.Resources = append(newManifest.Resources, resource) + } + m = newManifest + + m, err := patchContext(m, overlays) if err != nil { return nil, err } - newManifest := &manifest.Manifest{} - for name, content := range newContent { - newManifest.Resources = append(newManifest.Resources, fleet.BundleResource{ - Name: name, - Content: string(content), - }) + newManifest = &manifest.Manifest{} + for _, resource := range m.Resources { + if strings.HasPrefix(resource.Name, overlayPrefix) { + continue + } + newManifest.Resources = append(newManifest.Resources, resource) } sort.Slice(newManifest.Resources, func(i, j int) bool { @@ -37,28 +49,35 @@ func Process(m *manifest.Manifest) (*manifest.Manifest, error) { return newManifest, nil } -func decodeContext(m *manifest.Manifest) (map[string][]byte, error) { +func patchContext(m *manifest.Manifest, overlays []string) (*manifest.Manifest, error) { result := map[string][]byte{} - for i, resource := range m.Resources { - name := resource.Name - if name == "" { - name = fmt.Sprintf("manifests/file%03d", i) - } + if len(overlays) == 0 { + return m, nil + } + for _, resource := range m.Resources { data, err := content.Decode(resource.Content, resource.Encoding) if err != nil { return nil, err } - result[name] = data + result[resource.Name] = data } - if err := patchContent(result); err != nil { + if err := patchContent(result, overlays); err != nil { return nil, err } - return result, nil + resultManifest := &manifest.Manifest{} + for name, bytes := range result { + resultManifest.Resources = append(resultManifest.Resources, fleet.BundleResource{ + Name: name, + Content: string(bytes), + }) + } + + return resultManifest, nil } func isPatchFile(name string) (string, bool) { @@ -70,34 +89,42 @@ func isPatchFile(name string) (string, bool) { return "", false } -func patchContent(content map[string][]byte) error { - for name, bytes := range content { - target, ok := isPatchFile(name) - if !ok { - continue - } - delete(content, name) - - targetContent, ok := content[target] - if !ok { - return fmt.Errorf("failed to find base file %s to patch", target) - } - - targetContent, err := convertToJSON(targetContent) - if err != nil { - return errors.Wrapf(err, "failed to convert %s to json", target) - } - - bytes, err = convertToJSON(bytes) - if err != nil { - return errors.Wrapf(err, "failed to convert %s to json", name) - } - - newBytes, err := patch.Apply(targetContent, bytes) - if err != nil { - return errors.Wrapf(err, "failed to patch %s", target) +func patchContent(content map[string][]byte, overlays []string) error { + for _, overlay := range overlays { + prefix := overlayPrefix + overlay + "/" + for name, bytes := range content { + if !strings.HasPrefix(name, prefix) { + continue + } + + name := strings.TrimPrefix(name, prefix) + target, ok := isPatchFile(name) + if !ok { + content[name] = bytes + continue + } + + targetContent, ok := content[target] + if !ok { + return fmt.Errorf("failed to find base file %s to patch", target) + } + + targetContent, err := convertToJSON(targetContent) + if err != nil { + return errors.Wrapf(err, "failed to convert %s to json", target) + } + + bytes, err = convertToJSON(bytes) + if err != nil { + return errors.Wrapf(err, "failed to convert %s to json", name) + } + + newBytes, err := patch.Apply(targetContent, bytes) + if err != nil { + return errors.Wrapf(err, "failed to patch %s", target) + } + content[target] = newBytes } - content[target] = newBytes } return nil diff --git a/pkg/render/helm.go b/pkg/render/helm.go index 99beda10bf..14cd5ed0e9 100644 --- a/pkg/render/helm.go +++ b/pkg/render/helm.go @@ -3,29 +3,34 @@ package render import ( "io" + fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/fleet/pkg/bundle" "github.com/rancher/fleet/pkg/helm" "github.com/rancher/fleet/pkg/manifest" "github.com/rancher/fleet/pkg/patch" ) -func IsValid(name string, m *manifest.Manifest) error { - _, err := process(name, m) - return err -} +func ToChart(name string, m *manifest.Manifest, options fleet.BundleDeploymentOptions) (io.Reader, error) { + var ( + style = bundle.DetermineStyle(m, options) + err error + ) -func process(name string, m *manifest.Manifest) (*manifest.Manifest, error) { - m, err := patch.Process(m) - if err != nil { - return nil, err + if style.IsRawYAML() { + var overlays []string + if options.YAML != nil { + overlays = options.YAML.Overlays + } + m, err = patch.Process(m, overlays) + if err != nil { + return nil, err + } } - return helm.Process(name, m) -} - -func ToChart(name string, m *manifest.Manifest) (io.Reader, error) { - m, err := process(name, m) + m, err = helm.Process(name, m, style) if err != nil { return nil, err } + return m.ToTarGZ() } diff --git a/pkg/summary/summary.go b/pkg/summary/summary.go index d7dc428580..7ef702f82c 100644 --- a/pkg/summary/summary.go +++ b/pkg/summary/summary.go @@ -12,7 +12,7 @@ import ( "github.com/rancher/wrangler/pkg/condition" ) -func IncrementState(summary *fleet.BundleSummary, name string, state fleet.BundleState, message string, modified []fleet.ModifiedStatus) { +func IncrementState(summary *fleet.BundleSummary, name string, state fleet.BundleState, message string, modified []fleet.ModifiedStatus, nonReady []fleet.NonReadyStatus) { switch state { case fleet.Modified: summary.Modified++ @@ -36,6 +36,7 @@ func IncrementState(summary *fleet.BundleSummary, name string, state fleet.Bundl State: state, Message: message, ModifiedStatus: modified, + NonReadyStatus: nonReady, }) } } @@ -134,6 +135,12 @@ func ReadyMessage(summary fleet.BundleSummary, referencedKind string) string { } messages = append(messages, m.String()) } + for i, m := range v.NonReadyStatus { + if i > 3 { + break + } + messages = append(messages, m.String()) + } break } } diff --git a/pkg/target/target.go b/pkg/target/target.go index c0d2a14be7..b131da101c 100644 --- a/pkg/target/target.go +++ b/pkg/target/target.go @@ -263,6 +263,11 @@ func (m *Manager) foldInDeployments(app *fleet.Bundle, targets []*Target) error func DeploymentLabelsForNewBundle(app *fleet.Bundle) map[string]string { labels := yaml.CleanAnnotationsForExport(app.Labels) + for k, v := range app.Labels { + if strings.HasPrefix(k, "fleet.cattle.io/") { + labels[k] = v + } + } for k, v := range DeploymentLabelsForSelector(app) { labels[k] = v } @@ -424,6 +429,13 @@ func (t *Target) Modified() []fleet.ModifiedStatus { return t.Deployment.Status.ModifiedStatus } +func (t *Target) NonReady() []fleet.NonReadyStatus { + if t.Deployment == nil { + return nil + } + return t.Deployment.Status.NonReadyStatus +} + func (t *Target) State() fleet.BundleState { switch { case t.Deployment == nil: @@ -441,7 +453,7 @@ func Summary(targets []*Target) fleet.BundleSummary { var bundleSummary fleet.BundleSummary for _, currentTarget := range targets { cluster := currentTarget.Cluster.Namespace + "/" + currentTarget.Cluster.Name - summary.IncrementState(&bundleSummary, cluster, currentTarget.State(), currentTarget.Message(), currentTarget.Modified()) + summary.IncrementState(&bundleSummary, cluster, currentTarget.State(), currentTarget.Message(), currentTarget.Modified(), currentTarget.NonReady()) bundleSummary.DesiredReady++ } return bundleSummary