-
Notifications
You must be signed in to change notification settings - Fork 126
CSPL-821 Implement Init Container Image #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSPL-821 Implement Init Container Image #350
Conversation
pkg/splunk/client/awss3client.go
Outdated
|
|
||
| // GetInitContainerCmd returns the init container command on a per app source basis to be used by the initContainer | ||
| func (awsclient *AWSS3Client) GetInitContainerCmd(endpoint string, bucket string, path string, appSrcName string, appMnt string) []string { | ||
| return ([]string{fmt.Sprintf("--endpoint-url=%s", endpoint), "s3", "sync", fmt.Sprintf("s3://%s/%s", bucket, path), fmt.Sprintf("%s/%s", appMnt, appSrcName) /*, "--include \"*.tgz\"", "--include \"*.spl\""*/}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Info: Just for my understanding, does s3 sync utility uses the keys from the environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It pulls the creds from the env or command line (if specified, which they aren't here)
pkg/splunk/enterprise/util.go
Outdated
| Image: s3Client.GetInitContainerImage(), | ||
| ImagePullPolicy: "IfNotPresent", | ||
| Name: initContainerName, | ||
| Args: s3Client.GetInitContainerCmd(appS3Endpoint, appBkt, appPath, appName, appBktMnt), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Any particular reason for using these local variables or we could have directly used the member variables? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely for readability and portability. I can switch it if you like or just let the compiler handle it.
6055b68 to
ac2e364
Compare
|
@jryb In the Unit Test examples, I see the old apiVersion |
I've retest with the |
Add minio client to S3Client Add an init container image and command for each S3Client Add initContainer to Pod Spec on pre appSource Add init-apps volume to all init container and Splunk container
2f53cc4 to
733e37d
Compare
Problem
At startup the Splunk pod needs the application packages it needs to install local to the pod to be installed via Ansible. These packages are define in the CRD via CSPL-1023 (#329).
Solution
To get the packages local to the Splunk instance init containers are used based on the app repository type to download the images to a shared volume. This volume will be shared between all init containers and the Splunk container. App packages will be placed in this volume based on the
namedefine in theirappSources. An init container is created perappSourceto connect to theappRepovolumeand download all packages in theappSourcethis shared volume. Once finished, all app package will be available for installation prior to the Splunk instance's instantiation.Additional changes made:
minioas aproviderclient to the S3 client API to handle S3 setups that use Minio as their object store (like my local test setup).getRegion()function to inside the aws S3 client code as it is AWS specific.Endpointto the S3 client code (particularly for the Minio client)Unit Test
Verified app package download for both the minio and aws
providersusing multiple volume and multipleappSources.Minio
CR
Validate
AWS
CR
Validate
Mixed Minio and AWS
CR
Validate