Skip to content

Commit

Permalink
Merge pull request #52 from Ragin-LundF/develop
Browse files Browse the repository at this point in the history
Release 3.3.0
  • Loading branch information
Ragin-LundF authored Aug 12, 2021
2 parents 82bf2da + 37e8d00 commit f972a3a
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 189 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 3.3.0
## Bugfixes
- Fixed issue with old deploy only nginx value files [#48](https://github.com/Ragin-LundF/k8s-jcasc-management-go/issues/48)
- Fixed issue with reduced project config files for Nginx deploy only. Now only the nginx and base config is still required. [#47](https://github.com/Ragin-LundF/k8s-jcasc-management-go/issues/47)

## Library Updates
- Updated the base libraries to current versions

# 3.2.0
## Configuration to keep temporary files

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.3.0
25 changes: 25 additions & 0 deletions app/actions/install/install_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,36 @@ func (projectConfig *ProjectConfig) LoadProjectConfigIfExists(namespace string)
// config loaded successfully, assign it
projectConfig.Project = prj
projectConfig.ConfigLoaded = true

updateLoadedConfigWithDefaults(projectConfig)
} else {
configureProjectWithoutConfig(projectConfig)
}

return nil
}

func updateLoadedConfigWithDefaults(projectConfig *ProjectConfig) {
if projectConfig.Project.JCasc == nil {
projectConfig.Project.JCasc = project.NewJCascConfig()
}

if projectConfig.Project.JenkinsHelmValues == nil {
projectConfig.Project.JenkinsHelmValues = project.NewJenkinsHelmValues()
}

if projectConfig.Project.PersistentVolumeClaim == nil {
projectConfig.Project.PersistentVolumeClaim = project.NewPersistentVolumeClaim()
}
}

func configureProjectWithoutConfig(projectConfig *ProjectConfig) {
// Jenkins
if !files.FileOrDirectoryExists(files.AppendPath(projectConfig.ProjectPath, constants.FilenameJenkinsHelmValues)) {
projectConfig.Project.Base.DeploymentOnly = true
}
}

