nfs
This commit is contained in:
parent
ae28a70c71
commit
ac7329479f
|
|
@ -37,6 +37,14 @@ spec:
|
|||
value: 192.168.252.250
|
||||
- name: NFS_PATH
|
||||
value: /mnt/CGdata/ms
|
||||
volumeMounts:
|
||||
- name: k8s-manager-nfs-volume
|
||||
mountPath: /mnt/CGdata/ms
|
||||
volumes:
|
||||
- name: k8s-manager-nfs-volume
|
||||
nfs:
|
||||
server: 192.168.252.250
|
||||
path: /mnt/CGdata/ms
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
|
|
|||
10
main.go
10
main.go
|
|
@ -41,7 +41,7 @@ func main() {
|
|||
r.POST("/dep", m.JWTAuthMiddleware, m.CreateDeleteDeployment)
|
||||
r.DELETE("/dep", m.JWTAuthMiddleware, m.CreateDeleteDeployment)
|
||||
|
||||
r.GET("/login", Test)
|
||||
r.GET("/login", LoginToken)
|
||||
r.Any("/test_token", TestToken)
|
||||
r.GET("/username", m.JWTAuthMiddleware, m.GetUsername)
|
||||
err := r.Run(":8000")
|
||||
|
|
@ -135,7 +135,7 @@ func AesDecrypt(data []byte, key []byte) ([]byte, error) {
|
|||
return crypted, nil
|
||||
}
|
||||
|
||||
func Test(c *gin.Context) {
|
||||
func LoginToken(c *gin.Context) {
|
||||
username := c.Request.URL.Query().Get("username")
|
||||
var err error
|
||||
if username == "" {
|
||||
|
|
@ -147,6 +147,11 @@ func Test(c *gin.Context) {
|
|||
"msg": "user name error",
|
||||
})
|
||||
} else {
|
||||
Login(c, username)
|
||||
}
|
||||
}
|
||||
|
||||
func Login(c *gin.Context, username string) {
|
||||
token, err := m.GenerateToken(username)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
|
@ -165,7 +170,6 @@ func Test(c *gin.Context) {
|
|||
}
|
||||
c.Redirect(http.StatusTemporaryRedirect, redirectUrl)
|
||||
}
|
||||
}
|
||||
|
||||
func TestToken(c *gin.Context) {
|
||||
token := c.Request.URL.Query().Get("cgtoken")
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ func (c *K8sClient) DeploymentExists(deploymentName string) bool {
|
|||
func (c *K8sClient) UpdateDeployment(app *AppModel) {
|
||||
labelKey, labelValue := app.GetLabel()
|
||||
l := map[string]string{labelKey: labelValue}
|
||||
if _, err := os.Stat(app.NFSPath()); os.IsNotExist(err) {
|
||||
os.MkdirAll(app.NFSPath(), os.ModeDir)
|
||||
}
|
||||
podLabels := map[string]string{
|
||||
labelKey: labelValue,
|
||||
"cg-deployment": app.DeploymentName(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue