Compare commits

..

9 Commits

Author SHA1 Message Date
Hussein Galal
3cdcb04e1a Add validation for system cluster name for both controller and cli (#81)
* Add validation for system cluster name for both controller and cli

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Add validation for system cluster name for both controller and cli

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Add validation for system cluster name for both controller and cli

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

---------

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-06 02:15:20 +02:00
Hussein Galal
fedfa109b5 Fix append to empty slice (#80)
* Fix append to empty slice

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

* Fix initialization of addresses slice

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>

---------

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-04 01:49:48 +02:00
Hussein Galal
99d043f2ee fix chart releases (#79)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 02:55:09 +02:00
Hussein Galal
57ed675a7f fix chart releases (#78)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 02:49:05 +02:00
Hussein Galal
7c9060c394 fix chart release (#77)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 02:37:08 +02:00
Hussein Galal
a104aacf5f Add github config mail and username for pushing k3k release (#76)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 02:24:46 +02:00
Hussein Galal
6346b06eb3 Add github config mail and username for pushing k3k release (#75)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 02:08:10 +02:00
Hussein Galal
6fd745f268 Fix chart release (#74)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 01:53:26 +02:00
Hussein Galal
1258fb6d58 Upgrade chart and fix manifest (#73)
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-01-03 00:03:08 +02:00
10 changed files with 67 additions and 50 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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: ""

View File

@@ -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")
}

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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{
{

View File

@@ -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))
}