Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d94a346a
Commit
d94a346a
authored
May 25, 2019
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to wrangler-api and helm-controller
parent
c0702b04
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
84 deletions
+29
-84
traefik.yaml
manifests/traefik.yaml
+1
-1
types.go
pkg/apis/k3s.cattle.io/v1/types.go
+0
-25
main.go
pkg/codegen/main.go
+0
-43
controller.go
pkg/deploy/controller.go
+2
-1
controller.go
pkg/node/controller.go
+1
-1
controller.go
pkg/rootlessports/controller.go
+1
-1
context.go
pkg/server/context.go
+13
-4
server.go
pkg/server/server.go
+7
-2
controller.go
pkg/servicelb/controller.go
+4
-6
No files found.
manifests/traefik.yaml
View file @
d94a346a
apiVersion
:
k3s
.cattle.io/v1
apiVersion
:
helm
.cattle.io/v1
kind
:
HelmChart
metadata
:
name
:
traefik
...
...
pkg/apis/k3s.cattle.io/v1/types.go
View file @
d94a346a
...
...
@@ -4,7 +4,6 @@ import (
"github.com/rancher/dynamiclistener"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/intstr"
)
// +genclient
...
...
@@ -36,27 +35,3 @@ type AddonSpec struct {
type
AddonStatus
struct
{
GVKs
[]
schema
.
GroupVersionKind
`json:"gvks,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type
HelmChart
struct
{
metav1
.
TypeMeta
`json:",inline"`
metav1
.
ObjectMeta
`json:"metadata,omitempty"`
Spec
HelmChartSpec
`json:"spec,omitempty"`
Status
HelmChartStatus
`json:"status,omitempty"`
}
type
HelmChartSpec
struct
{
TargetNamespace
string
`json:"targetNamespace,omitempty"`
Chart
string
`json:"chart,omitempty"`
Version
string
`json:"version,omitempty"`
Repo
string
`json:"repo,omitempty"`
Set
map
[
string
]
intstr
.
IntOrString
`json:"set,omitempty"`
ValuesContent
string
`json:"valuesContent,omitempty"`
}
type
HelmChartStatus
struct
{
JobName
string
`json:"jobName,omitempty"`
}
pkg/codegen/main.go
View file @
d94a346a
...
...
@@ -8,10 +8,6 @@ import (
controllergen
"github.com/rancher/wrangler/pkg/controller-gen"
"github.com/rancher/wrangler/pkg/controller-gen/args"
"github.com/sirupsen/logrus"
appsv1
"k8s.io/api/apps/v1"
batchv1
"k8s.io/api/batch/v1"
corev1
"k8s.io/api/core/v1"
rbacv1
"k8s.io/api/rbac/v1"
)
var
(
...
...
@@ -94,48 +90,9 @@ func main() {
Types
:
[]
interface
{}{
v1
.
ListenerConfig
{},
v1
.
Addon
{},
v1
.
HelmChart
{},
},
GenerateTypes
:
true
,
},
""
:
{
Types
:
[]
interface
{}{
corev1
.
ServiceAccount
{},
corev1
.
Endpoints
{},
corev1
.
Service
{},
corev1
.
Pod
{},
corev1
.
ConfigMap
{},
corev1
.
Node
{},
},
InformersPackage
:
"k8s.io/client-go/informers"
,
ClientSetPackage
:
"k8s.io/client-go/kubernetes"
,
ListersPackage
:
"k8s.io/client-go/listers"
,
},
"apps"
:
{
Types
:
[]
interface
{}{
appsv1
.
Deployment
{},
appsv1
.
DaemonSet
{},
},
InformersPackage
:
"k8s.io/client-go/informers"
,
ClientSetPackage
:
"k8s.io/client-go/kubernetes"
,
ListersPackage
:
"k8s.io/client-go/listers"
,
},
"batch"
:
{
Types
:
[]
interface
{}{
batchv1
.
Job
{},
},
InformersPackage
:
"k8s.io/client-go/informers"
,
ClientSetPackage
:
"k8s.io/client-go/kubernetes"
,
ListersPackage
:
"k8s.io/client-go/listers"
,
},
"rbac"
:
{
Types
:
[]
interface
{}{
rbacv1
.
ClusterRoleBinding
{},
},
InformersPackage
:
"k8s.io/client-go/informers"
,
ClientSetPackage
:
"k8s.io/client-go/kubernetes"
,
ListersPackage
:
"k8s.io/client-go/listers"
,
},
},
})
}
pkg/deploy/controller.go
View file @
d94a346a
...
...
@@ -31,8 +31,9 @@ const (
startKey
=
"_start_"
)
func
WatchFiles
(
ctx
context
.
Context
,
addons
v1
.
AddonController
,
bases
...
string
)
error
{
func
WatchFiles
(
ctx
context
.
Context
,
a
pply
apply
.
Apply
,
a
ddons
v1
.
AddonController
,
bases
...
string
)
error
{
w
:=
&
watcher
{
apply
:
apply
,
addonCache
:
addons
.
Cache
(),
addons
:
addons
,
bases
:
bases
,
...
...
pkg/node/controller.go
View file @
d94a346a
...
...
@@ -5,7 +5,7 @@ import (
"strings"
"github.com/pkg/errors"
coreclient
"github.com/rancher/
k3s
/pkg/generated/controllers/core/v1"
coreclient
"github.com/rancher/
wrangler-api
/pkg/generated/controllers/core/v1"
"github.com/sirupsen/logrus"
core
"k8s.io/api/core/v1"
)
...
...
pkg/rootlessports/controller.go
View file @
d94a346a
...
...
@@ -4,8 +4,8 @@ import (
"context"
"time"
coreClients
"github.com/rancher/k3s/pkg/generated/controllers/core/v1"
"github.com/rancher/k3s/pkg/rootless"
coreClients
"github.com/rancher/wrangler-api/pkg/generated/controllers/core/v1"
"github.com/rootless-containers/rootlesskit/pkg/api/client"
"github.com/rootless-containers/rootlesskit/pkg/port"
"github.com/sirupsen/logrus"
...
...
pkg/server/context.go
View file @
d94a346a
...
...
@@ -3,9 +3,12 @@ package server
import
(
"context"
"github.com/rancher/k3s/pkg/generated/controllers/apps"
"github.com/rancher/k3s/pkg/generated/controllers/core"
"github.com/rancher/helm-controller/pkg/generated/controllers/helm.cattle.io"
"github.com/rancher/k3s/pkg/generated/controllers/k3s.cattle.io"
"github.com/rancher/wrangler-api/pkg/generated/controllers/apps"
"github.com/rancher/wrangler-api/pkg/generated/controllers/batch"
"github.com/rancher/wrangler-api/pkg/generated/controllers/core"
"github.com/rancher/wrangler-api/pkg/generated/controllers/rbac"
"github.com/rancher/wrangler/pkg/apply"
"github.com/rancher/wrangler/pkg/crd"
"github.com/rancher/wrangler/pkg/start"
...
...
@@ -16,14 +19,17 @@ import (
type
Context
struct
{
K3s
*
k3s
.
Factory
Helm
*
helm
.
Factory
Batch
*
batch
.
Factory
Apps
*
apps
.
Factory
Auth
*
rbac
.
Factory
Core
*
core
.
Factory
K8s
kubernetes
.
Interface
Apply
apply
.
Apply
}
func
(
c
*
Context
)
Start
(
ctx
context
.
Context
)
error
{
return
start
.
All
(
ctx
,
5
,
c
.
K3s
,
c
.
Apps
,
c
.
Core
)
return
start
.
All
(
ctx
,
5
,
c
.
K3s
,
c
.
Helm
,
c
.
Apps
,
c
.
Auth
,
c
.
Batch
,
c
.
Core
)
}
func
newContext
(
ctx
context
.
Context
,
cfg
string
)
(
*
Context
,
error
)
{
...
...
@@ -39,8 +45,11 @@ func newContext(ctx context.Context, cfg string) (*Context, error) {
k8s
:=
kubernetes
.
NewForConfigOrDie
(
restConfig
)
return
&
Context
{
K3s
:
k3s
.
NewFactoryFromConfigOrDie
(
restConfig
),
Helm
:
helm
.
NewFactoryFromConfigOrDie
(
restConfig
),
K8s
:
k8s
,
Auth
:
rbac
.
NewFactoryFromConfigOrDie
(
restConfig
),
Apps
:
apps
.
NewFactoryFromConfigOrDie
(
restConfig
),
Batch
:
batch
.
NewFactoryFromConfigOrDie
(
restConfig
),
Core
:
core
.
NewFactoryFromConfigOrDie
(
restConfig
),
Apply
:
apply
.
New
(
k8s
,
apply
.
NewClientFactory
(
restConfig
)),
},
nil
...
...
@@ -55,7 +64,7 @@ func crds(ctx context.Context, config *rest.Config) error {
factory
.
BatchCreateCRDs
(
ctx
,
crd
.
NamespacedTypes
(
"ListenerConfig.k3s.cattle.io/v1"
,
"Addon.k3s.cattle.io/v1"
,
"HelmChart.
k3s
.cattle.io/v1"
)
...
)
"HelmChart.
helm
.cattle.io/v1"
)
...
)
return
factory
.
BatchWait
()
}
pkg/server/server.go
View file @
d94a346a
...
...
@@ -15,6 +15,7 @@ import (
"github.com/pkg/errors"
"github.com/rancher/dynamiclistener"
"github.com/rancher/helm-controller/pkg/helm"
"github.com/rancher/k3s/pkg/clientaccess"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/daemons/control"
...
...
@@ -128,7 +129,11 @@ func masterControllers(ctx context.Context, sc *Context, config *Config) error {
return
err
}
//helm.Register
helm
.
Register
(
ctx
,
sc
.
Apply
,
sc
.
Helm
.
Helm
()
.
V1
()
.
HelmChart
(),
sc
.
Batch
.
Batch
()
.
V1
()
.
Job
(),
sc
.
Auth
.
Rbac
()
.
V1
()
.
ClusterRoleBinding
(),
sc
.
Core
.
Core
()
.
V1
()
.
ServiceAccount
())
if
err
:=
servicelb
.
Register
(
ctx
,
sc
.
K8s
,
...
...
@@ -166,7 +171,7 @@ func stageFiles(ctx context.Context, sc *Context, controlConfig *config.Control)
return
err
}
return
deploy
.
WatchFiles
(
ctx
,
sc
.
K3s
.
K3s
()
.
V1
()
.
Addon
(),
dataDir
)
return
deploy
.
WatchFiles
(
ctx
,
sc
.
Apply
,
sc
.
K3s
.
K3s
()
.
V1
()
.
Addon
(),
dataDir
)
}
func
HomeKubeConfig
(
write
,
rootless
bool
)
(
string
,
error
)
{
...
...
pkg/servicelb/controller.go
View file @
d94a346a
...
...
@@ -6,15 +6,13 @@ import (
"sort"
"strconv"
"github.com/rancher/wrangler/pkg/slice"
"github.com/rancher/wrangler/pkg/relatedresource"
appclient
"github.com/rancher/k3s/pkg/generated/controllers/apps/v1"
coreclient
"github.com/rancher/k3s/pkg/generated/controllers/core/v1"
appclient
"github.com/rancher/wrangler-api/pkg/generated/controllers/apps/v1"
coreclient
"github.com/rancher/wrangler-api/pkg/generated/controllers/core/v1"
"github.com/rancher/wrangler/pkg/apply"
"github.com/rancher/wrangler/pkg/condition"
"github.com/rancher/wrangler/pkg/objectset"
"github.com/rancher/wrangler/pkg/relatedresource"
"github.com/rancher/wrangler/pkg/slice"
"github.com/sirupsen/logrus"
apps
"k8s.io/api/apps/v1"
core
"k8s.io/api/core/v1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment