Skip to content

Commit

Permalink
Merge pull request #55 from ibuildthecloud/master
Browse files Browse the repository at this point in the history
Various updates
  • Loading branch information
ibuildthecloud authored Aug 31, 2020
2 parents 98986ce + b491f15 commit 0def054
Show file tree
Hide file tree
Showing 30 changed files with 777 additions and 94 deletions.
1 change: 1 addition & 0 deletions charts/fleet-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ appVersion: 0.0.0
icon: https://charts.rancher.io/assets/logos/fleet.svg
annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/hidden: "true"
catalog.cattle.io/namespace: fleet-system
catalog.cattle.io/release-name: fleet-agent
6 changes: 3 additions & 3 deletions charts/fleet-agent/templates/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{if ne .Release.Namespace .Values.internal.systemNamespace }}
{{ fail "This chart must be installed in the namespace fleet-system as the release name fleet-agent" }}
{{ fail (printf "This chart must be installed in the namespace %s as the release name fleet-agent" .Values.internal.systemNamespace) }}
{{end}}

{{if ne .Release.Name .Values.internal.managedReleaseName }}
{{ fail "This chart must be installed in the namespace fleet-system as the release name fleet-agent" }}
{{ fail (printf "This chart must be installed in the namespace %s as the release name fleet-agent" .Values.internal.managedReleaseName) }}
{{end}}

{{if not .apiServerURL }}
{{if not .Values.apiServerURL }}
{{ fail "apiServerURL is required to be set, and most likely also apiServerCA" }}
{{end}}
77 changes: 74 additions & 3 deletions charts/fleet-crd/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ spec:
readyClusters:
nullable: true
type: string
state:
nullable: true
type: string
type: object
maxNew:
type: integer
Expand Down Expand Up @@ -589,6 +592,9 @@ spec:
monitored:
nullable: true
type: string
state:
nullable: true
type: string
type: object
modifiedStatus:
items:
Expand Down Expand Up @@ -897,6 +903,9 @@ spec:
readyClusters:
nullable: true
type: string
state:
nullable: true
type: string
type: object
nonReadyClusterCount:
type: integer
Expand Down Expand Up @@ -1056,6 +1065,9 @@ spec:
sampleNode:
nullable: true
type: string
state:
nullable: true
type: string
type: object
namespace:
nullable: true
Expand Down Expand Up @@ -1156,8 +1168,8 @@ spec:
- JSONPath: .status.commit
name: Commit
type: string
- JSONPath: .status.display.readyBundles
name: Bundles-Ready
- JSONPath: .status.display.readyBundleDeployments
name: BundleDeployments-Ready
type: string
- JSONPath: .status.conditions[?(@.type=="Ready")].message
name: Status
Expand Down Expand Up @@ -1297,10 +1309,15 @@ spec:
type: array
display:
properties:
readyBundles:
readyBundleDeployments:
nullable: true
type: string
state:
nullable: true
type: string
type: object
observedGeneration:
type: integer
summary:
properties:
desiredReady:
Expand Down Expand Up @@ -1396,6 +1413,60 @@ spec:
served: true
storage: true

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: gitreporestrictions.fleet.cattle.io
spec:
additionalPrinterColumns:
- JSONPath: .defaultServiceAccount
name: Default-ServiceAccount
type: string
- JSONPath: .allowedServiceAccounts
name: Allowed-ServiceAccounts
type: string
group: fleet.cattle.io
names:
kind: GitRepoRestriction
plural: gitreporestrictions
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
allowedClientSecretNames:
items:
nullable: true
type: string
nullable: true
type: array
allowedRepoPatterns:
items:
nullable: true
type: string
nullable: true
type: array
allowedServiceAccounts:
items:
nullable: true
type: string
nullable: true
type: array
defaultClientSecretName:
nullable: true
type: string
defaultServiceAccount:
nullable: true
type: string
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
Expand Down
19 changes: 19 additions & 0 deletions charts/fleet-crd/templates/gitjobs-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ kind: CustomResourceDefinition
metadata:
name: gitjobs.gitjob.cattle.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.git.repo
name: REPO
type: string
- JSONPath: .spec.git.branch
name: BRANCH
type: string
- JSONPath: .status.commit
name: COMMIT
type: string
- JSONPath: .status.jobStatus
name: JOBSTATUS
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: gitjob.cattle.io
names:
kind: GitJob
Expand All @@ -15,6 +31,9 @@ spec:
properties:
spec:
properties:
forceUpdate:
nullable: true
type: string
git:
properties:
branch:
Expand Down
4 changes: 2 additions & 2 deletions charts/fleet/charts/gitjob/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.1.0
appVersion: 0.1.1
description: Controller that run jobs based on git events
name: gitjob
version: 0.1.0
version: 0.1.1
1 change: 1 addition & 0 deletions charts/fleet/charts/gitjob/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rules:
- 'list'
- 'get'
- 'update'
- 'watch'
- apiGroups:
- "gitjob.cattle.io"
resources:
Expand Down
2 changes: 1 addition & 1 deletion charts/fleet/charts/gitjob/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
image:
repository: rancher/gitjob
tag: v0.1.0
tag: v0.1.1
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

