Skip to content

Commit

Permalink
fix(installer): install through installer sucess (#2262)
Browse files Browse the repository at this point in the history
* fix(installer): add insecure-registry (#2258)

* refactor(logagent): update log file port (#1872)

* feat(installer): disabel import charts (#1879)

* feat(gateway): use node port instead (#1890)

* fix(installer): change install ingress step

* fix(installer): correct gateway manifest (#1902)

* fix(installer): stop uninstall gateway chart (#1903)

* fix(installer): remove servicename in deployment (#1960)

* feat(installer): transfor influxdb sts to depl (#1959)

* fix(installer): fix check influxdb func

* fix(installer): correct go lint
  • Loading branch information
Leo Ryu committed Apr 19, 2023
1 parent ba5523c commit 6b91f20
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 50 deletions.
2 changes: 2 additions & 0 deletions build/docker/tools/tke-installer/dockerd-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
--tlscacert "$DOCKER_TLS_CERTDIR/server/ca.pem" \
--tlscert "$DOCKER_TLS_CERTDIR/server/cert.pem" \
--tlskey "$DOCKER_TLS_CERTDIR/server/key.pem" \
--insecure-registry=registry.tke.com \
"$@"
DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="${DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS:-} -p 0.0.0.0:2376:2376/tcp"
else
# TLS disabled (-e DOCKER_TLS_CERTDIR='') or missing certs
set -- dockerd \
--host="$dockerSocket" \
--host=tcp://0.0.0.0:2375 \
--insecure-registry=registry.tke.com \
"$@"
DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="${DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS:-} -p 0.0.0.0:2375:2375/tcp"
fi
Expand Down
56 changes: 28 additions & 28 deletions cmd/tke-installer/app/installer/expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,34 @@ func (t *TKE) expansionRendAndCopy(from, to string, perm os.FileMode, needRend b
}

// importExpansionCharts uploads expansion charts
func (t *TKE) importExpansionCharts(ctx context.Context) error {
chartPath := path.Join(t.Config.CustomExpansionDir, t.Config.CustomChartsName)
if info, err := os.Stat(chartPath); err != nil {
if os.IsNotExist(err) {
// no chart file found means no charts.
return nil
}
return fmt.Errorf("locate chart file get system error %v,%v", chartPath, err)
} else if info.IsDir() {
return fmt.Errorf("chart file is a directory %v", chartPath)
}

// TODO: (workaround ) client init will only be called in createCluster.
// If we SKIP createCluster step, all client call will be panic
if t.registryClient == nil {
err := t.initDataForDeployTKE()
if err != nil {
return err
}
}

err := t.pushCharts(ctx, chartPath, constants.DefaultTeantID, constants.DefaultExpansionChartGroupName)
if err != nil {
return err
}
return nil

}
// func (t *TKE) importExpansionCharts(ctx context.Context) error {
// chartPath := path.Join(t.Config.CustomExpansionDir, t.Config.CustomChartsName)
// if info, err := os.Stat(chartPath); err != nil {
// if os.IsNotExist(err) {
// // no chart file found means no charts.
// return nil
// }
// return fmt.Errorf("locate chart file get system error %v,%v", chartPath, err)
// } else if info.IsDir() {
// return fmt.Errorf("chart file is a directory %v", chartPath)
// }

// // TODO: (workaround ) client init will only be called in createCluster.
// // If we SKIP createCluster step, all client call will be panic
// if t.registryClient == nil {
// err := t.initDataForDeployTKE()
// if err != nil {
// return err
// }
// }

// err := t.pushCharts(ctx, chartPath, constants.DefaultTeantID, constants.DefaultExpansionChartGroupName)
// if err != nil {
// return err
// }
// return nil

// }

func copyFile(src, dst string, perm os.FileMode) error {

Expand Down
28 changes: 14 additions & 14 deletions cmd/tke-installer/app/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,19 +460,19 @@ func (t *TKE) initSteps() {
},
}...)

if t.Para.Config.Registry.ThirdPartyRegistry == nil &&
t.Para.Config.Registry.TKERegistry != nil {
t.steps = append(t.steps, []types.Handler{
{
Name: "Import charts",
Func: t.importCharts,
},
{
Name: "Import Expansion Charts",
Func: t.importExpansionCharts,
},
}...)
}
// if t.Para.Config.Registry.ThirdPartyRegistry == nil &&
// t.Para.Config.Registry.TKERegistry != nil {
// t.steps = append(t.steps, []types.Handler{
// {
// Name: "Import charts",
// Func: t.importCharts,
// },
// {
// Name: "Import Expansion Charts",
// Func: t.importExpansionCharts,
// },
// }...)
// }

if len(t.Para.Config.ExpansionApps) > 0 {
t.steps = append(t.steps, []types.Handler{
Expand Down Expand Up @@ -1922,7 +1922,7 @@ func (t *TKE) installInfluxDBChart(ctx context.Context) error {
LocalChartPath: constants.ChartDirName + "influxdb/",
Enable: true,
ConditionFunc: func() (bool, error) {
ok, err := apiclient.CheckStatefulSet(ctx, t.globalClient, t.namespace, "influxdb")
ok, err := apiclient.CheckDeployment(ctx, t.globalClient, t.namespace, "influxdb")
if err != nil || !ok {
return false, nil
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
apiVersion: apps/v1
kind: StatefulSet
kind: Deployment
metadata:
name: influxdb
namespace: tke
labels:
app: influxdb
spec:
replicas: 1
serviceName: influxdb
selector:
matchLabels:
app: influxdb
strategy:
type: Recreate
template:
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spec:
selector:
matchLabels:
app: tke-registry-api
strategy:
type: Recreate
template:
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ spec:
app: tke-gateway
ports:
- name: http
protocol: TCP
nodePort: 31180
port: 80
protocol: TCP
targetPort: 80
- name: https
protocol: TCP
nodePort: 31443
port: 443
protocol: TCP
targetPort: 443
---
apiVersion: apps/v1
Expand All @@ -36,7 +38,6 @@ spec:
app: tke-gateway
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
nodeSelector:
node-role.kubernetes.io/master: ""
containers:
Expand Down
5 changes: 3 additions & 2 deletions pkg/logagent/registry/logagent/storage/fileproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package storage
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/api/errors"
"net/http"
"net/http/httputil"
"net/url"
"time"

"k8s.io/apimachinery/pkg/api/errors"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
netutil "k8s.io/apimachinery/pkg/util/net"
Expand Down Expand Up @@ -51,7 +52,7 @@ func (r *LogfileProxyREST) Connect(ctx context.Context, clusterName string, opts
return nil, errors.NewInternalError(fmt.Errorf("unable to get host ip with config %+v", *proxyOpts))
}
return &logFileProxyHandler{
location: &url.URL{Scheme: "http", Host: hostIP + ":8090"},
location: &url.URL{Scheme: "http", Host: hostIP + ":" + util.LogagentPort},
namespace: proxyOpts.Namespace,
pod: proxyOpts.Pod,
container: proxyOpts.Container,
Expand Down
2 changes: 1 addition & 1 deletion pkg/logagent/util/logagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
LogagentPort = "8090"
LogagentPort = "31139"
)

type ReaderCloserGetter interface {
Expand Down

0 comments on commit 6b91f20

Please sign in to comment.