Skip to content

Commit

Permalink
Remove isSecurityEnabled flag (#36)
Browse files Browse the repository at this point in the history
* Remove isSecurityEnabled flag

* Setting init image tag in pod status

---------

Co-authored-by: Tanmay Jain <[email protected]>
  • Loading branch information
sud82 and tanmayja authored May 18, 2024
1 parent 667868a commit 54c3b8e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.21.8

require (
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240423073150-4fec4fc6ff30
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240514122243-c61475a086b7
github.com/go-logr/logr v1.4.1
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0
github.com/mitchellh/go-ps v1.0.0
Expand All @@ -19,7 +19,7 @@ require (

require (
github.com/aerospike/aerospike-client-go/v7 v7.1.0 // indirect
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240423071640-92c4d186a795 // indirect
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240506094830-f70b1a5ea4e7 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand All @@ -32,12 +32,14 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
Expand All @@ -51,6 +53,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/ginkgo/v2 v2.13.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
Expand All @@ -72,6 +75,7 @@ require (
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ github.com/aerospike/aerospike-client-go/v7 v7.1.0 h1:yvCTKdbpqZxHvv7sWsFHV1j49j
github.com/aerospike/aerospike-client-go/v7 v7.1.0/go.mod h1:AkHiKvCbqa1c16gCNGju3c5X/yzwLVvblNczqjxNwNk=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240423073150-4fec4fc6ff30 h1:4rYMSJf5wD5fiHBWA7suVdLhTXW/PzpLY1d9n/HtmeQ=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240423073150-4fec4fc6ff30/go.mod h1:7MaeWnVeKNmMx6t4/TgUymhTw5kSggBprM6fNNXGOdI=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240514093231-1eadbdef9fbc h1:IEpORMKxk5E4UIhA84reYtn9GoRJBEPlHKuHLc9ZLec=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240514093231-1eadbdef9fbc/go.mod h1:kaBHJ15XxjQm38ccPyDa0jvkzjaqWpX2VeTjCRrrZyw=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240514122243-c61475a086b7 h1:nYVnKriRzaw3DccV0cfJc2XwNA0uiozpxwh0HPapHpk=
github.com/aerospike/aerospike-kubernetes-operator v0.0.0-20240514122243-c61475a086b7/go.mod h1:kaBHJ15XxjQm38ccPyDa0jvkzjaqWpX2VeTjCRrrZyw=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240423071640-92c4d186a795 h1:6YxT+4mYhnGtUu42RSVZaCT8DW9Npx0DUJB68tnXm8w=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240423071640-92c4d186a795/go.mod h1:3JKrmC/mLSV8SygbrPQPNV8T7bFaTMjB8wfnX25gB+4=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240506094830-f70b1a5ea4e7 h1:aeK9T07k3l9Ea/LKnCXKRbVWu+o6rZVpUpGadxEokxA=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240506094830-f70b1a5ea4e7/go.mod h1:3JKrmC/mLSV8SygbrPQPNV8T7bFaTMjB8wfnX25gB+4=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
Expand All @@ -14,6 +20,9 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -68,6 +77,7 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down Expand Up @@ -135,6 +145,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
Expand Down Expand Up @@ -200,6 +211,7 @@ golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
20 changes: 5 additions & 15 deletions pkg/update_pod_status_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func execute(cmd []string, stderr *os.File) error {
return command.Run()
}

func (initp *InitParams) getPodImage(pod *corev1.Pod) string {
func (initp *InitParams) getPodImages(pod *corev1.Pod) (serverImage, initImage string) {
initp.logger.Info("Get pod image", "podName", pod.Name)

return pod.Spec.Containers[0].Image
return pod.Spec.Containers[0].Image, pod.Spec.InitContainers[0].Image
}

func (initp *InitParams) getPVCUid(ctx context.Context, pod *corev1.Pod, volName string) (string, error) {
Expand Down Expand Up @@ -536,7 +536,7 @@ func (initp *InitParams) manageVolumesAndUpdateStatus(ctx context.Context, resta
return err
}

podImage := initp.getPodImage(pod)
podImage, podInitImage := initp.getPodImages(pod)
prevImage := ""

if _, ok := initp.aeroCluster.Status.Pods[initp.podName]; ok {
Expand Down Expand Up @@ -593,29 +593,19 @@ func (initp *InitParams) manageVolumesAndUpdateStatus(ctx context.Context, resta
}
}

ver, err := asdbv1.GetImageVersion(initp.aeroCluster.Spec.Image)
if err != nil {
return err
}

securityEnabled, err := asdbv1.IsSecurityEnabled(ver, initp.aeroCluster.Spec.AerospikeConfig)
if err != nil {
return err
}

metadata := initp.getNodeMetadata()
metadata.Image = podImage
metadata.InitImage = podInitImage
metadata.InitializedVolumes = initializedVolumes
metadata.DirtyVolumes = dirtyVolumes
metadata.DynamicConfigUpdateStatus = ""
metadata.IsSecurityEnabled = securityEnabled

data, err := os.ReadFile(aerospikeConf)
if err != nil {
return err
}

if err := retry.OnError(retry.DefaultBackoff, func(err error) bool {
if err := retry.OnError(retry.DefaultBackoff, func(_ error) bool {
// Customize the error check for retrying, return true to retry, false to stop retrying
return true
}, func() error {
Expand Down

0 comments on commit 54c3b8e

Please sign in to comment.