mirror of
https://github.com/rancher/k3k.git
synced 2026-02-22 22:04:16 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cdcb04e1a | ||
|
|
fedfa109b5 | ||
|
|
99d043f2ee | ||
|
|
57ed675a7f | ||
|
|
7c9060c394 | ||
|
|
a104aacf5f | ||
|
|
6346b06eb3 | ||
|
|
6fd745f268 | ||
|
|
1258fb6d58 |
62
.drone.yml
62
.drone.yml
@@ -20,9 +20,9 @@ steps:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
ref:
|
||||
exclude:
|
||||
- k3k-chart
|
||||
- refs/tags/chart-*
|
||||
|
||||
- name: package-chart
|
||||
image: rancher/dapper:v0.6.0
|
||||
@@ -35,26 +35,50 @@ steps:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- k3k-chart
|
||||
ref:
|
||||
- refs/tags/chart-*
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: release-chart
|
||||
image: plugins/github-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: github_token
|
||||
checksum:
|
||||
- sha256
|
||||
checksum_file: CHECKSUMsum.txt
|
||||
checksum_flatten: true
|
||||
files:
|
||||
- "deploy/*"
|
||||
when:
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
ref:
|
||||
include:
|
||||
- refs/tags/chart-*
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: index-chart
|
||||
image: rancher/dapper:v0.6.0
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: github_token
|
||||
commands:
|
||||
- dapper release-chart
|
||||
- dapper index-chart
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- k3k-chart
|
||||
ref:
|
||||
- refs/tags/chart-*
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: github_binary_release
|
||||
image: plugins/github-release
|
||||
@@ -72,13 +96,13 @@ steps:
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
ref:
|
||||
- refs/head/master
|
||||
- refs/tags/*
|
||||
include:
|
||||
- refs/head/master
|
||||
- refs/tags/*
|
||||
exclude:
|
||||
- refs/tags/chart-*
|
||||
event:
|
||||
- tag
|
||||
branch:
|
||||
exclude:
|
||||
- k3k-chart
|
||||
|
||||
- name: docker-publish
|
||||
image: plugins/docker
|
||||
@@ -93,13 +117,13 @@ steps:
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
ref:
|
||||
- refs/head/master
|
||||
- refs/tags/*
|
||||
include:
|
||||
- refs/head/master
|
||||
- refs/tags/*
|
||||
exclude:
|
||||
- refs/tags/chart-*
|
||||
event:
|
||||
- tag
|
||||
branch:
|
||||
exclude:
|
||||
- k3k-chart
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
@@ -129,10 +153,10 @@ steps:
|
||||
instance:
|
||||
- drone-publish.rancher.io
|
||||
ref:
|
||||
include:
|
||||
- refs/head/master
|
||||
- refs/tags/*
|
||||
branch:
|
||||
exclude:
|
||||
- k3k-chart
|
||||
- refs/tags/chart-*
|
||||
depends_on:
|
||||
- amd64
|
||||
|
||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
||||
name: k3k
|
||||
description: A Helm chart for K3K
|
||||
type: application
|
||||
version: 0.1.0-r1
|
||||
appVersion: 0.0.0-alpha6
|
||||
version: 0.1.1-r1
|
||||
appVersion: 0.1.0
|
||||
|
||||
@@ -5,7 +5,7 @@ image:
|
||||
repository: rancher/k3k
|
||||
pullPolicy: Always
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "v0.0.0-alpha6"
|
||||
tag: "v0.1.0-amd64"
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/rancher/k3k/cli/cmds"
|
||||
"github.com/rancher/k3k/pkg/apis/k3k.io/v1alpha1"
|
||||
"github.com/rancher/k3k/pkg/controller/cluster"
|
||||
"github.com/rancher/k3k/pkg/controller/cluster/server"
|
||||
"github.com/rancher/k3k/pkg/controller/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -210,6 +211,9 @@ func validateCreateFlags(clx *cli.Context) error {
|
||||
if name == "" {
|
||||
return errors.New("empty cluster name")
|
||||
}
|
||||
if name == cluster.ClusterInvalidName {
|
||||
return errors.New("invalid cluster name")
|
||||
}
|
||||
if servers <= 0 {
|
||||
return errors.New("invalid number of servers")
|
||||
}
|
||||
|
||||
@@ -3,16 +3,4 @@ manifests:
|
||||
- image: rancher/k3k:{{replace "+" "-" build.tag}}-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: rancher/k3k:{{replace "+" "-" build.tag}}-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
- image: rancher/k3k:{{replace "+" "-" build.tag}}-windows-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
- image: rancher/k3k:{{replace "+" "-" build.tag}}-s390x
|
||||
platform:
|
||||
architecture: s390x
|
||||
os: linux
|
||||
@@ -12,21 +12,20 @@ if [ $(git tag -l "$version") ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# release the chart with artifacts
|
||||
cr upload --token ${GITHUB_TOKEN} \
|
||||
--release-name-template "chart-{{ .Version }}" \
|
||||
--package-path ./deploy/ \
|
||||
--git-repo k3k \
|
||||
--skip-existing \
|
||||
-o rancher
|
||||
|
||||
# update the index.yaml
|
||||
cr index --token ${GITHUB_TOKEN} \
|
||||
--release-name-template "chart-{{ .Version }}" \
|
||||
--package-path ./deploy/ \
|
||||
--index-path index.yaml \
|
||||
--git-repo k3k \
|
||||
-o rancher \
|
||||
--push
|
||||
-o rancher
|
||||
|
||||
|
||||
# push to gh-pages
|
||||
git config --global user.email "hussein.galal.ahmed.11@gmail.com"
|
||||
git config --global user.name "galal-hussein"
|
||||
git config --global url.https://${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/
|
||||
|
||||
# push index.yaml to gh-pages
|
||||
git add index.yaml
|
||||
git commit -m "add chart-${CHART_TAG} to index.yaml"
|
||||
git push --force --set-upstream origin HEAD:gh-pages
|
||||
@@ -40,6 +40,7 @@ const (
|
||||
clusterController = "k3k-cluster-controller"
|
||||
clusterFinalizerName = "cluster.k3k.io/finalizer"
|
||||
etcdPodFinalizerName = "etcdpod.k3k.io/finalizer"
|
||||
ClusterInvalidName = "system"
|
||||
|
||||
maxConcurrentReconciles = 1
|
||||
|
||||
@@ -178,6 +179,10 @@ func (c *ClusterReconciler) Reconcile(ctx context.Context, req reconcile.Request
|
||||
}
|
||||
|
||||
func (c *ClusterReconciler) createCluster(ctx context.Context, cluster *v1alpha1.Cluster) error {
|
||||
if cluster.Name == ClusterInvalidName {
|
||||
klog.Errorf("Invalid cluster name %s, no action will be taken", cluster.Name)
|
||||
return nil
|
||||
}
|
||||
s := server.New(cluster, c.Client)
|
||||
|
||||
if cluster.Spec.Persistence != nil {
|
||||
|
||||
@@ -22,7 +22,6 @@ func (s *Server) Ingress(ctx context.Context, client client.Client) (*networking
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ingressRules := s.ingressRules(addresses)
|
||||
ingress := &networkingv1.Ingress{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
@@ -47,7 +46,6 @@ func (s *Server) Ingress(ctx context.Context, client client.Client) (*networking
|
||||
func (s *Server) ingressRules(addresses []string) []networkingv1.IngressRule {
|
||||
var ingressRules []networkingv1.IngressRule
|
||||
pathTypePrefix := networkingv1.PathTypePrefix
|
||||
|
||||
for _, address := range addresses {
|
||||
rule := networkingv1.IngressRule{
|
||||
Host: s.cluster.Name + "." + address + wildcardDNS,
|
||||
|
||||
@@ -212,7 +212,7 @@ func (s *Server) StatefulServer(ctx context.Context, cluster *v1alpha1.Cluster)
|
||||
|
||||
replicas = *cluster.Spec.Servers
|
||||
|
||||
if cluster.Spec.Persistence.Type != EphermalNodesType {
|
||||
if cluster.Spec.Persistence != nil && cluster.Spec.Persistence.Type != EphermalNodesType {
|
||||
persistent = true
|
||||
pvClaims = []v1.PersistentVolumeClaim{
|
||||
{
|
||||
|
||||
@@ -58,8 +58,7 @@ func Addresses(ctx context.Context, client client.Client) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addresses := make([]string, len(nodeList.Items))
|
||||
|
||||
var addresses []string
|
||||
for _, node := range nodeList.Items {
|
||||
addresses = append(addresses, nodeAddress(&node))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user