feat: implement most of deployments
The big feature missing from deployments today is healthchecks, which require extra parsing of the app.json format since the healthchecks there aren't immediately serializable to kubernetes deployment healthchecks. Other smaller missing functionality from the existing OSS kubernetes scheduler are: - The ability to set custom pod annotations - The ability to set custom deployment annotations - The ability to mount volumes Exposing these pieces of functionality will come at a later date, if at all.
This commit is contained in:
1 parent
6c234c66a3
commit
6fb03eda4e
11 files changed
+1810
-57
No files matched your search
@@ -1,12 +1,49 @@
|
||||
package scheduler_k3s
|
||||
|
||||
var (
|
||||
// DefaultProperties is a map of all valid network properties with corresponding default property values
|
||||
DefaultProperties = map[string]string{}
|
||||
import (
|
||||
"sync"
|
||||
|
||||
// GlobalProperties is a map of all valid global network properties
|
||||
traefikv1alpha1 "github.com/traefik/traefik/v2/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
kjson "k8s.io/apimachinery/pkg/runtime/serializer/json"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultProperties is a map of all valid k3s properties with corresponding default property values
|
||||
DefaultProperties = map[string]string{
|
||||
"image-pull-secrets": "",
|
||||
"rollback-on-failure": "",
|
||||
"namespace": "default",
|
||||
"timeout": "300",
|
||||
}
|
||||
|
||||
// GlobalProperties is a map of all valid global k3s properties
|
||||
GlobalProperties = map[string]bool{
|
||||
"network-interface": true,
|
||||
"token": true,
|
||||
"network-interface": true,
|
||||
"rollback-on-failure": true,
|
||||
"token": true,
|
||||
"timeout": true,
|
||||
}
|
||||
)
|
||||
|
||||
const KubeConfigPath = "/etc/rancher/k3s/k3s.yaml"
|
||||
|
||||
var (
|
||||
runtimeScheme = runtime.NewScheme()
|
||||
codecs = serializer.NewCodecFactory(runtimeScheme)
|
||||
deserializer = codecs.UniversalDeserializer()
|
||||
jsonSerializer = kjson.NewSerializerWithOptions(kjson.DefaultMetaFactory, runtimeScheme, runtimeScheme, kjson.SerializerOptions{})
|
||||
)
|
||||
|
||||
var k8sNativeSchemeOnce sync.Once
|
||||
|
||||
func init() {
|
||||
k8sNativeSchemeOnce.Do(func() {
|
||||
_ = appsv1.AddToScheme(runtimeScheme)
|
||||
_ = corev1.AddToScheme(runtimeScheme)
|
||||
_ = traefikv1alpha1.AddToScheme(runtimeScheme)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user