Skip to content

Commit 6d531fb

Browse files
dymurrayShawn Hurley
authored and
Shawn Hurley
committed
pkg/scaffold/ansible; Add k8s_status module (operator-framework#972)
Move k8s_status rendering all inside of scaffold Add tests for k8s status <!-- Before making a PR, please read our contributing guidelines https://github.com/operator-framework/operator-sdk/blob/master/CONTRIBUTING.MD Note: Make sure your branch is rebased to the latest upstream master. --> **Description of the change:** Adds k8s_status module into Ansible Operator scaffolding **Motivation for the change:** k8s_status module is missing in 0.4.0 release. <!-- Note: If this PR is fixing an issue make sure to add a note saying: Closes #<ISSUE_NUMBER> -->
1 parent e8bf7d9 commit 6d531fb

File tree

9 files changed

+469
-3
lines changed

9 files changed

+469
-3
lines changed

commands/operator-sdk/cmd/migrate.go

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func migrateAnsible() {
8888
&dockerfile,
8989
&ansible.Entrypoint{},
9090
&ansible.UserSetup{},
91+
&ansible.K8sStatus{},
9192
)
9293
if err != nil {
9394
log.Fatalf("Migrate scaffold failed: (%v)", err)

hack/image/ansible/scaffold-ansible-image.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func main() {
3838
&ansible.DockerfileHybrid{},
3939
&ansible.Entrypoint{},
4040
&ansible.UserSetup{},
41+
&ansible.K8sStatus{},
4142
)
4243
if err != nil {
4344
log.Fatalf("Add scaffold failed: (%v)", err)

hack/tests/e2e-ansible-molecule.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ cp "$ROOTDIR/test/ansible-memcached/asserts.yml" memcached-operator/molecule/de
3333
cp "$ROOTDIR/test/ansible-memcached/molecule.yml" memcached-operator/molecule/test-local/molecule.yml
3434
cp -a "$ROOTDIR/test/ansible-memcached/memfin" memcached-operator/roles/
3535
cat "$ROOTDIR/test/ansible-memcached/watches-finalizer.yaml" >> memcached-operator/watches.yaml
36+
cat "$ROOTDIR/test/ansible-memcached/prepare-test-image.yml" >> memcached-operator/molecule/test-local/prepare.yml
3637

3738

3839
# Test local
3940
pushd memcached-operator
41+
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
4042
OPERATORDIR="$(pwd)"
4143
TEST_CLUSTER_PORT=24443 operator-sdk test local --namespace default
4244

4345
# Test cluster
4446
DEST_IMAGE="quay.io/example/memcached-operator:v0.0.2-test"
45-
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
4647
operator-sdk build --enable-tests "$DEST_IMAGE"
4748
trap_add 'remove_prereqs' EXIT
4849
deploy_prereqs

pkg/scaffold/ansible/dockerfilehybrid.go

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ ENV OPERATOR=/usr/local/bin/ansible-operator \
6565
6666
# install operator binary
6767
COPY build/_output/bin/{{.ProjectName}} ${OPERATOR}
68+
# install k8s_status Ansible module
69+
COPY library/k8s_status.py /usr/share/ansible/openshift/
6870
6971
COPY bin /usr/local/bin
7072
RUN /usr/local/bin/user_setup

0 commit comments

Comments
 (0)