replace (
github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.0.0+incompatible
helm.sh/helm/v3 => github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200811161532-4cb1fb31bcea
helm.sh/helm/v3 => github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200829031744-19e92760f498
)

require (
Expand All @@ -14,7 +14,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/rancher/gitjob v0.1.0
github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0
github.com/rancher/wrangler v0.6.2-0.20200828043115-6943c5e1c9c7
github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224
github.com/rancher/wrangler-cli v0.0.0-20200815040857-81c48cf8ab43
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
Expand All @@ -25,8 +25,8 @@ require (
k8s.io/cli-runtime v0.18.4
k8s.io/client-go v0.18.8
rsc.io/letsencrypt v0.0.3 // indirect
sigs.k8s.io/kustomize/api v0.3.3-0.20200328155553-20184e9835c7
sigs.k8s.io/kustomize/kstatus v0.0.2
sigs.k8s.io/kustomize/kyaml v0.4.0
sigs.k8s.io/cli-utils v0.16.0
sigs.k8s.io/kustomize/api v0.6.0
sigs.k8s.io/kustomize/kyaml v0.7.1
sigs.k8s.io/yaml v1.2.0
)
23 changes: 12 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200811161532-4cb1fb31bcea h1:VjoVFmIcFFhgRnU8HccubxUTB6U3LO7RGOv4USfj5bc=
github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200811161532-4cb1fb31bcea/go.mod h1:cWRDbGk4EiIL0/+jN0GI8T7m96Cps81/ta1kcacl85g=
github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200829031744-19e92760f498 h1:AHg+S2PDyV4qfgPMmE5XQYdj5rtClWpX9JhV6n78uhI=
github.com/ibuildthecloud/helm/v3 v3.1.0-rc.1.0.20200829031744-19e92760f498/go.mod h1:cWRDbGk4EiIL0/+jN0GI8T7m96Cps81/ta1kcacl85g=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down Expand Up @@ -755,6 +755,7 @@ github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
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=
Expand All @@ -764,6 +765,8 @@ github.com/rancher/lasso v0.0.0-20200820172840-0e4cc0ef5cb0/go.mod h1:OhBBBO1pBw
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.20200829053106-7e1dd4260224 h1:NWYSyS1YiWJOB84xq0FcGDY8xQQwrfKoip2BjMSlu1g=
github.com/rancher/wrangler v0.6.2-0.20200829053106-7e1dd4260224/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=
Expand All @@ -786,6 +789,7 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d/go.mod h1:w5+eXa0mYznDkHaMCXA4XYffjlH+cy1oyKbfzJXa2Do=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
Expand Down Expand Up @@ -839,6 +843,7 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand Down Expand Up @@ -915,6 +920,7 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.starlark.net v0.0.0-20190528202925-30ae18b8564f/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg=
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee331t6JAXeK2bcyhLOOc=
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o=
go.uber.org/atomic v0.0.0-20181018215023-8dc6146f7569/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
Expand Down Expand Up @@ -946,7 +952,6 @@ golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down Expand Up @@ -1050,7 +1055,6 @@ golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -1190,7 +1194,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
Expand Down Expand Up @@ -1316,14 +1319,12 @@ sigs.k8s.io/cli-utils v0.16.0/go.mod h1:9Jqm9K2W6ShhCxsEuaz6HSRKKOXigPUx3ZfypGgx
sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/kustomize/api v0.3.3-0.20200328155553-20184e9835c7 h1:2xKoYcF8vUAY7QwVGAoDccTNPRtaMNLL0aCf4Op3Ofs=
sigs.k8s.io/kustomize/api v0.3.3-0.20200328155553-20184e9835c7/go.mod h1:4crE391uVAOFgkmaSgQ9w3CprZ6kwCNoL+Ft8II+C70=
sigs.k8s.io/kustomize/kstatus v0.0.2 h1:7GoHi/Vq7rIAS8AQONlfcdaCpVXY0HqzNhU5us7dToA=
sigs.k8s.io/kustomize/kstatus v0.0.2/go.mod h1:6qUKWLy4+yGExtjbs+fibz2tOBZG7413yx2NHyAzIU0=
sigs.k8s.io/kustomize/kyaml v0.1.1 h1:nGUNYINljZNmlAS8uoobUv/wx/s3Pg8dNxYo+W7uYh0=
sigs.k8s.io/kustomize/kyaml v0.1.1/go.mod h1:/NdPPfrperSCGjm55cwEro1loBVtbtVIXSb7FguK6uk=
sigs.k8s.io/kustomize/api v0.6.0 h1:Gj+MH9uEPh7tBHKCGGwA+fHgg9th55StaU+ZT05+8bY=
sigs.k8s.io/kustomize/api v0.6.0/go.mod h1:M7410E0ULUFQlxRskB//n5G0MPwGvs9HG6K8Sf8gw+M=
sigs.k8s.io/kustomize/kyaml v0.4.0 h1:jMQrJOJmiUz5Y018ki0mXWpEreEXjvad1NRfXTdi9vU=
sigs.k8s.io/kustomize/kyaml v0.4.0/go.mod h1:XJL84E6sOFeNrQ7CADiemc1B0EjIxHo3OhW4o1aJYNw=
sigs.k8s.io/kustomize/kyaml v0.7.1 h1:Ih6SJPvfKYfZaIFWUa2YAyg/0ZSTpA3LFjR/hv7+8ao=
sigs.k8s.io/kustomize/kyaml v0.7.1/go.mod h1:ne3F9JPhW2wrVaLslxBsEe6MQJQ9YK5rUutrdhBWXwI=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca h1:6dsH6AYQWbyZmtttJNe8Gq1cXOeS1BdV3eW37zHilAQ=
sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA=
Expand Down
7 changes: 5 additions & 2 deletions modules/agent/pkg/controllers/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"context"
"time"

"github.com/rancher/fleet/modules/agent/pkg/controllers/cluster"

"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"
"github.com/rancher/fleet/modules/agent/pkg/deployer"
"github.com/rancher/fleet/modules/agent/pkg/trigger"
Expand All @@ -22,6 +21,7 @@ import (
"github.com/rancher/wrangler/pkg/generated/controllers/rbac"
rbaccontrollers "github.com/rancher/wrangler/pkg/generated/controllers/rbac/v1"
"github.com/rancher/wrangler/pkg/leader"
"github.com/rancher/wrangler/pkg/ratelimit"
"github.com/rancher/wrangler/pkg/start"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -175,6 +175,9 @@ func newContext(fleetNamespace, agentNamespace, clusterNamespace, clusterName st
return nil, err
}

client = rest.CopyConfig(client)
client.RateLimiter = ratelimit.None

k8s, err := kubernetes.NewForConfig(client)
if err != nil {
return nil, err
Expand Down
19 changes: 14 additions & 5 deletions modules/agent/pkg/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ func Register(ctx context.Context, namespace, clusterID string, config *rest.Con
}
}

func runRegistration(ctx context.Context, k8s corecontrollers.Interface, namespace, clusterID string) (*corev1.Secret, error) {
secret, err := k8s.Secret().Get(namespace, BootstrapCredName, metav1.GetOptions{})
if err != nil {
return nil, fmt.Errorf("looking up secret %s/%s: %w", namespace, BootstrapCredName, err)
}
return createClusterSecret(ctx, clusterID, k8s, secret)
}

func tryRegister(ctx context.Context, namespace, clusterID string, config *rest.Config) (*AgentInfo, error) {
config = rest.CopyConfig(config)
config.RateLimiter = ratelimit.None
Expand All @@ -67,16 +75,17 @@ func tryRegister(ctx context.Context, namespace, clusterID string, config *rest.

secret, err := k8s.Core().V1().Secret().Get(namespace, CredName, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
secret, err = k8s.Core().V1().Secret().Get(namespace, BootstrapCredName, metav1.GetOptions{})
secret, err = runRegistration(ctx, k8s.Core().V1(), namespace, clusterID)
if err != nil {
return nil, fmt.Errorf("looking up secret %s/%s: %w", namespace, BootstrapCredName, err)
}
secret, err = createClusterSecret(ctx, clusterID, k8s.Core().V1(), secret)
if err != nil {
return nil, err
}
} else if err != nil {
return nil, err
} else if err := testClientConfig(ctx, secret.Data[Kubeconfig]); err != nil {
secret, err = runRegistration(ctx, k8s.Core().V1(), namespace, clusterID)
if err != nil {
return nil, fmt.Errorf("looking up secret %s/%s or %s/%s: %w", namespace, BootstrapCredName, namespace, CredName, err)
}
}

clientConfig, err := clientcmd.NewClientConfigFromBytes(secret.Data[Kubeconfig])
Expand Down
Loading

0 comments on commit 0def054

Please sign in to comment.