// PrepareInstallYAML : Prepare temporary YAML if required or return path to project file
func (projectConfig *ProjectConfig) PrepareInstallYAML(filename string) (fileWithPath string, err error) {
fileWithPath = files.AppendPath(projectConfig.ProjectPath, filename)
Expand Down
4 changes: 2 additions & 2 deletions app/actions/project/jcasc_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func (k8s *kubernetes) ServerCertificate() string {

// ----- internal methods

// newJCascConfig : Create new Jenkins Helm values structure
func newJCascConfig() *jcascConfig {
// NewJCascConfig : Create new Jenkins Helm values structure
func NewJCascConfig() *jcascConfig {
return &jcascConfig{
CredentialIDs: newCredentialIDs(),
Clouds: newClouds(),
Expand Down
10 changes: 5 additions & 5 deletions app/actions/project/jcasc_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestCreateJCascConfig(t *testing.T) {
testDefaultProjectConfiguration(t, false)
cmdexecutor.Executor = TestCommandExec{}
var jcascConfig = newJCascConfig()
var jcascConfig = NewJCascConfig()

assert.Equal(t, testJcascKubernetesCertificate, jcascConfig.Clouds.Kubernetes.ServerCertificate())
assert.Empty(t, jcascConfig.Clouds.Kubernetes.Templates.AdditionalCloudTemplates)
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestCreateJCascConfigCloudsContextCertificate(t *testing.T) {
"custom-k8s": customCertificate,
}

var jcascConfig = newJCascConfig()
var jcascConfig = NewJCascConfig()

assert.Equal(t, customCertificate, jcascConfig.Clouds.Kubernetes.ServerCertificate())
assert.Empty(t, jcascConfig.Clouds.Kubernetes.Templates.AdditionalCloudTemplates)
Expand All @@ -58,7 +58,7 @@ func TestCreateJCascConfigCloudsContextCertificate(t *testing.T) {
func TestCreateJCascConfigSystemMessage(t *testing.T) {
testDefaultProjectConfiguration(t, false)
cmdexecutor.Executor = TestCommandExec{}
var jcascConfig = newJCascConfig()
var jcascConfig = NewJCascConfig()

assert.Empty(t, jcascConfig.SystemMessage)
}
Expand All @@ -69,7 +69,7 @@ func TestCreateJCascConfigJobsConfig(t *testing.T) {

testDefaultProjectConfiguration(t, false)
cmdexecutor.Executor = TestCommandExec{}
var jcascConfig = newJCascConfig()
var jcascConfig = NewJCascConfig()
jcascConfig.SetJobsDefinitionRepository(jobsRepository)
jcascConfig.SetJobsSeedRepository(jobsSeedRepository)

Expand All @@ -84,7 +84,7 @@ func TestCreateJCascConfigSecurityRealmPasswords(t *testing.T) {

testDefaultProjectConfiguration(t, false)
cmdexecutor.Executor = TestCommandExec{}
var jcascConfig = newJCascConfig()
var jcascConfig = NewJCascConfig()
jcascConfig.SetAdminPassword(adminPassword)
jcascConfig.SetUserPassword(userPassword)

Expand Down
19 changes: 9 additions & 10 deletions app/actions/project/jenkins_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ type jenkinsHelmPersistence struct {
StorageClass string `yaml:"storageClass,omitempty"`
}

// newJenkinsHelmValues : Create new Jenkins Helm values structure
func newJenkinsHelmValues() *jenkinsHelmValues {
// NewJenkinsHelmValues : Create new Jenkins Helm values structure
func NewJenkinsHelmValues() *jenkinsHelmValues {
return &jenkinsHelmValues{
Controller: newDefaultJenkinsHelmController(),
Persistence: newDefaultJenkinsHelmPersistence(),
AdditionalNamespaces: newDefaultAdditionalNamespaces(),
Controller: NewDefaultJenkinsHelmController(),
Persistence: NewDefaultJenkinsHelmPersistence(),
AdditionalNamespaces: NewDefaultAdditionalNamespaces(),
}
}

// ----- internal methods
// newDefaultJenkinsHelmController : create a new default jenkinsHelmMaster structure
func newDefaultJenkinsHelmController() jenkinsHelmMaster {
// NewDefaultJenkinsHelmController : create a new default jenkinsHelmMaster structure
func NewDefaultJenkinsHelmController() jenkinsHelmMaster {
return jenkinsHelmMaster{
Image: configuration.GetConfiguration().Jenkins.Container.Image,
Tag: configuration.GetConfiguration().Jenkins.Container.Tag,
Expand All @@ -56,14 +55,14 @@ func newDefaultJenkinsHelmController() jenkinsHelmMaster {
}
}

func newDefaultJenkinsHelmPersistence() jenkinsHelmPersistence {
func NewDefaultJenkinsHelmPersistence() jenkinsHelmPersistence {
return jenkinsHelmPersistence{
StorageClass: configuration.GetConfiguration().Jenkins.Persistence.StorageClass,
AccessMode: configuration.GetConfiguration().Jenkins.Persistence.AccessMode,
Size: configuration.GetConfiguration().Jenkins.Persistence.StorageSize,
}
}

func newDefaultAdditionalNamespaces() []string {
func NewDefaultAdditionalNamespaces() []string {
return []string{}
}
2 changes: 1 addition & 1 deletion app/actions/project/jenkins_helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestCreateJenkinsHelmValues(t *testing.T) {
testDefaultProjectConfiguration(t, false)

var jenkinsHelmValues = newJenkinsHelmValues()
var jenkinsHelmValues = NewJenkinsHelmValues()

assertDefaultJenkinsHelmValues(jenkinsHelmValues, t)
}
Expand Down
4 changes: 2 additions & 2 deletions app/actions/project/persistent_volume_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type pvcSpecResources struct {
StorageSize string `yaml:"storageSize,omitempty"`
}

// newPersistentVolumeClaim : creates a new instance of PersistentVolumeClaim
func newPersistentVolumeClaim() *persistentVolumeClaim {
// NewPersistentVolumeClaim : creates a new instance of PersistentVolumeClaim
func NewPersistentVolumeClaim() *persistentVolumeClaim {
var pvc = &persistentVolumeClaim{
Spec: newDefaultSpec(),
}
Expand Down
2 changes: 1 addition & 1 deletion app/actions/project/persistent_volume_claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func TestCreatePersistentVolumeClaim(t *testing.T) {
testDefaultProjectConfiguration(t, false)

var pvc = newPersistentVolumeClaim()
var pvc = NewPersistentVolumeClaim()

assert.Equal(t, testConfigJenkinsMasterPvcSize, pvc.Spec.Resources.StorageSize)
assert.Equal(t, testConfigJenkinsMasterPvcAccessMode, pvc.Spec.AccessMode)
Expand Down
6 changes: 3 additions & 3 deletions app/actions/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ type base struct {
func NewProject() Project {
return Project{
Base: newBase(),
JenkinsHelmValues: newJenkinsHelmValues(),
JCasc: newJCascConfig(),
PersistentVolumeClaim: newPersistentVolumeClaim(),
JenkinsHelmValues: NewJenkinsHelmValues(),
JCasc: NewJCascConfig(),
PersistentVolumeClaim: NewPersistentVolumeClaim(),
Nginx: newNginx(),
StoreConfigOnly: true,
}
Expand Down
23 changes: 13 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@ module k8s-management-go
go 1.15

require (
fyne.io/fyne/v2 v2.0.3
fyne.io/fyne/v2 v2.0.4
github.com/atotto/clipboard v0.1.4
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be // indirect
github.com/goware/prefixer v0.0.0-20160118172347-395022866408
github.com/hashicorp/go-version v1.3.0
github.com/imdario/mergo v0.3.12
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5 // indirect
github.com/lunixbochs/vtclean v1.0.0 // indirect
github.com/manifoldco/promptui v0.8.0
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/schollz/progressbar/v3 v3.8.1
github.com/srwiley/oksvg v0.0.0-20210320200257-875f767ac39a // indirect
github.com/schollz/progressbar/v3 v3.8.2
github.com/srwiley/oksvg v0.0.0-20210519022825-9fc0c575d5fe // indirect
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 // indirect
github.com/stretchr/testify v1.7.0
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e // indirect
go.uber.org/zap v1.19.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/mod v0.4.2
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
Loading

0 comments on commit f972a3a

Please sign in to comment.